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.

Risolto problema su postfix!

ricmest (09.04.2008 15:43:44):  FEDE NOSTRO CHE SEI SOTTO I CIELI DI LONDRA, GRAZIE PER AVERCI AIUTATO A GUADAGNARE IL NOSTRO PANE QUOTIDIANO, NON CI INDURRE NELLA TENTAZIONE DI MANDARTI A QUEL PAESE, OGNI TANTO… MA LIBERACI DAI PROBLEMI AFFINCHE’ CI SI POSSA DEDICARE MEGLIO AL NOSTRO PORTALE, AMEN