php usort

Tuesday 02/10/2009  –  Category: Uncategorized

I learned about a nifty PHP function that allows you to sort an array with a user-defined comparison function. This is useful if you have an array of database results and need to sort by one element in the result array (normally it would be better to sort with the SQL query but I [...]



Google Latitude

Monday 02/9/2009  –  Category: Uncategorized

I’ve been wondering when Google was going to jump on the location-based service bandwagon after seeing apps like Brightkite and Loopt started getting popular when the iPhone came out.
As of now, the following devices are supported:
- Android-powered devices with Maps v3.0 and above. G1 users in the US will be receiving Maps v3.0 in a [...]



IE – Expected identifier, string or number

Monday 02/9/2009  –  Category: Uncategorized

If you’re getting this error, chances are you have an extra comma after a curly brace:
 
a = {
b: function() { },
c: function() { },
}
 
Get rid of the trailing comma and your JS error woes will disappear!
(source)



Safari doesn’t read inline css

Monday 02/9/2009  –  Category: Uncategorized

I’m not sure why I haven’t come across this until this past week, but I found out that Safari doesn’t render css within style tags outside the head tags.
The workaround is to inject the style into the head with javascript–similar to what Rails’ content_for does:
var cssDefinitions = ‘..my style chunk goes here’;
var style = document.createElement(’style’);’
$(style).html(cssDefinitions);
$(‘head’).append(style);
[...]



Server Upgrade

Monday 02/9/2009  –  Category: Uncategorized

I finally bit the bullet last night and upgraded my Slicehost slice to a 512slice. It’s running much zippier now (with much more room to breathe RAM-wise)!
The upgrade process was pretty painless through the admin panel–it took less around ten minutes to do the pre-resize setup and then another few minutes to complete [...]