Posted on May 3, 2009

Once again, Microsoft idiocy costs me my time

It’s rare I deal with any kind of MS product. On occaision, when I develop a UI one of the last steps I take is to “debug” it in IE, or work around the general IE idiocy issues. That’s about it. My Xbox 360 has worked well for the last several years but I don’t really do anything to exciting with it. I know the folks over at MS aren’t too sharp in the software design area, but they still never cease to astound me.

Today I signed up for Netflix again after a long hiatus. One of the things I was looking forward to was live streaming. I figured I’d just use my 360 to stream. So here’s how the process went:

  1. Start my Xbox, which auto-signs me into my current Silver membership
  2. Navigate to the netflix icon, which prompts me to download the netflix streaming app
  3. Download the netflix streaming app and start it
  4. I’m informed that I need to upgrade to a gold membership to stream netflix
  5. I try to upgrade my account from the xbox and I get a “8015d080″ error, which leads me here. Turns out the Windows Live ID’s expire after a period of inactivity. Evidently, logging into your xbox live account does not count as “activity.”
  6. I find out that you can sign up for a new Windows Live account, then transfer your gamertag to the new account via the Xbox Live dashboard. Great!
  7. Sign up for the new Windows Live account, navigate to the “Change my Windows Live ID” option and I’m greeted with “Can’t connect to Xbox Live. Please retry later.” I’m already signed in mind you.
  8. Google a bit to find out others have this problem and they had to go through MS Support to resolve it.
  9. Send an email to support (the form on the xbox support page doesn’t work correctly either – maybe just in firefox, or firefox on Linux – the dropdowns don’t update when you change topics from “hardware issue” to “Xbox Live issue”. I’d guess the chances of my email getting to the proper support place are roughly 1/1,364).

If I had the choice of taking a job programming in .NET, Silverlight, etc or eating out of the garbage, I’d be dumpster diving in no time.

Update: Spoke with MS support over the weekend and as I suspected I had to create a new gamertag with my new Live account in order to upgrade to the Gold membership.

Posted on Apr 12, 2009

A year with Java

Last year at this time I took a Java programming class as a refresher as I hadn’t done much with Java since my days as an undergrad (and a few short programs in grad school). After primarily using Perl for the last 7 years, this was a big switch. The difficulty with Perl is that it’s a programming language for concenting adults. You can do almost anything any number of ways. The amount of time it takes to understand a block of Perl code is far greater than that of a block of a statically typed language like Java. This had been a huge issue for our company as we had tons of legacy code that followed no standard.

It is my firm belief that if you are going to develop a large codebase in Perl, you MUST use a fairly stringent coding standard. In my first week in my current role, I came across three separate “subroutines” that were over 2500 SLOC. One of the shorter subroutines had 200 SLOC and 32 regular expressions. 4 of these regular expressions were over 80 characters long. Dynamic subroutines are often used. Map statements that turn arrays into hashes are the norm. One library that I maintain is > 10000 SLOC and contains 7 comments. It has been my personal nightmare for more than a year and a half now.

Some of this has to do with simply not understanding best development practices regardless of language, other things (like not adding a comment for a 120 character regular expression) could have been avoided by the use of a coding standard. 80% of software development is maintenance, plan accordingly. One way to force yourself to do the right thing when writing code is to pretend the guy who is going to be asked to maintain it is completely psychotic and knows where you live.

In any event, I have found that using a stringent coding standard is far less important when using Java because:

  • it’s statically typed – I know what I’m going get back from any subroutine. I don’t have to worry about using Data::Dumper with die statements to figure out what complicated object I’m dealing with.
  • you can use a debugger – no more running the entire program and relying on print statements to figure out what’s going on. I can see the value of each variable and I can make changes on the fly and see the results. This is a huge timesaver.
  • frameworks – although there are a few frameworks for various paradymes in Perl, Java takes the cake here. It cuts down on development time by allowing developers to concentrate on the functionality of their application instead of the middleware that must accompany it. Using a framework (struts, spring, hibernate, etc) also makes it trivial for all developers to understand how a module works.

I can’t understate the huge amount of time our company has saved since switching to Java. “Estimated Time to Fix” is greatly reduced and more work is accomplished.

Posted on Mar 11, 2009

Murphy’s Law and the timing bug

I spent roughly 6 hours Sunday trying to fix the wrong bug. Long story long:

Due to a problem with the timezone on one of our database servers, the last two time changes caused several issues. Among them, a message from our mail software claiming we were trying to schedule a mailing for a time in the past. Even though once a mail is scheduled, the mail system simply queries the database and sends all mailings that have a scheduled time in the past. Evidently the initial creator of our mail system wrote this check into the scheduler to ensure he wouldn’t encounter any issues if he ever got around to inventing a time machine. On Sunday, the day we set our clocks ahead, when the error popped up again, it was obvious that the fix we made 6 months ago didn’t work.

5:30 – phone call from C trying to send a mailing reporting the error

5:30-6:00 – spent time verifying that every single machine I could think of that possible touched this process had the proper time set (they did)

6:00-6:30 – pulled in a systems engineer to verify the same thing I just did (and he did)

6:30 – process restarted since all the times had been verified with the ‘notify_delay’ time set to 61 minutes to account for the hour difference

6:32 – C notices there is a configuration variable (mail_on_reprocess) that must be set to allow a re-processing to send out the mailing. We decide to wait for the current process to finish, then rerun with the proper configuration.

7:15 – re-processing finishes, C notices there is a mailing scheduled despite the bad config – oh well, we’ll take it. C resets the configuration to defaults to avoid future problems.

7:35 – mailing completes, C notices the mail has sent to 0 recipients instead of the 4200 it should have

8:15 – after scanning the code, I notice that a mailing is created even in the event the mail_on_reprocess variable isn’t true, it just sends it to 0 recipients. Fuck.

8:30 – C sets the re-processing variable and re-runs

9:15 – re-run complete, we see the timing error again. WTF?

9:15-9:45 – Rethink my strategy, find that the code generating the schedule date gets the time from the database server, not the local machine unlike our other mailing code that was working fine all day. Obviously, I was right in assuming the database was off even though it reports back ok. Must be a timezone translation thing that happens in the Perl DBI module.

9:45 – re-run, set notify_delay to 61 minutes, mail_on_reprocess to true

9:45 – 10:30 – drink, shower

10:30 – failure again, bad config, unrelated issue

10:30 – 11:57 – re-run twice more. C has been awake for 21 straight hours at this point.

11:57 – 11:59 – check mailing is scheduled and sent to proper number of recipients

Turns out the timing problem had nothing to do with the time change, and the fact that it generates the same error we see whenever the clocks change is a mere coincidence. It had to do with the fact the schedule date is calculated BEFORE the list of recipients is generated, which took 40 minutes. With the delay set to 30 minutes, we’ve moved past the schedule date and only Doc Brown can get us back.

Coincidences:

  • this process results in the same error we see whenever the clocks change
  • the clocks changed that day
  • unlike all of the other code that sends mail, which was working, this method got the time from the database server and NOT the machine’s local time, fueling the idea that the database server’s time was the culprit
  • this was the first time since the code’s release 6 months ago that the recipient creation time ever took longer than the notify delay

Posted on Feb 11, 2009

Adventures with the Apple Air Port

My network has been flaky lately for no apparent reason. To test that it is indeed my AirPort Express, a coworker let me borrow an old-school Graphite Air Port. I found directions to set it up here. Seems easy enough except that my wife’s mac wouldn’t recognize the new Air Port in the Air Port Admin Utility. Weird. 20 minutes or so of googling and I realized that there were different Air Port Admin Utilities for earlier Base Station models (graphite). Great, I download the app and it immediately detected my base station. I attempted to update the Base Station and I get an error message saying “An error occurred while updating the configuration”. Outstanding. I ended up finding this discussion which has a solution I would have never, ever tried:

AirPort Admin Utility, version 4.2, which works with Graphite and Snow base stations, can be found within the download of AirPort 4.2 (http://www.apple.com/support/downloads/airport42formacosx1033.html).

I tried it on my MacBook running Mac OS X 10.4.10, with a Graphite base station, and it works fine, so far as I can tell.

I did not actually try to install AirPort 4.2 using the installer, because I was afraid of messing with my system when all I wanted was the utility. Here is how to get it:

  • Download the disk image AirPortSW42.dmg from the Web page mentioned above. If the installer launches, quit the installer.
  • Double-click the disk image to mount a volume named “AirPort 4.2 Update.”
  • Within the AirPort 4.2 Update window, ctrl-click on “AirPortSW.pkg.”
  • Select “Show Package Contents.”
  • Open the “Contents” folder.
  • Double-click the “Archive.pax.gz” file, which causes an “Archive.pax” file and an “Archive” folder to be extracted to the desktop.
  • Open the “Archive” folder, the “Applications” folder within it, and the “Utilities” folder within that.
  • The AirPort Admin Utility is there. You can move it to Applications/Utilities and discard everything else that was downloaded.

Thanks to Tesserax (http://discussions.apple.com/thread.jspa?messageID=5136389&#5136389) for recently explaining how to extract an AirPort utility from a download package.

Although I have never seen “AirPort Admin Utility for Graphite and Snow,” it probably was the same thing as AirPort Admin Utility, just renamed.