29 Dec 2011, 4:47pm

leave a comment

InnoDB Insert Locks the Table

Turns out InnoDB’s default locking method sucks pretty badly.

I don’t really care about gaps in my primary keys, I *do* care about inserts being restricted to one transaction at a time. Wow…

SO on the topic

21 Dec 2011, 5:16pm

leave a comment

Updating ImageMagick on Centos5

Here’s what I did:

# DL new version (current versions are here, devel stuff here)
wget "http://www.imagemagick.org/download/linux/CentOS/i386/ImageMagick-devel-6.7.4-0.i386.rpm"
wget "http://www.imagemagick.org/download/linux/CentOS/i386/ImageMagick-6.7.4-0.i386.rpm"

# remove the old version
sudo yum remove ImageMagick-devel ImageMagick

# install some needed deps (YMMV)
sudo yum install libtool-ltdl lzma

# install the new version
sudo rpm -Uvh ImageMagick-6.7.4-0.i386.rpm
sudo rpm -Uvh --nodeps ImageMagick-devel-6.7.4-0.i386.rpm

# test it
convert --version

Better IMHO, than building from source ala this advice.

21 Dec 2011, 11:36am

leave a comment

S3 PHP putObject timeout for small files [Fix provided!]

I was getting this error today when trying to upload a small file to my S3 bucket:
S3::putObject(): [RequestTimeout] Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed

I’ve been using this library for a while, with large file uploads and didn’t get this problem, so I figured it was something to do with the smaller files. It seems others have had this issue too.

Assuming you are using the putObjectFile method like I was, it calls another method to create the request inputFile. In this method, I basically added a hack so that if the file size is small, it reads it and uploads it using a string of data, rather than the file pointers (where this bug lies, it seems).

My fix is simply to add this code to inputFile:

		if (filesize($file) < 512 * 1024)
		{
		  return file_get_contents($file);
		}

So for any file under 512k, it will upload it from memory, rather than the file pointer. I'm sure my server can handle this. I guess if you wanted, you could try a whole bunch of files until you found the size at which the code works, or even fix the problem at the source, but I have more pressing priorities. I suspect it's well under the 100k mark, so my 512k figure represents an abundance of caution.

more »

19 Dec 2011, 6:23pm

leave a comment

AppleIDs and multiple iOS developer accounts

“In the iOS Development Ecosystem the people are represented by two separate, yet equally important groups. The iOS Developer Users who create apps and the iTunesConnect Users who upload the apps. These are their stories.”

An iOS team is actually in two parts: the iOS Developer Team, accessed via the Member Center, and a completely separate iTunes Connect team.

It turns out that the one AppleID can belong to multiple iOS developer teams, and Apple asks you when you login to the member center which team you want to use. However iTunes Connect has no such feature, and each AppleID can only belong to one iTunes Connect “team”.

So you can re-use AppleIDs for developer accounts, but not itunes connect accounts. It’s up to you I guess if you want a totally separate AppleID for each team, or just each iTunes connect account.

18 Dec 2011, 11:49am

leave a comment

monit

Monit for linux is a great way to make sure Apache is running.

I set it up with the help of this fantastic tutorial. My steps after the break.

more »

13 Dec 2011, 10:02pm

leave a comment

NSDateFormatter format specifiers

Ever wanted the list of format specifiers?

As per the docs, it is here.

Anything in single quotes is put through as-is.

13 Dec 2011, 7:23pm

leave a comment

Android Market Resources

Confused about what each of the images do and how they’re cropped?

Look no further than this awesome test app! Market link here.

Some high quality phone image marketing resources. I like this one.

5 Dec 2011, 4:16pm

leave a comment

Posting to Rails with AJAX

Don’t forget your csrf token!

How to do it in Javascript.

The token itself can be retrieved in Rails with: session[:_csrf_token]