Archive
Dvorak!
I’m just a glutton for punishment.
I decided this evening to undertake the vaguely daunting task of learning the Dvorak Simplified Keyboard layout. It’s already been a trip and a half, let me tell you.
After researching the topic (I’ll admit predominantly on StackOverflow) after a conversation with a friend (a DVORAK user himself), I’m hoping to be at least quasi-proficient by the end of next week… or at least enough so that it doesn’t take a year and half to write a follow up message!
iFail: Smart Playlists Aren’t Anymore
Evidently, Apple needs to re-evaluate their regression testing strategies.
The other day, Apple pushed software updates for iTunes (9.0.3.15) and iPhone OS (3.1.3). The iPhone OS updates broke a small subset of features related to smart playlists.
I’ve always been a major fan of iTunes since the introduction of smart playlists. As enthralled as I was to being using them though, I was almost as starkly let down when the developer in me was unable to specify arbitrarily nested conditions, such as
rating is 5 and artist is Hans Zimmer and album is either The Rock or King Arthur
which can be translated into a pseudocode-esque form as
rating == 5 AND artist == “Hans Zimmer” AND ( album == “The Rock” OR album == “King Arthur” )
It was a real letdown. At any rate, with iTunes 8, Apple unveiled the ability to create complex conditions for smart playlists, and it was wonderful. When I purchased my iPhone (3GS) last summer, there were a few quirks, of course, but nothing major.
However, with the iPhone OS 3.1.3 update, a few of my playlists were appearing empty on my iPhone. Puzzled, I began looking for common patterns. I noticed two similarities. First I noticed that all of the affected playlists were smart playlists, and then I narrowed it down to playlists having complex conditions involving the “genre” field
At this point, I hopped on over to the Apple forums. Low and behold, I’m not alone. There are, at this time, three fixes available of which I’m aware:
- Create a “dumb” playlist, and add to it all songs from the problematic smart playlist
- Create an auxiliary smart playlist, with one rule: “playlist is <name of other list>”
- Disable the “live update” feature for the troublesome playlists, sync, and then reactivate it.
Update: I’ve confirmed yet another workaround thanks to Chris Koerner. In the afflicted smart playlist(s), add a new rule: “Playlist is Music.” This workaround seems like the best yet; it doesn’t add playlist clutter and allows you to keep Live Updating enabled.
At any rate, I’m just happy that there are temporary fixes for this (however ungraceful they may be). Hopefully this gets you by. If you have a second, head on over to the appropriate Apple forums threads (here and here) and post. It can’t hurt the chances of a faster patch if more people pipe up.
More Outlook Web Access Shenanigans
A while back I explained how to configure an Outlook Web Access (OWA) account for sending and receiving via Gmail’s web client. It seems as if the instructions provided – while correct – are not permanent. At least in my case, I’ve noticed the past few days that every time I attempted to send an email from my OWA account via Gmail, Gmail’s servers kept rejecting the message. After some fiddling around, I referred to my previous instructions on locating the proper OWA SMTP host and realized that Outlook has in fact recently changed the information.
At least for me. If you’ve been affected, simply repeat the ridiculous “host discovery” process delineated in the other post and everything goes back to kosher.
Hands Down, Best VPS Hosting at Slicehost
If you are, or soon will be, in the market for a good hosting company – my highest recommendations go to Slicehost, a Saint Louis, MO based hosting company that blows all competition out of the water. For about six months now, I’ve held a basic-level “slice” (their term for a single VPS) for $20 per month, and I could not be happier with both the services rendered, and the support offered by the Slicehost staff.
Last week, one of the HDDs on my physical host failed. Every slice is hosted on RAID 10, so I didn’t lose any data. I received an email when the team noticed my slice was performing oddly, another to alert me that they’d diagnosed the problem and to me know that they’d be freezing the VPS image and migrating me to another physical host. About a half an hour later, a third email arrived saying the migration was successful and that I should check my server to make sure everything had been restored properly.
Well, everything went fine, except I’ve noticed since then my slice was performing rather poorly. After checking around, I was convinced that the sluggishness wasn’t caused by anything on my end, so I contacted the Slicehost staff via their web chatroom. Within five minutes, the team member I was speaking with had diagnosed the issue (one of the other slices on my host was trashing badly) and kicked the slice (the account was inactive anyway).
With “corporate” hosting companies, the support chain begins with a web form request for email support and usually ends with a taste of mild dissatisfaction and wasted time. With smaller hosting companies, you find personalized support, but the web-based management tools, supported systems, infrastructure, and sense of cohesiveness (at both the business level and the technical level) typically lack. Slicehost is the perfect mix.
Competitive prices, a fantastic web management interface, reliably fat tubes (I usually see about 3-6 MB/s), and unparalleled personalized support from staff who are always cordial, knowledgeable, and willing to help with any issue. Two thumbs way up for the folks over at Slicehost. Even if you’re “happy” with your current hosting provider, check them out. You won’t be disappointed.
Note: I linked to their site a million times for a reason. Check them out!
Hand Coding
Found this via Slashdot - I think it’s good food for thought.
George Bernard Shaw said: “Build a system that even a fool can use, and only a fool will want to use it.” I tend to think that Jeffrey Snover agrees, per his comments in the article.
Review of Windows 7
Let me “pull a Tarentino” on this post.
Conclusion: While just as imperfect as any other modern Operating System, Windows 7 (more accurately Windows NT 6.1, but effectively Windows Vista SP3) is smooth, surprisingly efficient, and overall provides a solid and well-engineered user experience, in my humble opinion.
The Good: Microsoft opted to re-use the Aero theme in Windows 7, but not before a thorough debugging. Features like the 3-D flip,

3D Flip
live taskbar thumbnails,
Live Taskbar Thumbnail
and glassy window borders

Glassy Borders
were all wonderful concepts in Vista. Now, they’re actually wonderful (read: well-oiled) features. In addition to the live taskbar thumbnails, however, Windows 7 takes it up a notch. Now, when you have multiple windows open from the same application, you not only see live thumbnails of each window, but hovering over a given thumbnail will cause all other visible windows to become entirely transparent, allowing you to quickly check the state of an application in the background without actually switching to it.
Also admirable is the new Task Manager… rather, an extension of the traditional Task Manager you’re used to. A new button appears labeled “Resource Monitor” (center bottom)

Task Manager
which leads to this fairly glorious little widget

Resource Monitor
Very cool. The Gnome project has sported one of these for some time now, but it seems like Windows is finally appealing to power users who want the real low-down on system resource usage, per process, by the second.
On the note of system resource usage, Windows 7 shows a vast improvement in resource utilization over previous incarnations. I’ve left the machine on for days on end, with no noticeable negative performance impact. The system refused to slow down as I opened all of: Microsoft {Internet Explorer,Word,Excel,Powerpoint,Access,Visual Studio 2008,MSDN Library}, Adobe {Acrobat,Bridge,Photoshop,Illustrator,Soundbooth}, Google Chrome (with Gmail, Google Wave, and Facebook – three of the heaviest sites I could think of at the time), Firefox, iTunes, Notepad++, WinSCP, mintty, PuTTY, KeePass. While running a full AVG system scan on full speed. The system used just a hair over 2GB of RAM, and every app ran just as smoothly as if it were all alone on the process list.
Another bonus point goes to Windows 7 for not forcing me to reboot after every software update. In fact, in the flurry of [8+] rounds of updates I applied just after the fresh install, only 2 required a reboot.
The Bad: I’m a command line junkie, and the windows command line just can’t hold a candle to bash. And it probably never will, which is a pity… but at least there are products like Cygwin and MinGW. This incarnation is also not as reverse-compatible as Microsoft will have you believe. Several applications I’ve attempted to use installed just fine (or so I thought) but were useless, if they executed at all (such as Cisco NAC, Neverwinter Nights, and EasyCleaner, for instance, which all worked wonderfully under XP). A buddy of mine also had some issues installing drivers for a USB Ethernet adapter.
The Ugly: Anyone who used Vista had to have seen this one coming: UAC. While a fantastic concept, it’s still the major Vista-esque component of Windows 7 that hasn’t yet been sufficiently reengineered. My main issue is that you have no [native] means to create a whitelist of applications that you want to run elevated (that’s Vista-speak for “run with admin privileges”). So, every time you boot the application in question, you have to go through the extra mouse click. Prime example for a web developer: Notepad++. Without elevation, Notepad++ will give you problems saving some kinds of files; also, the FTP_synchronize plugin is useless.

UAC prompt
Premise: Before switching to Windows 7, I used Fedora as my primary operating system for about 4 years (following nearly every major release from 5 through 11) while keeping Windows XP on a minimal partition just for iTunes.
Architecture Astronauts (Again)
Joel Spolsky’s classic article, because I think we could all use the reminder sometimes.
Challenge: See how many architectures, products, services, and protocols from the (2001) article that you can swap out for their most recent (2009) replacements.
That Thing: Function Pointers
I’m going to start a semi-repeating series on “those things.” You know how at every job, there’s always “that guy?” Or if you’re a student and your schedule is different every day, there always seems to be “that day” of the week that sucks above all others? That’s the spirit of my “that thing” rants. Today’s flavor is about pointer syntax in C++.
If you use any language long enough, you’ll learn to love it. You’ll love this core language feature, and that standard library. You’ll become accustomed to it’s minor inconveniences, and if you do it long enough, you’ll find ways to circumvent them (or at least save yourself the typing). You’ll eventually get to the point where you feel more fluent in the language than with English… or is that just me?
I digress. Anyway, if you use that language even longer, you’ll learn to hate it as well. To dread “those” moments – few and far between as they may be – when you have to perform that one annoying task that your language specification, compiler, or platform makes a chore and a half.
With C++, “that thing” (or at least one of them) is undoubtedly, above all else, the pointer. And no, I’m not talking about an unsigned*, or a bool*, or even a char* (for those who know about character arrays; real men don’t use streams). I’m not talking about any complex nested data structures with addresses scattered willy nilly all about the place.
No… what I’m talking about are function pointers. Now don’t get me wrong – function pointers, in theory, are wonderful. They prove a tremendously powerful ally on the team of anyone brave enough to employ them. And many languages pull this off without a hitch. Python makes it a breeze. It’s none too difficult in PHP, either. However, sadly enough, C++ isn’t in the cool crowd. It’s a compiled language. It needs to know what you’re doing before you do it, and it needs to know it explicitly and unambiguously. So when it comes to function pointers – especially given that they’re a higher level concept – it’s no surprise that the syntax is a bit wonky. But honestly… what is this?
class A { private: std::string (B::*_name)( void ); public: std::string (B::*getName(void))(void) { return _name; } };
Okay, declaring A::_name is a bit annoying because the compiler needs to know beyond a shadow of a doubt what the precise signature of the phantom function is. This complexity is compounded by the fact that it’s not just some regular old function, but actually a nonstatic method of class B, which takes no arguments and returns a std::string. You know what, I can dig that. I see the elegance there.
But what in the name of all that’s good and holy is going on in line 5?!?! I’m declaring a member method in A called getName, which takes no parameters, and returns the function pointer _name. Not that big of a deal. But why the convoluted syntax here? You declare any normal member method with the pattern return_type name( parameter, list ). Oh, and on line 5 there at the end, with the (void))(void)? The first void is the parameter list for A::getName and the second is the parameter list for the pointed-to member. Yeah.
I understand that function pointers require a fair bit of complexity to pull off. I also understand that what I’m doing here (returning a pointer to a nonstatic method of class B inside from a nonstatic method in class A) is fairly esoteric, however I’m flabbergasted that the syntax is so inane that I had to corroborate several Google searches to piece together the correct syntax for this. Note, in this article, I don’t even begin to consider const-ness with these puppies – yeah; that gets ugly too.
Way to be that guy, Bjarne.
Exception sleuthing with GDB
In a current project of mine, I kept seeing random unhandled exceptions float up to the top of my application. In cases where I suspect exceptions might be thrown, the code is smathered with some try/catch logic, per standard practice. I also have a healthy stack of catch blocks wrapping the contents of main(). Theoretically, that shouldn’t ever get executed.
Theoretically.
Which means, it was a good thing it was there.
Without waxing the specifics of the problem, I was generally unable to trace the source of a particularly difficult to reproduce std::exception that kept bringing the application down. Backed into a corner, I used the fail safe debugging method of the ages. I cast a very wide try/catch net, and then slowly tightened it down the call stack of my 70-some file large C++ project. Once I had pinned a sufficiently manageable block of code as the culprit, I had a brainwave.
I use GDB religiously (via Emacs) whenever I encounter any segmentation faults. What used to take 15 minutes or more to track, now takes a whopping 30 seconds a worst. One thing I’ve never done before, though, was to track exception logic with GDB. Finding the information was trying, but eventually, some Googling led me to an Apple mailing list entry with the name of a very low level exception mechanism, called __cxa_throw().
Using GDB to sleuth the origin of any exception is easy with that function name. Before you dive in, simply set a breakpoint for __cxa_throw. GDB will halt and take you right to the source of any exception as soon as one is thrown. Viola! Now, tracking the source of any mysterious exception is as easy as locating seg faults.

