Custom SQLite build and iPad

I have built my own SQLite3 library in order to enable support for full text search for my iDEX app, I compiled and tested on iPhone (iOS 3 and 4) with no problem, but then I switched to the iPad target of the same project under iOS 3.2, where the application would crash as soon […]

Base SDK, Deployment Target, Weak linking and import

With the new release of Xcode for iOS 4, I was disappointed to find out that it’s not possible to select versions of the iPhone SDK prior to 3.2 from the usual build drop-down box. So I decided to take the annoying opportunity to find out more about how to create applications that use a […]

iPhone and memory leaks: two watch-out tips

The time I spent believing that my buffered input stream class had a leak because of two silly mistakes somewhere else could have easily been better employed. So I am happy to share my findings and spare other developers the same frustration. No rocket science here, just two simple anti-patterns.

iPhone/iPad Simulator screenshots

I just found out about a convenient way of taking screenshots from the iPhone Simulator (which, incidentally, is also an iPad Simulator). Just run your application and when you get to the screen you need to save, press Control + Command + C. The ‘screenful’ will be copied to your clipboard. One easy option at […]

Buffered stream reading in Cocoa

Strangely enough, there is no way in the Cocoa or Cocoa Touch frameworks to read a stream of bytes as a sequence of characters line by line. The option of creating a string from a file, with methods such as stringWithContentsOfFile of NSString, and then generating an array of lines with componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet] certainly seems […]

Truncate files on Linux/Mac OS

A quick way to truncate a file to zero length without affecting any other attributes (owner, permissions, and so on)? Here goes… In the terminal window, type the following command at the prompt : > filename.ext The file called filename.ext will be reduced to zero bytes (emptied, basically). Everything else stays as it is, apart […]

MySQL, PHP and Unix time

When working in PHP, the most convenient way of dealing with timestamps is through the time() function, which returns an integer representing the number of seconds from the UNIX epoch (1 Jan 1970 at 00:00 GMT). That’s perfect for passing around your code modules, calculating time differences and easy conversion to string with the date() […]

Mac OS and file splitting

It’s often useful to be able to split big archived files into smaller chunks, move them to – say – an external FAT32 hard drive (that won’t take anything bigger than 4Gb), and then recompose the original by combining the pieces. The MacOS X native archiver doesn’t handle that, and I didn’t like the idea […]

Type Associations in Windows

I’ve just found out about two convenient shell commands that can be used to check out and change/remove file associations in Windows. The first one is ftype, that allows you to define aliases for executable files to be invoked. The other one is assoc, whereby you can associate file name extensions to the aforementioned aliases.