-
Did you spill some perfume?
Lately I've noticed that when there are lots of treadmills open at the gym, someone is bound to get on the one next to me. Normally this isn't a huge issue, but the last few times I've been at the gym, women who dipped themselves in perfume have decided to stand next to me. It could be my stunning good looks that made them stand next to me, but I doubt it. So, today after about 10 minutes of having to inhale perfume, I stopped the treadmill, made a mental note of my progress, got off, and moved down about 6 treadmills (only 4 of about 12 treadmills were in use). The old lady wearing the perfume kept looking at me funny kind of questioning why I moved. Uggh; at the last gym I went to, there were signs up telling people not to wear perfume or cologne as a courtesy to other users. I guess people just aren't courteous.
-
Sample code is great (when it works)
I think that it's great that companies like Apple put out sample code to help developers write code without having to resort to figuring it out themselves or doing something in a way that will break. Several years ago I wanted to add my application (NotifyMail) to the login items/startup items for a user under OS X when OS X was new. There was no documented way to do this, but a DTS engineer at Apple posted on a mailing list that if people wanted code, to send him email. So I sent him email and have been using the code ever since in a bunch of projects. It had a major limitation in that if System Preferences was open and you used the code to modify login items, the user wouldn't see the change which could be confusing. I had added an awkwardly worded alert indicating this and no one complained.
As I was changing some setup stuff on one of my machines, I added an item to the login items by using the contextual menu item in the dock. I then opened up system preferences and began adding and removing it via the menu again. To my surprise (and delight) system preferences immediately indicated the change. After a bit of searching, I found some sample code called LoginItemsAE which was first created last October. I download the code, added it to my project and attempted to compile. Hmmm...it relied on stuff in Mac OS X 10.4, but I was targeting 10.3 (and 10.4.), so it didn't compile. I double checked the sample code and it says it goes back to 10.2. After a lot of research, it turns out that in order to get the code to compile, even if targeting 10.3, I had to set the SDK to the 10.4 SDK. I didn't want to do this as I have 50+ targets in one project that all use one configuration file that sets the SDK to 10.3.9; this kind of change could be bad as it would allow me to use functions only found in newer OS versions and then crash on older systems. So if I'm not careful, I'll get a crash. By setting the SDK, if it doesn't compile, it won't run on the older OS version which makes life easier. It would be nice if there was a way to warn you about which functions aren't available on newer OS versions.
To make a long story a little shorter, I had to whip up some stub code to get it to compile which was a whole lot more work than I had expected.
-
Tracking down bugs
One of the hardest aspects of writing code is debugging it when it doesn't want what you expect. In one of my past jobs, I was given the task of making a server stable which meant finding a bug buried in thousands of lines of code that I really didn't understand. No one gave me a timetable on doing this, so I worked at it for over 4 months if I recall correctly. Turns out the problem was a bug in a driver that we didn't even control; I put in a workaround and moved on.
Today I spent over 4 hours working with an excellent QA engineer to track down a bug; he did everything I asked him to do, sent me logs, reinstalled software, tried on a second machine, etc. Turns out that if I had read the log a little closer, I would have been able to fix the bug in minutes instead of hours. Having a QA resource like this makes it so much easier to find stupid bugs.
-
Are expiration dates real?
Just about every consumable product we buy has an expiration date. from the obvious ones like milk, eggs, and cheese, to the less obvious, but increasingly common ones such as batteries and beer. Yesterday while I was going through my first aid kit to replenish the supplies, I found some hand warmers that expired in 2001. Could these really expire? They have some iron and some other stuff in them when exposed to air heat up to about 100 degrees Fahrenheit for about 6 hours. These weren't exposed to air and were still completely sealed. I decided to test one, opened it up and in about 20 minutes, the hand warmer was cold. So I guess the expiration date on this particular product actually meant something (maybe it would have lasted another 2 years, but I'm still a few years out).