Month: January 2012

Setters in Cocoa

Which of the three setters is better: [objc gutter=”false”] – (void)setName:(NSString*)value{ if(value != name){ [name release]; name = [value retain]; } } – (void)setName:(NSString*)value{ id old = name; name = [value retain]; [old release]; } – (void)setName:(NSString*)value{ [name autorelease]; name = [value retain]; } [/objc] Personally I’d use the third variant, but I’m open to […]

PHP: mysqli and 64bit numbers – a real pain in the ass

Due to some unfortunate bugs on my project I recently discovered a terrific problem with mysqli and 64bit numbers: no matter you have a 64bit OS and php is compiled for x64, mysqli will truncate the to 32bit any 64bit number when calling the mysqli_stmt::bind_param() method. Due to this  and the fact that I was using […]

PHP: don’t use time() or microtime() to measure execution time

As Thomas Habets posted on it’s blog (http://blog.habets.pp.se/2010/09/gettimeofday-should-never-be-used-to-measure-time): gettimeofday() and time() should only be used to get the current time if the current wall-clock time is actually what you want. They should never be used to measure time or schedule an event X time into the future. And because the time() and microtime() function relies on gettimeofday(), those […]