Software engineer, London UK

Heading to WWDC

Jun 07 2013

I’m flying to San Francisco for WWDC tomorrow along with a few guys from the Realmac team.

It’s already that time of the year. I almost can’t believe it, it feels like WWDC 2012 was last month! It’s been a really busy year and I’m so happy with all we’ve accomplished so far and all the cool things that we still have to show you guys in the next few months!

In the meantime, I’m very excited to head to San Francisco and I hope to meet as many of you as I can. If you spot me at the Moscone, please come and say hi!

Announcing Ember for Mac

Jun 04 2013

Today at Realmac Software, we announced Ember for Mac.

We’ve been working very hard to make Ember an amazing application and a great successor to LittleSnapper. I’m personally very proud of the of all the technical challenges we’ve been facing and solving. It hasn’t been easy every day but take my word, the final result is worth it!

You should also check the amazing Wallpaper that we have posted on Dribbble. I myself use the version Harry made and it’s amazing!

You can follow @EmberApp on Twitter and make sure to sign up to the newsletter on the teaser page.

It’s been a blast building it and I can’t wait for you to get your hands on it!

Hosting on GitHub Pages

Nov 19 2012

When I redesigned this website last year I had one main goal in mind: it had to be flexible. I didn’t want to depend on a platform such as WordPress or have my content tight to a database. Very naturally I decided to use Jekyll.

Jekyll gives you just enough power to generate a static blog from a bunch of markdown files while leaving you completely in control of the structure and layout. Back then, I was a happy customer of Linode so I was able to host the site myself. I was simply building it locally and pushed the content to my server via FTP with Transmit. While this worked quite well, it required me to have my MacBook (with Jekyll and related gems installed) just to be able to publish a post. So I then moved to have the server check out the git repository and set up a post update hook that simply built and published the site. This worked nicely but required more setup on the server that I would need to replicate when changing provider, too much hassle for a simple blog. Also, over the last months I found it harder to justify the $240 per year for a Linode VPS given that I was only hosting my blog on (and a couple of git repositories that could easily be moved to GitHub at any time).

So I made the move, from now on I will be hosting this blog on GitHub. This will make things much easier, the website only being a git repository built when pushing to the master branch. Drafts can be kept in a side branch, building locally for previewing, and merging to master to deploy. This approach has one caveat though, one cannot use a non-vanilla version of Jekyll. In other words, this means no plugins. GitHub runs a basic version of Jekyll and (slightly outdated) Liquid and plugins in the repository will be ignored. I didn’t make an extensive use of plugins but still depended on a couple of them, to classify the posts by date for example. Anyway, nothing insurmountable so I removed the yearly and monthly classification of posts in the archive page and now display them sequentially with their appropriate posting date. I have also slightly simplified the post types. Every post written on this site will be classified under Posts, that’s it! In other words, no more Bits and Starred Posts.

The last little thing was the Contact page. I was using a simple PHP script for the contact form that I obviously won’t be able to run anymore. No big deal, no one likes contact forms and there are plenty of other ways to contact me!

So, let’s just hope that this easier setup works smoothly and stimulates me writing more!

John Siracusa‘s Mac OS X reviews

Jun 28 2012

With Mountain Lion soon to be released next month, I am looking forward to read John Siracusa well renowned OS X review on Ars Technica. John puts a tremendous effort in reviewing our favorite operation system and his articles are always an amazing journey through every little updates and improvements in the OS release.

I have been a full-time OS X user since Tiger (I have used Mac OS 8 for a while in elementary school but my personal switch to the Mac, like many Europeans, was only around 2005). For this reason, the only reviews I actually had a chance to read were the ones for Leopard, Snow Leopard and Lion. Feeling like I had been missing something, I decided to read the whole saga from the very first one: Developer Preview 2! It's been an amazing reading so far (I have just finished the 10.0 review) and I cannot recommend it enough to anyone even only slightly interested in OS X.

All the articles can be found on Ars Technica. Since there doesn't seem to be a global table of contents for the various reviews, I've linked to them below. Every article is split between multiple pages (some up to 25!); you can view the article on a single page if you become a subscriber though. For $5 a month, it's really a no-brainer, and the articles will save nicely in Instapaper.

Enjoy!

Mac OS X DPs and Public Beta
Releases
Specials

Jun 28 2012

Given the dead-not-dead status of TextMate, I've been looking for a nice text editor to replace it with. Unfortunately, TextMate is awesome and I found it quite hard to find an app that I was comfortable with. Many people seem to like BBEdit or Sublime Text but I don't seem to become accustomed to the UI of any of them.

I have been alpha testing Chocolat for the past few months, and it looks like a very promising alternative to TextMate. A couple of minutes spent with Chocolat are actually enough to realize that it has clearly been built as a direct replacement to TextMate.

The 1.0 version has been released today, it's $49 on Fileability's store.

NSURLConnection setDelegateQueue is broken on iOS

Dec 29 2011

On Mac OS 10.7 and iOS 5.0, a very handy method has been added to NSURLConnection: setDelegateQueue:.

Using a URL connection in an NSOperation subclass has always been quite tedious because of the fact that one has to run a runloop for as long as the delegate callbacks have to happen. As suggested by Marcus Zarra in this StackOverflow answer, this has usually been achieved by calling CFRunLoopRun() when calling the start: method on NSURLConnection and CFRunLoopStop(CFRunLoopGetCurrent()) when the connection finishes loading or fails.

However, as my colleague Keith Duncan pointed out on CocoaBuilder, this is not optimal and should be avoided.

So, by creating an NSOperationQueue in your NSOperation subclass and scheduling the delegate callbacks into this queue, we do not need to run the current runloop for the length of the operation and consume a thread. In a nutshell, this is very handy and a much cleaner way to achieve this!

Here comes the problem: even though everything works perfectly fine on Lion, when performing the very same thing on iOS, the delegate callbacks are never called. It looks like the connection has to be started (and the delegate queue set) on the main queue for the delegate callbacks to happen. This obviously defeats the point of using it within an NSOperation subclass given that since Snow Leopard (and iOS 4.0) the start method of NSOperation will likely not be called on the main thread.

For this reason, in my opinion, the setDelegateQueue: method is unusable as per iOS 5.0 and should be avoided until Apple fixes this problem.

I have filed a bug at rdar://10529053 and you should dupe it if you observe the same behavior as I do.

I have created a small sample project to demonstrate the bug that I have attached to the radar. Feel free to run it on your side and see for yourself. You can download it from here.

MIME type to UTI and back again in Cocoa

Dec 28 2011

Often when working with web services in Cocoa, I need to convert between MIME type and Uniform Type Identifier (UTI).

I have seen many hacky way to do this but, in my opinion, following is the correct way to achieve it.

First let's import the appropriate framework based on the platform (you might also need to add the framework to your project if not previously done).

#if TARGET_OS_IPHONE
#import <MobileCoreServices/MobileCoreServices.h>
#else
#import <CoreServices/CoreServices.h>
#endif

To get the UTI from a MIME type.

NSURLResponse *response = ... // assume a URL response from somewhere else.
NSString *responseMIMEType = [response MIMEType];
CFStringRef MIMEType = (__bridge CFStringRef)[response MIMEType];
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, MIMEType, NULL);
NSString *UTIString = (__bridge_transfer NSString *)UTI;

And to get the MIME type from the UTI.

NSString *filePath = ... // assume the path to a file from somewhere else.
CFStringRef fileExtension = (__bridge CFStringRef)[filePath pathExtension];
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType);
CFRelease(UTI);
NSString *MIMETypeString = (__bridge_transfer NSString *)MIMEType;

Dec 22 2011

All Sophiestication Software apps are $0.99 for the Christmas period.

I own all of them and am a big fan of Groceries and Articles for both iPhone and iPad in particular. Go check them out!