Thursday, July 28, 2011

Don't use getElementsbyClassName in JavaScript!

Recently I was asked to update an existing site.  Going into someone else's code can be one of the tougher parts of the job, as you must get into the head of the other developer to see how and why he made the decisions he did.  In his JavaScript, he used Prototype, which is a JavaScript Framework. Because I was not as familiar with Prototype, I used some regular JavaScript to code out my site. Unfortunately, while coding I kept getting an error.  I found out after some research that the “getElementsByClassName” method, a very useful bit of code in JavaScript, is not supported in older versions of Prototype.  Only Prototype 1.6 and later supports it. Here is a link to the Prototype site on this issue: http://www.prototypejs.org/api/element/getElementsByClassName

I am glad most AJAX libraries have learned to not overwrite native objects.  It is great to work with a robust language, but be wary of obtrusive JavaScript issues like these.

The issues with “getElementsByClassName” do not end with the recent updates to Prototype. IE8 does not support “getElementsByClassName”.  This is just another reason coders dislike IE. The browser has a history of being slow to adopt new code standards and is sometimes considered unsafe and insecure.  It is also noted for rendering websites wrong, causing many coders to spend countless hours working into the night, debugging issues.  Until IE8 accepts “getElementsByClassName”, I do not recommend using it.

Here is an alternative way of using “getElementsByClassName” that works in all browsers; make the function yourself: http://www.webmuse.co.uk/blog/custom-getelementsbyclassname-function-for-all-browsers/

      - Dan Schipul


Dan Schipul is a Web Developer for Ridgefield One

Ridgefield One provides An Extra Sets of Hands on a Temporary Basis - Offering IT and Creative Web Services for companies located in Fairfield, Connecticut and Westchester, New York. Also helping companies with their temporary Office Administrative hiring needs.

Monday, July 18, 2011

Surgery to Work: My Story of Recovery

Getting an operation is no fun at all.  I, for one, do not like to miss work.  So when I recently had back surgery and was out of work for about two months, I was not happy.  At first I returned to the office for short periods of time and only recently have been able to get through an entire whole day and work week.  With back surgery, the recovery time varies depending on the type and extent of the procedure. Some people can return to work in a month or less, for others it can take several months or as long as a year.

While I was home recovering I did some reading about people who have had back surgery.  One survey of orthopedic doctors (those who performed back surgery) showed that many were back to work full-time in a month!  They must have been taking some powerful pain medicine because even with the pain medications I am taking, along with physical therapy, it is taking me longer.  But then, the survey didn’t mention the age range of the participants.  Since I’m over 62 my slower recover probably makes sense, as younger people can bounce back (no pun intended) faster.

There are a lot of “Back Surgery Recovery Tips” on the internet.  The site Healthier Tomorrow states that one should plan ahead by preparing post-surgery meals (maybe by freezing them?), clear your residence of items that may hinder walking (or walking with a walker) to prevent tripping or falling, and look to engage help around the house (cleaning, etc.).  Although if your surgery was unplanned like mine; these are all moot points.

Keeping hydrated is important to any surgery recovery.  However with back surgery, sitting up to drink can be difficult for a period of time.  Therefore, the suggestion to drink from a sports bottle with a squirt top to allow you to drink from a reclined position is very helpful.  I also found that a straw works well.

Physical movement is greatly challenged and patients are taught to “log roll” to get out of bed.  This action requires that you pretend you are a log and roll your whole body to the edge of one side, then push up with your elbow and arms to sit up on the side of mattress before standing.  I still have to do this, even three months after my surgery. 

“Healthier Tomorrow” also addresses shoes and suggests using easy slip on and off footwear (because bending over is not doable after back surgery).  Lifting anything heavy, anything over 10 lbs., was out of the question.  But getting out of bed and trying to walk around is essential to a speedy recovery. Therefore a pair of slip on shoes or slippers is a necessity.  

Ice or heat is recommended to deaden the pain and speed up healing.  To deal with the intense pain from back surgery, doctors prescribe numerous types of painkillers.  For me, pills only work for a short period of time and quit an hour or two before I can take another.  When I am permitted to take another dose it usually takes an additional 30 minutes or so to start working again…. agonizing and debilitating.  An additional and unpleasant side effect of taking pain meds is their tendency to wreak havoc on the digestive system.  I have been weaning off the medication as quickly as possible so that I can gain back my independence to do things like drive my own car again and not rely on being chauffeured around. 

“Engage in some level of rehabilitation in order to help strengthen the muscles, not to mention improve poor circulation and help to release endorphins to counter some of the pain you are feeling…physical therapist can help you create an exercise regimen that gets your blood moving without risking further injury. Physical therapy and rehabilitation are important not only for strengthening your back, but also play a large role in preventing you from injuring yourself again later on.” (healthiertomorrow.com) Although, one needs to watch out not to strain him or herself, as over doing it will only make things worse. I push myself to exercise everyday and take a walk around the parking lot at work, sometimes several times a day.

It is great to be back to work!           

- Cheryl Marceau         


Cheryl Marceau is the President and one of the founding partners of Ridgefield One.




Ridgefield One provides An Extra Sets of Hands on a Temporary Basis - Offering IT and Creative Web Services for companies located in Fairfield, Connecticut and Westchester, New York. Also helping companies with their temporary Office Administrative hiring needs.