Building PIL for OS X 10.6 – The Right Way
September 12th, 2010

Per my previous post, it may be apparent that I’m working on a just-for-fun Django project that uses the Python Image Library (PIL).  Overall, it’s pretty easy to set up, but the instructions I found on the internet were just wrong enough to make me have to dig around for 20 minutes getting it to work.

Disclaimer: The above instructions *might* work for you, so feel free to try them first.

Anyway the issue I was having: After installing PIL through the above instructions, I tried to upload an ImageField file through the Django Admin interface.  I’d get the following error:

The _imaging C module is not installed

Some quick google-fu led me to this page which explained that Python probably could not find the _imaging module, or else that module wasn’t being loaded correctly.   This was strange because I had just installed PIL, and PIL showed up in my sys.path.  However, running:

>>> import _imaging

Showed the following message:

ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imaging.so, 2): no suitable image found.  Did find:
/Library/Python/2.6/site-packages/PIL/_imaging.so: mach-o, but wrong architecture

Ah-ha!  The original instructions indicated that it was required to change the build flags for a 64 bit architecture, but for me that was not necessary and in fact build incompatible binaries for my system.

For those following along, the correct instructions for my system were as follows:

$ curl -O http://effbot.org/downloads/Imaging-1.1.6.tar.gz
$ tar zxf Imaging-1.1.6.tar.gz
$ sudo bash
# cd Imaging-1.1.6
# python setup.py build
# python setup.py install
# exit
Installing Python Image Library (PIL) on Webfaction for Python2.6 / Django
September 9th, 2010

Webfaction is a pretty decent “set it and forget it” webhost, which I’ve been using for a number of years.  One thing I’ve noticed lately is that they’re not totally consistent with which software versions among servers, or at least based on some of the forum threads of theirs I’ve read.  Long story short, python2.5 and lower come with PIL, but for whatever reason, python2.6 doesn’t have it.  To get it going, do the following:

cd /home/<your_username>/lib
mkdir python2.6
easy_install-2.6 http://dist.plone.org/thirdparty/PILwoTk-1.1.6.4.tar.gz

That’s pretty-much it.  For some reason the python2.6 dir doesn’t exist, but you can add it back and easy_install whatever libs you need.

It’s been too long…
August 17th, 2010

… since my last post.

Anyway this entry won’t have a ton of substance to it, but I thought I’d post it so anyone looking me up didn’t think I’d abandoned my online presences.

Summer! A huge reason it seems I’ve dropped off the face of the internet is that summer happened. These precious few months of warmth mean I’ve been out and about most weekends instead of cooped up coding. Couple that with the fact that I moved apartments this summer and I just plain haven’t had a ton of time.

Bundle! Still contracting with Bundle.com, which has been the bulk of my programming effort for the last several months. It’s been a bit of a trip using C#.NET/ASP/Visual Studio/Windows Vista since I normally never use those tools, but I guess I now know ASP and can at least get around in Visual Studio.

My “Comets” game referenced in an old post has stalled. It was a ton of fun making it (and I may at some point spend the necessary ~10 hours or so to get it from it’s current state to the App Store), but ultimately I found it more and more difficult to keep working on it. For one, it was my first endeavor into Cocos2D. Naturally I spent a lot of time doing things the Wrong Way, as is usually the case when one learns something for the first time. Starting a project on the wrong foot makes doing changes later much more difficult and time consuming. However, the final nail in that coffin was that it wasn’t very fun to play. I never intended it to be this really awesome shooter game since I was building it just to learn Cocos2D, but in the end I decided my effort would be better spent working on a project I cared more about.

Speaking of new apps, I’m currently re-writing “Will It Rain?” for the iOS4/iPhone4/iPad. Knowing what I know now, I think I can write a much better version. I also have a few game ideas up my sleeve, along with a couple Ruby on Rails sites I want to build. If only I had more time…

Well, that’s about it. These days my main contribution to the online world is posting links over at Forrst, which is more or less a twitter for developers/designers.

That is All
July 19th, 2010

Apple Friend Bar [TheOnion]
July 8th, 2010


New Apple Friend Bar Gives Customers Someone To Talk At About Mac Products

New iPhone Game: Code name: Comets
May 17th, 2010

Here’s a sneak preview of an iPhone game I’ve been working on recently, code-named “Comets”.  It’s being built using the cocos2d framework.

The basic idea is that you’re the Space Station commander (yes that blob in the middle is your space station) in charge of defending your station from comets, aliens and other baddies.    You shoot projectiles by tapping the screen.

Arch Linux on Asus Eeepc 1005HA
May 16th, 2010


Over the last week or so I’ve been working on getting Arch Linux installed on an Asus Eeepc I recently purchased.  A long time ago I mentioned picking up the 900HA but I took so long to get around to it that the 1005HA ended up being the model I picked up.  Installation from a USB stick was a breeze and their Beginner’s Guide is easy enough to follow (it helps if you’ve used a distro like Gentoo or Slackware in the past).  The specific instructions on tweaking it for the 1005ha can be found on their wiki here.

Here’s the packages I recommend so far:

  • OpenBox – Great window manager.  I used to use Fluxbox but I feel that OpenBox gives more freedom to tweak various things.  It’s extremely fast, even on this limited hardware.
  • Conky – This is pretty standard.  Lets you view your remaining battery, plus whatever else you want to monitor.
  • tint2 – Great minimalist dock.
  • wicd – Wireless connection manager that sits in your dock.  A better alternative to netcfg, plus supports wired connections as well.

Overall I was surprised at how fast this machine runs.  The only performance bottlenecks so far have been the monolithic Firefox browser and the Flash plugin.  Most of the hotkeys work out of the box.  Sound, video, wifi, etc are all supported.

Hardware-wise this machine is hit-or-miss.  The keyboard is acceptable but I find the arrow keys difficult to use (both the Up and Down keys are in the spot that is usually occupied by the Down key).

The trackpad is pretty bad all around.  The material they use for it is the same as the rest of the case, meaning that it’s just slightly sticky to the touch.  To allow users to glide their finger over it without too much friction, they added bumps all over the trackpad, which gives the effect of moving your finger over bits of sand.  The trackpad button is equally awful in that it’s very difficult to know if you’ve clicked it, or if you’ve left or right clicked.  Verdict: Just use the keyboard or buy an external mouse.

On the plus side the display is bright and the battery seems to last forever, and the machine feels pretty sturdy. Its sub-3lb weight, small form factor, and low price point let me carry this machine around with me in my backpack anywhere I want to go, worry-free.  I don’t recommend it as a main computing machine, but for computing on the go this really can’t be beat.

Small Biz owners: Prepare for some serious 1099-ing
April 29th, 2010

I just want my fellow indie devs to be aware: Slipped in to the Healthcare Bill was a provision that requires all companies to file a 1099 whenever they spend more than $600 in a given year at any particular company.

Basically, businesses will have to issue 1099s whenever they do more than $600 of business with another entity in a year. For the $14 trillion U.S. economy, that’s a hell of a lot of 1099s. When a business buys a $1,000 used car, it will have to gather information on the seller and mail 1099s to the seller and the IRS. When a small shop owner pays her rent, she will have to send a 1099 to the landlord and IRS. Recipients of the vast flood of these forms will have to match them with existing accounting records. There will be huge numbers of errors and mismatches, which will probably generate many costly battles with the IRS.

This is obviously a giant pain in the ass for everyone involved.  Read more.

Update: It’s apparently already being challenged in congress.

Cocoaism Redesign
April 24th, 2010

Just implemented the new design for for Cocoaism. Check it out if you’re so inclined. The name of the designer Nick hired escapes me at the moment but I’ll update this post when I find out.  WordPress themes turned out to be easier to write than I thought.

Upgrading 10.5 to 10.6; Funny Spam; New Job
March 15th, 2010

Upgrading OS X from Leopard to Snow Leopard – How to Make it Not Suck

I realize I’m about 6 months late to the party, but I finally coughed up the $29 for OS X 10.6.  Frankly I never saw the need for it, but the newer XCode versions require it, so I went ahead and upgraded.

Well there’s not much to say, other than it’s about the least impressive upgrade possible.  Even with the downplayed feature list (even the box just says it’s just “the Mac you know and love”) and low price point I’m kinda mad that Apple even charged for this.

Oh yeah, and don’t bother doing an upgrade.  Do a fresh install.  You’ll end up having to reinstall everything anyway.  So far every app has mostly worked, but everything is slow.  Even Flash tripled the time it takes to load.  Here’s the kicker though: If you reinstall the exact same version again but on 10.6, it’s way faster.  Faster even than 10.5.  I don’t understand the reason, but a lot software you installed under 10.5 that is now slow under 10.6 will work much better if you just re-install it on 10.6.

Funny Spam

I get a ton of spam comments on this blog, which I diligently clear out.  However lately I’ve noticed the domains take a funny twist.  Here’s a sample from today’s comment queue:

- hellzyea.com
- makemeasammich.com
-  yourbabyisanasshole.com

Anyway I’m sure there’s some reason for it; maybe spammers figure people are less likely to flag “funny” domains as spam or something.

New Job

I don’t normally post too much about my regular work here, due to various NDAs and the fact that it’s often not of general interest, but today I started my career as a contractor.   Here’s my site: thomasgraft.com. I pulled out / fleshed out content from tomgraft.com and then re-designed tomgraft.com as well.

Hacker News (news.ycombinator.com)
March 9th, 2010

I haven’t had much time to write content here as I’ve  been busy setting up my LLC, so I just wanted to post a link to a great resource for startups: Hacker News.  More specifically, news.ycombinator.com.  It’s a reddit-style news aggregator with a web-startup focus, brought to you by the YCombinator folks (the SF VC).

The New TomGraft.com
February 7th, 2010

Just wrapped up a redesign of tomgraft.com.

iPhone XML Parsers Compared
February 3rd, 2010

I wrote an article for the new Cocoaism blog.

Google Chart Generator (Beta)
January 31st, 2010

Today I was going through some of my old Subversion repositories and came across a slew of projects I forgot I made.  One of them was an javascript google chart generator and I’ve put it up at tomgraft.com/gchart.  It’s one of the least impressive projects I found, but it was the easiest to put back up on the web.  Over the next few days (weeks? months?) I plan on uploading more of the re-found code on github.  Stay tuned.

Will It Rain v 1.1, Now in the App Store
January 29th, 2010

Hey everybody, quick update:

Will It Rain?” version 1.1 is now in the App Store. It includes some pretty cool updates, including a better looking UI, snow detection, and a better algorithm for determining the likelihood of rain/snow depending on what time you launch the app.

The price is now a firm “free, but ad supported”. I experimented briefly (under 48 hours) with selling this app at $0.99, but users were unwilling to pay for this product so I knocked it down to Free. Unfortunately Apple’s NDA prevents me from saying specific numbers, but a few, and I do mean few, users paid $0.99 for this.  If you’re one of the chosen less-than-a-dozen, I’m sorry.  I’m fairly certain almost everyone who paid for it is someone I know offline, so if you’re one of those, let me know.  I’ll buy you a drink or send you an Amazon gift card or something.

Well that’s it! It’s a pretty big update as far as being more accurate and supporting different weather types, plus I’ve got more features in the works for 1.2.

I Like the iPad (But I’ll Probably Never Use it)
January 27th, 2010

This post has moved here.

“Will It Rain?” iPhone App, now in the App Store
January 16th, 2010

Will It Rain?” was released yesterday on to the App Store.  It answers the age-old question, “Will It Rain?” and tells you, in plain English, just how likely it is to rain in the next day or so.  And for only $0.99 free, what a deal.

Read more about it here.

Visor for OS X (Quake-like Terminal.app View)
January 1st, 2010

It’s been a while since I posted so I thought I’d share a useful tool for OS X that can make your programming life a bit easier.

Visor for OS X

Visor for OS X is a SIMBL plugin that lets you quickly access your Terminal by use of a hotkey (I prefer the “ctl + ctl” one).  If you’re like me you probably hit the command line very frequently while developing to push or pull a file, or need to quickly look at a `tail -f` output.   Once you hit the hotkey you define, a shallow terminal drops down from the top of your screen and takes focus.  Hitting the hotkey again hides the terminal and returns focus to whatever you were working on.

It’s not a revolutionary app, but I’ve only used it for half a day and I already love it.  Just as a side-note: it seems to “take over” your Terminal.app, so if you want to also have a CLI that acts like Terminal.app does now, try a third party one like iTerm.

Google Chrome’s Incognito Mode
December 11th, 2009

About a week ago or so I downloaded the Google Chrome browser for OS X.  I recently discovered that, like most other recent releases of Firefox / Safari / IE, it contains the incognito mode.  For the uninitiated, it simply means that when you turn this setting on, the browser won’t record what sites you visit in your history or save cookies (read: your porn account logins).

This is the message that greets you when you open an “incognito window”:

chrome-incognito-osx-screenshot

You’ve gone incognito. Pages you view in this window won’t appear in your browser history or search history, and they won’t leave other traces, like cookies, on your computer after you close the incognito window. Any files you download or bookmarks you create will be preserved, however.

Going incognito doesn’t affect the behavior of other people, servers, or software. Be wary of:

  • Websites that collect or share information about you
  • Internet service providers or employers that track the pages you visit
  • Malicious software that tracks your keystrokes in exchange for free smileys
  • Surveillance by secret agents
  • People standing behind you

I’m curious if they’ll keep this version of the text in the final release. Anyway I haven’t used it enough to give any meaningful review, but a few things are worth noting.

First, it’s not faster.  It’s not particularly slow either, but pages take just as long to render to my naked eye as any other browser (Safari, Firefox, Camino) on my mid-level hardware (Macbook, 2GB RAM).   Most sites have browser specific CSS so even major players like Twitter don’t render 100% correctly because they don’t have a CSS case for Chrome.  Granted, a lot of benchmarks do show performance improvements, so take it with a grain of salt that my experience is *only* with the OS X Beta version (which is why I’ll forgo mentioning that it freezes/crashes as much as any other browser).

At the end of the day, there are literally dozens of third party OS X browsers out there.  Chrome has a lot of features that look good on paper and who knows what the next few years will bring.   That being said, I haven’t found a compelling reason to use it over Firefox or Safari.  I know that at least the Windows version of Chrome is allegedly faster and benefits from using a new process for each window/plugin.  However, until there’s a Chrome Firebug/Adblock/Web Developer Toolbar/Colorful Tabs/Greasemonkey/DownThemAll/Modify Headers/Tab Mix plugin, I’ll be sticking with Firefox.

GreaseMonkey Script – Reddit.com: Highlight Submitter’s Posts
December 6th, 2009

I’m a redditor and one thing that I’ve always wanted to do is have a way for the submitter’s posts to be more prominent.  So I whipped up a quick GM script to do just that.  This is the result:

Click to Enlarge

Submitter's posts are now in a light blue box.

Certainly nothing spectacular but it’s pretty trivial to change the CSS to your liking or extent this script to do other things to the submitter’s posts.

gm_reddit_submitter_css @ github