30 March 2009

Another Sleepless Night

It's 7am on a Monday and I am bored as hell. By far the most unbearable part of not being able to sleep like normal people is that, at the best of times, I have a couple of hours a night where I am painfully aware of the rest of the world sleeping. My buddy list slowly decays over the course of the evening as my friends across the world go to sleep, and I'm left here wondering what to do.

Let me back up. I haven't slept normally (i.e., in the way I believe other people my age sleep) since I can remember. According to my mom it's been since birth but I don't know if that's true. I know for sure I started having trouble in elementary school and it got significantly worse in middle school and the start of high school. I remember going through many pharmaceutical and homeopathic solutions throughout that time but very few worked. In my early adolescence I had severe insomnia, sometimes lasting for days on end, that seemed to be calmed down by a combination of antidepressant and blood-thinning drugs. Unfortunately, as a side effect, I lived every day in a half-asleep daze and would faint if I stood up too quickly. Fun times. Moving to California for college and escaping the right-wing cesspool of ignorance that is the deep South helped a lot, but I was still up late at night for no reason.

Throughout college I had tons of issues, too. Two classes, at least, I failed because I slept through some lectures and tests. I accepted, at the time, the conventional common-sense wisdom that I was a fuck-up and that my sleep problems were my fault. I'd spent most of my life having grown-ups tell me that, so I believed it. There had to be some personality flaw in me or lack of discipline that I was failing to overcome. It was a hard feeling to shake, and I guess I can't really blame anyone for that, because the truth is just so much weirder than that.

In starting my career here in Chicago, I started with a nine-to-five job at an ad agency. I loved the agency I was working at, loved the people there, liked the work I was doing and took a lot of pride in it, but couldn't for the life of me wake up early enough to get there on time. I don't know to what extent my punctuality was a problem but I'd been spoken to about it a couple of times. The next full-time job after that, I specified later hours and got them, but later on my hours were one of the reasons given for firing me. 

When I had the chance to work mostly from home for several months on end, I noticed that I was sleeping a full eight hours a night, between the hours of 5am and 1pm—whereas beforehand I had become accustomed to less than six hours a night due to my working schedule. After a few months like this, I worked at the same ad agency again for a few weeks (sharp-eyed readers will note my exasperated blog posts about issues I was having with that project). I overslept two days in a row and freaked out. Something was really wrong if, after more than a week on a nine-to-five schedule I couldn't adjust. So, I did what any nice jewish boy would do in circumstances such as these: I called my mom. Much to my surprise and delight, my mom spent half the day researching and came up with a lesser-known sleep disorder, discovered in the 1980s, the symptoms of which matched my own so perfectly I was taken aback to find out it existed. 

Delayed Sleep Phase Disorder is essentially like being permanently jetlagged by a few hours. Brunch time feels like dawn to me, and it doesn't really ever feel like bedtime until the sun's almost ready to rise. Also, occasionally I just don't sleep at all (not sleeping last night is what prompted me to write this entry). Also, apparently, DSPD is the reason why my body temperature and blood pressure are both lower than normal on average (rock steady right around 95°F and typically in the neighbourhood of 100/45, respectively). 

I fear I've been kind of obnoxious and overly expositional about it, but honestly I think if people understood how significant this discovery was for me they'd understand. It was a welcome revelation to find out that not only am I not the only one but there are actually many people with the same disorder—about 3 in every 2,000 people on average. Okay so that's still very rare (about 1/6th of 1%) but it's 3 in 2,000 more than I thought there were. It was a wonderful feeling of weight being lifted from my shoulders, the vague possibility that many of these incidents in my past weren't really my fault. My body chemistry is just fundamentally different from normal.

But there were a couple of more ominous implications to the discovery. Most troubling to me was the thought that, while it was nice to know that it's not my fault I can't sleep normally, there is very little that I can do to fix that. While there are some treatments available they're more like coping procedures than real treatments—just ways for you to kind of hack your sleep mechanisms into working for a little while at a time. For this reason it's a bona fide disability, recognized for the purposes of the Americans with Disabilities Act. Again, that's lovely, because it means if I need to I can always get the right hours at work, but this too is disconcerting as any special or different treatment at work isn't necessarily a good thing. 

Really a huge part of the problem is that I fear a lot of people think it's fake. This is understandable, I guess, since people rarely see me stay up late at night; they only see me wake up super-late and it's easy enough to assume I'm just lazy. I also get "Oh you're just a night person; I'm a night person too" from people who stay up until 1 or 2 in the morning every night, as if that's remotely the same thing. You can totally stay up that late and still hold down a full-time job. It is significantly harder to do that when your body refuses to sleep before 4am. Believe me: I've been trying to work around this since I was 10 years old. In high school my sleep issues and my frustrating inability to overcome them brought me as close as I've ever come to the brink of suicide (which, if anyone's keeping score, wasn't very close but it's as close as I've ever come).

People always have helpful tips for how to sleep, and believe me I love hearing them, but none of them work on me. I know people are only speaking from their own experience so I can't really blame them, but really my experience with sleep is just fundamentally different than theirs. Just so we get this out of the way right here and right now, I have tried all of the following with limited or no results: acupuncture, melatonin supplements, prescription drugs, illegal drugs, over-the-counter drugs, booze, nyquil, changes in exercise, changes in diet, changes in caffeine intake, homeopathy, herbal remedies (including valerian root), and meditation. There's still some treatments specifically for DSPD that I haven't tried (see also: light therapy, freerunning sleep), so I'll be experimenting with those during my time off work. On the whole though it's pretty discouraging, and the wikipedia article on the subject doesn't exactly inspire confidence (best tip from the article: get a job as a cab driver or bartender; thanks, wikipedia!). My goal for this year is to work out a coping strategy that will hold for a couple of months at a time so that I can still do my work. I need a better coping strategy for late-night boredom, too, I think.

Wish me luck, space cadets.

09 March 2009

Not as Many IE Woes?

Mattie had a look at my web app I've been working on in his virtual machine and it ran just fine. Now, on the whole, this is very good news, because it means I don't have to be as concerned about IE6 users. At the same time, though, it also means that I've basically wasted half the time I've spent optimizing and that I've committed a cardinal sin of programming: optimizing prematurely. Even though I believe that it's understandable I didn't run around the office trying it out on everybody's virtual machine, I still feel pretty foolish having not asked a single coworker to have a look when I discovered something anomalous. Live and learn, I guess.

I didn't get content until today anyway so it all works out. I stayed a little late tonight getting the first block of it into the layout, but when I merged my files with another developer's our versions were in conflict. After a cursory attempt to rectify the conflict I decided to go home. I had already attained Last Developer Standing status for the day and I needed Fred around to do the merge anyway. Tomorrow, then. Wish me luck, space cadets.

25 February 2009

Internet Explorer 6: The Cancer of the Internet

For the past few weeks I've been working on a project at my former employers, VSA Partners. I've been working on a pretty complicated web application, a sort of live search for product lines where you can drag sliders to specify the attributes you'd like. Very cool, and it works absolutely beautifully in Firefox 2/3, Safari/WebKit/KHTML 2/3, and Google Chrome, not surprisingly. Its performance is by far and away the best in the nightly build of Webkit and Google Chrome, again not surprisingly because those are essentially the same browser and existing on the bleeding edge of browser technology. So far, so good. Internet Explorer even runs it tolerably well, with a 2.5 second lag when the page is first loaded and a 0.24 second lag between user interface interactions; resetting all the controls to their original state takes 2.3 seconds.

And then there's fucking Internet Explorer 6, rubbing its shittiness in our faces much to our collective shame and chagrin.

For this project, I knew that IE6 would be a major bump, so I did my homework on it. I read all the Microsoft Developer Network articles on the subject (and yes, there are MSDN articles specifically about workarounds to IE's craptacularness), the not-so-swift Javascript execution in Internet Explorer. In particular there is a nice three-part article series on there about some of the specific sore spots in IE6's performance. I read up and then applied what I had learned to my code. The result was slow and steady performance improvement over the course of a few days, but overall an abject failure. But, this failure doesn't belong to me; I'm not going to claim it, as tempting as it is for me to believe this is my fault. This particular failure sits quietly and slovenly on the shoulders of Microsoft. Internet Explorer 6, according to W3schools (source: http://www.w3schools.com/browsers/browsers_stats.asp), is still used by about one in every five internet users. This means that, as a web developer and designer, if I ever create anything that can't run or looks terrible in IE6, I've automatically lost one in every five people, 'cause let's face it, those people aren't upgrading anytime soon. Internet Explorer versions 6 and 7 make up 44.2% of internet users.

A little bit of background for those who aren't technically inclined (and for those who are but love reading about Microsoft's many failures). Internet Explorer 6 is notoriously difficult to develop web sites for because it has poor or nonexistent support for many of the new standards that are supposed to make web development simpler. Internet Explorer's rendering of web sites hearkens back to an earlier, more innocent time, when there were no massive javascript applications, when web sites were simple, god-fearing websites and IE6 was all you needed. Times are very different now. With the rise of web applications moving the heavy lifting of making the web work over to the client side, the fastest browser wins, and accurately rendering XHTML code to web pages is fundamental—obviously—to the viability of a browser as a platform. In short, web browsers are now expected to be platforms similar to an operating system. As it happens those two tasks, rendering code accurately and executing javascript code swiftly, are the two things at which Internet Explorer is the absolute worst.

In the case of IE6 I don't think it's fair to poke fun at its javascript interpreter. As I said above it was a different time, and javascript really hadn't come into its own yet. It was rarely if ever used for anything move involved than overcoming the shortcomings of CSS and XHTML code. But nowadays we write whole applications in Javascript and skin them with XHTML/CSS, so IE6's relevance to our present-day world is waning fast. Its javascript interpreter may be apples to today's browsers' oranges, but that still doesn't make reliance on it a forgivable offense. Even since I've been writing them web applications have exploded in popularity and scope. As I've positioned myself to specialize in their design and development, I feel pretty good about this. But there's just one problem... IE6.

In a modern web browser I have access to all the new innovations in browser technology over the past decade, but in IE6 I am stuck in the last century. Yes, that's right, Internet Explorer was released in 2001 and, but for security and aesthetic changes, hasn't changed much. Internet Explorer 6 is still the sorrow of the internet, and something tells me those 18% aren't going to upgrade soon. So... I have an idea.

Fuck 'em. That's right. Fuck 'em. They're using a browser that came out before the dot-com crash; they shouldn't be expecting the internet to behave the same for them. At this point I think it's okay to say, Yes I will look at it in IE6 and if there's a quick fix I can apply I'll do it but I will not burn hours and hours tweaking it. Overall this will mean less money in the short term but it will mean better productivity, more websites launching on time, and the betterment of the internet in general.

Once we stop caring about IE6, it's no big deal to write javascript that futzes with the layout of the page (IE6 is notoriously terrible at manipulating DOM objects), or to write elegantly simple CSS layouts, or to write heavyweight application suites. It'll be a better world and when the IE6 users are finally forced inevitably to upgrade, the rest of the world's web will be ready for them. They'll arrive with fanfare to a beautiful and useful web populated by tools that are as easy to use as they are powerful. I'll be here at the bleeding edge... waiting. Come join me, space cadets.