…that the monitors at the Chicago O’Hare airport are running Adobe Flash! 🙂
During the course of the day I encounter lots of challenges, some of which take minutes to solve and others that take much longer. My goal for this section is to keep track of these challenges and their solutions. I will turn the longer ones into articles, while the shorter ones will stay as blog entries. You can expect topics to range from very specific programming challenges to broader topics like life.
Below is a list of the recent blog entries. You can also browse the blog by using the tags on the right side, or if you know what you are looking for then you can use the search box at the top right.
MediaMonkey (MM) is my music player of choice on Windows. I have a few global hotkeys setup (for instance WIN+ALT+B for next track), but after an upgrade a few months ago (probably starting with 3.0) I noticed that my shortcuts started sending the shortcut keys to the active applications. So, for instance, while in Outlook if I press WIN+ALT+B, MM will go to the next track, but in addition Outlook will switch views because ALT+B is a shortcut in Outlook.
After a quick post online I found the solution that I was looking for. Basically, I had to edit the MediaMonkey.ini and add “PreferLLKeysHook=1” to the “[options]” section. MediaMonkey.ini will be located in different places based on the operating system, you can find the details in this knowledge base article. Add “PreferLLKeysHook=1” to the “[options]” section in there and restart MM. From there on the shortcut keys will only be interpreted by MM and will not be forwarded to the active application.
Lately I have been playing around with Objective-C development on mac. As I was working through a tutorial I kept getting the following error for a calculated read-only property.
[<NSManagedObject 0x2000c3c20> valueForUndefinedKey:]: the entity Expense is not key value coding-compliant for the key "filename".
Below is the definition of the class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Expense.h #import <Cocoa/Cocoa.h> @interface Expense : NSManagedObject {} @property (readonly) NSString* filename; @end // Expense.m #import "Expense.h" @implementation Expense - (NSString *) filename { return @"TestingPath"; } @end |
The class definition is OK so the error didn’t make sense. After some troubleshooting I found out what was causing this. Since this was my first application I didn’t know that I had to tell the model what class it should be using, and, unfortunately, the book that I was using didn’t mention it either (or maybe I missed it).
Anyways, if you get this error then make sure that you have associated the class with the model. To do this you have to specify the class name under “Class” in the model definition (see screenshot below).

I am very picky about my development environment and I need it to be just right, otherwise the fun part of programming disappears. I have a dedicated Linux server in my office that is sharing and serving the development files. This is a solid server, fast enough that django’s development server refreshes as soon as I save the files, even before I have switched to my browser; and that’s how I like it! 🙂 Lately I have been on the road quite a bit so I have had to run the development environment on my tablet (when in Windows 7; runs excellent in Linux). The tablet has OK specs: 1.4GHz Core Duo with 2GB RAM and a 7200 RPM drive (generally the bottleneck). But for some reason django’s development server seems especially slow at serving the files. The refreshes after changes are OK, not fast, but OK. It is the media that it is very slow at serving (understandably so).
I did a lot of research on my options to speed this up. I am using the standard CPython distribution on Windows. I saw a lot of references to unladden-swallow, but there weren’t a lot of benchmarks to prove the speed gain yet. I realize that this is still under very heavy development, but the one benchmark that I found really excited me so I decided to give it a try. Unfortunately, after hunting for a number of source code packages necessary for compilation and still not succeeding I concluded that it wasn’t worth the time yet 😐 I decided to rule out pypy because of the possibility of compatibility issues, I wanted something that I could plug into the existing system. For some of my projects I am using external libraries, which might not work with pypy.
Anyways, my solution ended up involving Apache. Based on the console output of django’s dev server I had an idea that it was slow at serving multiple files. So I decided to serve the media, which generally is the majority of the files in a given view, using Apache and let django’s server deal only with the views. Microsoft’s IIS is also an option, but I had Apache setup for another project so I decided to use that. Below is a part of my dev_settings.py that makes this change.
1 2 3 4 5 6 7 8 9 |
import socket # ... # System specific dev settings. if socket.gethostname() == "mystic": MEDIA_URL = 'https://thebitguru.com/projectname_media/' SERVE_STATIC_FILES = False else: SERVE_STATIC_FILES = True |
With this new combination and using 127.0.0.1 instead of localhost now my dev environment on Windows is fast enough to keep things interesting.
Two weeks ago when I came home after using the tablet in a car for a few hours I noticed that the screen won’t turn and that there was a lot of bend by the hinge. I have had this tablet for about three years and the warranty had recently expired. I knew getting it fixed from Lenovo would be expensive and probably more than I was willing to pay. Luckily, Lenovo publishes the hardware guide for most of their products so I downloaded X60’s hardware manual for reference and opened up the LCD to figure out what was wrong.
As you can see in the picture on the right, the left half of the hinge was broken. I didn’t blame Lenovo for it because I have used this tablet almost everyday, opening, closing and turning multiple times in a single day. The hardware manual was very helpful because it gave me the exact part number (which, as I found out, is also on almost every replaceable part in this laptop, a big plus!) and after about 20 minutes I knew that I could get a replacement part for less $50 (including shipping).
I recently published the Wake-on-LAN client for webOS (used by Palm Pre and Pixi) and finally got a chance to create a video showing how it works. You can see it below. I had to write a Java dbus service to accomplish this functionality so, unfortunately, this won’t be showing up in the Palm app catalog, but you can install it using Preware. For more information checkout the WoL project page.
Recently my laptop stopped going into sleep mode, which it used to do without any hesitation. I restarted because many times restarting takes care of minor issues, but that didn’t do it. Next try to get it to sleep resulted in the same behavior, the display would turn off, but the system would stay on. A quick look at the event viewer didn’t reveal any issues. A quick search online didn’t reveal much either. So, I was back on my own to solve this issue.
In the past whenever applying to a job I have tried to go a step beyond what the employer might have requested. In a few cases the requirement was C++, so what better way to demonstrate your skills than writing a C++ program? After some thinking I decided that a C++ based resume would be a good sample. So, I ended up writing a program that renders my resume almost exactly as it would have been rendered by Microsoft Word. Instead of hard coding the complete resume I wrote a text rendering engine that reads an array of string and renders it on screen based on some simple rules.
To make it simple for the hiring manager to run this program I embedded the text in a string array so they can just pass the exe around without having to worry about sending multiple files. The program works just as well reading from a text file. Here is a quick screenshot of this program.
So, what extra steps have you taken to increase your chance of getting an interview?
I just finished posting a new article about migrating a django application database from MySQL to PostgreSQL. This article is very technical and only covers the actual migration steps (i.e. does not explain why I made the move). Check it out if you are interested or curious.