July 2010
2 posts
2 tags
Marching Ants
Yesterday, Apple donated the source code for MacPaint into the Computer History Museum. MacPaint was a bit before my time, but learning more about it, it’s amazing the influence it’s had on every graphics program since.
When Bill Atkinson was writing MacPaint, he had to figure out how to do rectangular selection. The solution he came up1 with was the—now standard—animating dashed...
2 tags
Speed is a feature
For the next version of Gmail, one of Google’s goals is to get it to load in under a second. They stated that for them, “Speed is a feature”. I couldn’t agree more. It’s something that Google seems to take seriously in most of their applications. Their user interfaces are pretty minimal, but they’re fast. Sure, they could focus on adding other features,...
May 2010
1 post
1 tag
Extract 1.1 and bookmarklet
I just released version 1.1 of Extract1. This update adds one big feature, support for a bookmarklet to simplify the usage of Extract. Currently, to view something in Extract, you have to find the embed code, copy it, and then paste it into the app. This is pretty quick to do, but can be a bit tedious. Also, in many cases, the embed code isn’t easily found or made available at all. The...
April 2010
1 post
2 tags
Meter Maid Sales & Stats
I created Meter Maid to scratch an itch. Living in the city, I’m often parking at meters and forgetting when it expires. I wanted an easy way to be reminded before the meter expired so I didn’t get a ticket. I had a need for the app, didn’t like the existing solutions, and really just wanted a challenge, so I decided to build it. I have a full-time job as a web developer,...
February 2010
2 posts
2 tags
Introducing Extract
Often while I’m working, I’ll watch a video of a talk or presentation. Usually, this involves jumping through a number of hoops to try to get a window that only shows the video. I’ll open it in a new browser window, resize it, hide all the toolbars and status bars, and adjust the scroll bars until it’s just right, and only the video is showing. Then I try to position the...
2 tags
System Status Pages
I’ve been really digging the status pages for various web apps/services lately. As these services grow larger, and we grow more dependent on them, it’s critical that we know how they’re operating. They’re typically one page sites with a single purpose - to report the status of the system. Usually, that is broken down into current status and recent status history, in which...
January 2010
3 posts
2 tags
Some thoughts on the Apple iPad
After many months of rumors and speculation, Apple finally unveiled the iPad. Almost all the questions have now been answered, but a lot of people are asking, what do I use it for? If I have an iPhone and a Macbook Pro, where does this fit in? I can’t answer that for everyone, but I can tell you why I’m planning on getting one.
I’ve been thinking about this device for a...
1 tag
Fixing tumblr's white flash
After my recent switch to tumblr, I noticed something odd. Tumblr loads their controls into an iframe in the top right corner of the page. If you’re logged in, it will give you some options to follow, like, or reblog. If you’re not logged in, it will prompt you to join tumblr. It’s not very obtrusive, and I don’t mind promoting a product I like and I hope to see succeed....
2 tags
Switching from Wordpress to Tumblr
I had some free time today, so I decided to switch my self-hosted Wordpress blog to Tumblr. I’ve been thinking about doing it for a while and since I want to try to post more in 2010, it seemed like the perfect time.
My main motivation behind switching is that I’ve always liked Tumblr, and have never really been a fan of Wordpress. Wordpress is a great product, but for some...
October 2009
1 post
2 tags
NSTextView and NSString differences in text...
If you’re drawing a string in Cocoa, you may notice discrepancies between how the text is rendered in a NSTextView and how it’s rendered when using the NSString (or NSAttributedString) AppKit drawing methods. This is because of they each use a different default NSTypesetterBehavior, which results in slightly different line spacings. When you draw a string using the drawing convenience...
September 2009
1 post
3 tags
Debugging API requests with HTTP Client
I received quite a few comments on my How to use JSON in Cocoa/Objective-C post with some confusion related to the response from API calls. I thought it might help to show an example of the steps you’d take if you wanted to integrate the Twitter public timeline (or any other API) into your app or site. For doing any sort of HTTP/API request analysis, I first turn to HTTP Client.
HTTP...
May 2009
1 post
1 tag
Creating an archives page with WordPress
I don’t really see the usefulness in viewing blog archives by month or year. I’m not particulary interested in what someone wrote in November 2008. If I’m looking at your blog, I care what you write about, not when1. I’m not sure why so many blogging systems make a monthly display the default for archives, when a list of the posts is much more usable.
Fortunately,...
April 2009
2 posts
3 tags
Using Dropbox to sync TextMate
I use TextMate at both home and work for doing all my development and for dealing with pretty much anything text related. I got tired of having inconsistent environments between work and home. I wanted to be able to create a new snippet at work and be able to use it at home (and vice versa) without having to recreate it. Turns out you can do this easily with Dropbox.
Dropbox1 is a service to...
3 tags
Opening links in background with Cocoa
One of my biggest annoyances with mac software is how it handles opening links. This is usually a disruptive process that requires you to switch from your current task and application to another. Since I use spaces to partition apps (more info), it often results in not only switching apps, but also spaces, which makes it all the more annoying. Now, it makes sense if you click a link, that you want...
March 2009
1 post
3 tags
Programmatically retrieving IP Address of iPhone
For my app, QuickPic, I needed to show the user the IP address of their iPhone so they could type in the URL to the browser. The iPhone SDK provided no simple way to get the IP Address for the wifi connection. There are some undocumented methods that work ([NSHost addresses]), but I didn’t want to risk them pulling that out of there and my app breaking. So I wrote some C code (cobbled...
January 2009
1 post
3 tags
How to use JSON in Cocoa/Objective-C
Using JSON in Cocoa is simple thanks to an excellent open-source JSON Framework by Stig Brautaset. The framework will decode a JSON string into native Objective-C objects, and vice versa . The project includes a packaged Framework, Mac and iPhone SDKs, as well as the source code. The easiest method is to directly embed the source in your app as it’s pretty lightweight, and will work on...
November 2008
1 post
3 tags
JSON output in Rails 2.1
I just came across a change in Rails 2.1 when converting an ActiveRecord object to JSON. The JSON output now includes the ActiveRecord model name in the object so if you have a user model and convert it to json, you get the following:
user = User.find(1)
user.to_json
{"user" : {"name" : "John Doe", "id" : 1}}
This becomes a pain when you’re pulling this data via AJAX and you’re...
1 tag
The Ext3 filesystem sub-directory limit
I recently came across a problem on a site where a client could no longer upload images through their site. After digging through the logs, I found the relevant error:
Errno::EMLINK (Too many links - /usr/lib/ruby/1.8/fileutils.rb:243:in `mkdir’
This error was occurring when the system tried to make a new directory to store the uploaded images in. After researching (googling) the error,...
September 2008
2 posts
1 tag
Quick way to fix accidentally deleted .svn...
If you acccidentally delete a .svn directory from a folder that is under version control, you’ll get an error when you try to commit and won’t be able to proceed. A real quick fix, that worked for me, is to just check out a new copy of the repository, and copy the .svn directory you deleted to your current working copy and you should be able to commit.
$ svn co svn://server/project...
1 tag
No Format - a plugin to prevent wordpress from...
No Format is a plugin to prevent wordpress from applying any formatting to your posts. I got tired of wordpress formatting my carefully crafted HTML and messing up my posts, so I created this incredibly simple plugin to prevent it. It disables two of the filters wordpress passes your post through before displaying it. If you’re posting using the code editor (as I am), these filters can...
August 2008
1 post
2 tags
NSColor clearColor makes view black
I just came across a problem while programmatically trying to add a label (NSTextField) to a custom view. I wanted the label to have a clear background so the superview would show through, so I added:
[label setBackgroundColor:[NSColor clearColor]];
For some reason, this made the entire background of the label black. Instead I found you can use the following to achieve the desired...
July 2008
2 posts
3 tags
Swapping input field placeholder text with jQuery
Here is a quick and easy way to handle swapping placeholder text in an input field with jQuery. This is typically used when you have a text box where the design does not allow enough room for a label element to describe the purpose of the field. In this case, like a global search box, the input field is pre-populated with a descriptive text such as “Search”. When the user clicks the...
2 tags
Preventing TextMate from creating ._ files on...
If you use TextMate with files stored on a network drive, you may notice a bunch of hidden files start to creep up. These files begin with “._” and the name of the file. So if you’re working on info.php, there will be a ._info.php file in the same directory. These files are used for extended attributes. From the TextMate manual:
“TextMate makes use of extended attributes...
June 2008
2 posts
1 tag
PHP large file upload results in empty $_FILES...
I was just working on a PHP file upload class, and found some inconsistent behavior in PHP. If you upload a file that is larger than the php.ini directive post_max_size, it will silently fail, and the $_FILES and $_POST arrays will be empty. It won’t return an error code, it will just look like no file was uploaded.
This is quite annoying since almost every other file upload related error...
2 tags
IE6 links showing blank pages
I recently had a problem with a site I was building where clicking any link in IE6 would just show a blank page. After I hit refresh, it would show the page correctly. It worked in every other browser, and the markup was valid. After googling around, the only answers I could find suggested IE6 was corrupted. I knew this wasn’t the case since I tried it on another computer, and every other...
February 2008
2 posts
1 tag
Adobe AIR 1.0 released
Adobe has taken their AIR product out of beta. AIR is a cross-platform runtime to deploy Rich Internet Applications to the desktop. AIR apps can be created in Flash, Flex, or HTML/Javascript/AJAX.
I like the idea, but right now I don’t really see the benefit of AIR. It’s another runtime to download and install before being able to use an application, that just adds one more step....
1 tag
Fluid: bringing the web to your desktop
Fluid is new app by Todd Ditchendorf to create stand-alone web apps that act like desktop apps, which are being called Site Specific Browsers (SSBs) by the creator. You can add your own icon, and it will run in it’s own process, so a crash from another web page won’t kick you out of your Basecamp or Google Docs session.
I’ve been using it for about a week since I heard about it...