At the end of a trip to India in Nov-Dec 2014 I decided to give myself a little luxury with a night in the Taj Palace in Mumbai. The view from my hotel window was perfect for Hyperlapse.
- MacBook 13″ Laptop connected to an external display, external keyboard, USB headset, USB backup drive, wireless network, wired network and a bluetooth mouse
- My home office
Daytime Population: 1 me, 1 cavoodle, 1 cat
Events leading up to problem:
- No configuration changes or software updates for over a week
- Everything working fine when I left my computer to make a cup of tea for 5-10 minutes and returned to find the symptoms below
- I can’t left click on anything. Not with the trackpad, not with the mouse
- This is very frustrating. You can’t easily launch, close or do much that is useful – even to diagnose problems
- The keyboard still works, so I can type things and use keyboard shortcuts
- I started to Google Mac Accessibility options so I could accessibility my way around diagnosing this problem
- I can right-click things
I began the problem isolation process, poking around, turning things on and off… trying to get to the minimum configuration that showed the symptom.
Until I noticed I had two bluetooth mice.
Crazy! I thought. This Mac has gone insane. I rebooted it and reset the NVRAM and it came back up with two bluetooth mice.
Now, like Agatha Christie, I will reveal to you that one clue that might have made it obvious to you from the beginning.
Cleaners worked on my home office yesterday. They moved my laptop bag so that it was balancing on another bag. I had repositioned it in a safe location when I went to get tea.
Hey, didn’t I put my old bluetooth mouse in my laptop bag?
I hunted around in the bag and sure enough my old backup bluetooth mouse had switched on when I moved the bag. It had been squished so the mouse button was held down.
This is probably something experienced all the time by road warriors with a wireless mouse, but I needed to write it down for google-fu and my future self.
This post is reinforcement of a programming trap I should avoid in future, and punishment for selecting poor test cases. It’s not a bug of epic proportions, so move along if you have better things to laugh at than a bug in my Daily WTF-candidate code.
It operated for a few months with no complaint. Then there were several reports in one week that the code wasn’t generating the correct weekday.
“Inconceivable!” I thought.
I tried it myself with the dates users complained about and found it was generating crazy weekdays. I checked, and my regression tests were passing just fine. I then plugged the reported problem dates into my test suite. My old test cases succeeded and the new ones failed.
So, down to diagnosis.
The “bulk” of the code is pulling the date string apart so I can use date-related utility functions. The problem was my use of parseInt().
parseInt() parses a string and returns an integer. I discovered that it works fine for some months (01, 02, 03, 04, 05, 06, 07, 10, 11, & 12) and not for 08 and 09. This is because parseInt() assumes that if the string it is parsing begins with a 0, then it’s an octal number. That works for 01-07 because they generate the same number whether you parse them as octal or not. 11 and 12 work because parseInt() correctly guesses that they are base 10. 08 and 09 are automatically detected as octal, but they fail to parse as octal numbers. I used the error return value to populate the month in a Date object which dutifully interpreted the value as December. The weekdays were right… for December.
Sure enough, none of my test data contained a date in August or September.
The main fix is that the parseInt() function takes a second optional argument that sets the radix to use and stops it from guessing.
I’m still trying to think of a situation when you might want parseInt() to guess the radix for you.
What use is my dormant blog if not for blegging?
My friend Andreea Kindryd started doing stand-up comedy at age 68 and has recently started performing an amazing autobiographical show. After great reviews at the Adelaide Festival she has the chance to perform “Slavery to Star Trek” at the Edinburgh Festival this year, but she needs some help to get there (and back).
I have mentioned before that my Vista-running X61 tablet takes a while to boot. Soluto measured boot time at just over 10 minutes. I followed its advice, and through delaying and removing various crapware and legitimate startup programs I got boot time down to 5 minutes and 10 seconds.
Emboldened, this weekend I took some advice from Ian’s comments on my last post and shelled out AU$300 for a copy of Windows 7 Professional (upgrade).
Now, with a few tweaks recommended by Soluto I’m recording a consistent boot time of 1 minute 35 seconds.
My aging tablet feels like new again (during boot).
Update: Actually, it feels pretty snappy since the Windows 7 makeover and some hybrid SSD drive loving. Boot time is now a shade under a minute and application launches are snappier than they’ve ever been.
In a previous post I had talked about the rate of decay and the usefulness of a fairly shiny new X61 tablet. Now three years later it’s time for a quick update on how it’s travelling.
As you can see, the tablet is pretty much the same as it was at 3 months old. There are legends about how hard-wearing ThinkPads are. After lugging it back and forth from work, and on vacations, for three years it’s looking like a role model for laptop longevity.
The screen is a bit blotchy with grease now, I haven’t found a good cleaner that I trust to not melt or damage the surface, so I put up with a dirty screen. The screen is also pulled away at the bottom exposing some glue that picks up dust and won’t let it go, but the problem is just aesthetic.
The pen is still held together by sticky tape.
The hard disk is now a 500GB Seagate 7200rpm drive, and I have added 4GB of RAM. The battery is now a non-Lenovo battery that works fine except that the Lenovo power management software courteously questions my commitment to safety and morality every time I log in. The original battery went stone cold dead with error messages from the power management system along the lines of “Get this battery thing outta me NOW! Stat!” when it was just over 2 years old.
None of the keys have come off the keyboard. The marvellous screen-rotating and reversing hinge feels as firm as the day it came out of the box.
The biggest problem is still Vista and the load of Lenovo crapware required to keep it alive. It has always taken a long while to boot and get settled (5-10 minutes), so I’m tempted to start from scratch with Windows 7, but haven’t made the investment in time yet.
After checking the PHP options and benchmarking hosting & database speeds at spry.com’s dirt cheap hosting against options at the dirt cheap hosting I have at GoDaddy.com I decided to move Brainsnorkel to the garish world of GoDaddy.
While moving I found a couple of things of interest.
- That the Freshy2 theme I use has been bequeathed to the open source community by its creator, so I will move to a newer theme when I find one and modify it to taste. (Ignore the WordPress 2.9 incompatibilities for now, ok?)
- That exporting MySQL defaults to latin character encoding, and phpMyAdmin defaults to utf8 for import.
- That TPG has one of the slowest to update DNS servers in the world:
sh-3.2$ nslookup brainsnorkel.com 22.214.171.124
sh-3.2$ nslookup brainsnorkel.com 126.96.36.199
Oh strange new Internet that has such people in’t.
The few very hasty blog posts in the last year is a clear indication to y’all that Brainsnorkel is barely registering in my consciousness. I don’t blog about work, and work is hard at the moment.
Actually, home is hard too. To make our house bigger, we have to squeeze into one end of it for a while. Hopefully all of this squeezing will be a thing of the past soon. We’ll move back into our proper places and the sardines can move back in to where we’re living.
Enough excuses! Brainsnorkel doesn’t need excuses.
Brainsnorkel needs the dust blown off it.
There is so much to love about this music video.
I can’t review my new iPhone 3GS. Frankly, I haven’t used it enough. I’m still waiting for my old carrier to port my number so I can use it as something more than a very expensive iPod Touch.
One of the first things I did after getting it was to sit down with a couple of our kids and show them the maps, video camera, photos, some Wall-E, Phineas and Ferb and then an iPhone version of Peggle which they had played on PC extensively.
When I had decided that demo time was over my 3 year old daughter insisted that the iPhone was hers. To encourage me to hand it over she started ripping up and throwing things around the house with some impressive, wanton, and very primal, rage.
This experience has brought me to the realisation that slavish iPhone desire is nature, not nurture.
I’m seriously considering buying a decoy.
When I recall very good TV series like Six Feet Under and The Wire I feel could go back and watch the final episode any time for a reminder of the quality of the series and the characters in it. Battlestar Galactica is an excellent TV series, but I think I’ll be watching the pilot episodes, season 1, and not the finale.
Tonio sums up all that was good and bad about the series finale (beware, here be spoilers):
Battlestar Galactica Ends
Here’s my take on the end of the best Science Fiction TV series in history: it hit the right emotional notes, and it was reasonably satisfying, but it was not a worthy ending to the series, and I suspect that as we all go back and watch the whole thing through we’ll find a lot of threads left dangling or essentially forgotten by the writers.