Thursday, December 24, 2009

New portfolio iPhone App released!

I've finally released my first iPhone app under the name Melion Design. This is a photographs portfolio for Andrew Hill. What I want with this app is to demonstrate the engine I've developed to manage your portfolio in your own iPhone application.

The application is free, it's called "The Frog Photos" and you can find it in the app store. Andrew can manage the photos available in the application through a web interface I've developed. It makes it easy to upload, and manage photos. The following features are available:

  • Amazon S3 photos storage:  fast download of photos.
  • Offline mode: user can still browse your photos when offline.
  • Customize the description of each photo.
  • Customize the perma-link of each photo.
  • Provide a link to your own website.

Don't hesitate to contact me if you're interested in having your own portfolio available in the appstore for everyone to see! :)

Wednesday, December 2, 2009

Lotto Results for iPhone, version 1.2 released!

Yes, there it is! Version 1.2 has the following additional features:

  • Systems - record up to 18 of your favorite winning numbers assisting System Players
  • How to win - check what you require to win a division prize for each and every game
  • Odds - check the odds of winning each division for each and every game

I'm now working on even more exciting content, but I can't tell you yet what it is!

I just enjoy a lot working on this project. :)

You can find Lotto Result in the app store.

Tuesday, December 1, 2009

Presentation of my Happy Mapper fork at the last RORO Sydney

Last November I did a presentation of the Happy Mapper fork I developed. The video is available on Vimeo. Unlike the description says, it is a fork using Nokogiri to replace XML Object, but watching it will clear everything out! It's a lightning talk, so I'm sure I won't waste too much of your time :)

You can also find all the videos from RORO on Vimeo. Enjoy!

Wednesday, November 25, 2009

Calling an authenticated controller action from a rake task

Just wrote that little rake file:

I thought that would be useful for some people. It just calls an action from a Rails controller. This action is supposed to be accessed only by the admin user. We also prevent checking for authenticity token. This rake task will be called in a cron job.

Tuesday, October 20, 2009

Lotto Results for the iPhone

I'm proud to announce my first iPhone application I developped at Front Foot has been released!

Winning Numbers is a mobile website adapted to all phones in australia, but you can enjoy it now as a native application for your iPhone under the name Lotto Results.

It provides for now the latest results and dividends for all of the major australian lottery games: Oz Lotto, Powerball, Lotto, Tattslotto, Gold Lotto, and more... You can also save your winning numbers to quickly find them in the latest results, enjoy!

Monday, October 12, 2009

Updated dam5s-happymapper to use Nokogiri

I've updated my version of Happymapper to use Nokogiri. It should be faster. The original Happymapper had already been forked to use Nokogiri by Roland Swingler.

Nokogiri is a ruby gem to parse XML and HTML using XPath or CSS selectors. It's written mostly in C, and is very fast. I intend to use this version of Happymapper in an upcoming project with intensive parsing!

Thursday, October 8, 2009

Asynchronous Tasks in your iPhone App

One thing that as made web applications much easier to use in the last few years is the integration of Ajax into web pages. Before that, each click of the user would block the application until the next page loads... not really a great user experience.

Now when you want to trigger a long task in the background, you can use Javascript to trigger asynchronous requests... that is just great!

Well in standard applications design, it is also very handy to be able to do such thing, and we usually do it using threads. The iPhone platform obviously provides everything you need to perform that, and that's pretty simple! Just awesome! Here is how it works...

The documentation you want to read is the NSOperation Class it provides the tools to trigger a task in the background. And as the documentation says, you will most of the time want to manage a queue of operations rather than just a single operation. So the best thing to do (in my opinion) is to create a Manager (singleton) which owns a queue of operations: NSOperationQueue Class.

This way you can add operations to the queue, and they will all be treated in order. A good example of this kind of manager is the ConnectionManager of the ObjectiveResource library.

You can use it this way:

- (void)fileDownloaded: (NSData *)data {
    // Do stuff here
}
- (void)downloadFile: (NSUrl *)url {
    // Download file here

    [self performSelectorOnMainThread: @selector(fileDownloaded:)
                           withObject: downloadedData
                        waitUntilDone: YES];
}

And somewhere in your code trigger the asynchronous download:

[[ConnectionManager sharedInstance] runJob: @selector(downloadFile:)
                                  onTarget: self
                              withArgument: url];

That's it! So when you call runJob on the connection manager, it queues the job in the operation queue... so if you need to download ten files, they will be processed asynchronously one-by-one while the user is still using your app, without interruption.

Hope this was helpful!

Tuesday, October 6, 2009

Rails Routes according to the Domain

Routing using Rails is quite simple, you define routes and where they point at. The order in which routes are declared defines their priority. Very simple.

Now Rails also provides conditions on routes according to the HTTP method used, and using the request_routing plugin we can use more conditions. We specially use it for the domain, or sub domain used for example. The Frontfoot website and the Frontfoot mobile site are the same rails application, they just use different routing according to the domain used.

map.connect '/:action',  :controller => 'mobile',
                         :conditions => { :domain => /\.mobi/i }
map.connect '/:action',  :controller => 'main'

That works well if the domain has only one TLD like frontfoot.mobi, but if the domain has two TLDs it doesn't work. In this case we do the test on frontfoot.mobi so it works well.

Now what if we have two domains like for example frontfoot.com.au and ffmobile.com.au. Well that doesn't work. The :domain option will test the domain against 'com.au' we could then use sub-domain to get 'frontfoot' but in that case if we use 'www' it won't work because the :subdomain option tests only the first sub-domain.

So here is the solution! I have written a fork of the plugin to add a :domain_2 option which just gets the domain considering it has 2 TLDs. And there you go you can write:

map.connect '/:action',  :controller => 'mobile',
                         :conditions => { :domain_2 => /ffmobile\.com\.au/i }
map.connect '/:action',  :controller => 'main'

Enjoy! It's tested and on my github. :)

Monday, September 21, 2009

XML Parsing in Ruby using Happy Mapper

Part of my job consists in getting a lot of data from different sources. Whether it's a SOAP or REST webservice, a TCP Socket, or simply files on a FTP, most of this data is in XML format.

There are different libraries to parse XML in Ruby. We used to do with XML Object, but the resulting code is really difficult to read and maintain. We prefer Happy Mapper.

It is an XML to object mapping library. You can find the source on Github. I also created a fork to add support for text node in mapping objects. It also includes the changes from David Bolton.

The resulting code is very readable and easy to maintain... and the library can be used in most cases. It's also quite fast since it uses XML Object for the actual parsing. Examples are in the source tree, and the source itself is quite short and easy to understand.

Enjoy easy and happy XML parsing! :)

The iPhone application submission process

Last Friday I submitted for Front Foot our first iPhone application. It's quite exciting to arrive at this stage of the project. I have worked so much on this app, our creative designer Deena Baxter did a really good job! I can't wait to show you the result of that work. But I would first like to share with you different tips you may find useful tp submit your own application. The submission process, once you've understood it, is quite simple. But there some parts that are not very well documented. So here are a couple links you may be interested in reading:

When you are compiling in Xcode make sure you use the good building profile and it refers correctly your entitlements for AdHoc distribution, also make sure to use the good provisioning profiles for Distribution and AdHoc distribution.

Now all my workmates have a version of the application on their iPhone, and the application is being reviewed by Apple. Tell you more when it's available!

Sunday, September 20, 2009

Welcome to Melion Design's blog

Well hello there!

Let me present myself, I'm Damien, software engineer for Front Foot Media Solutions in Sydney Australia.

Lately I've been working a lot on mobile platforms, whether it's for mobile websites with a strong back-end like Three Mobile's iPhone landing page: Planet 3, or for iPhone native applications.

I really enjoy developing for the iPhone, we focus a lot on ergonomics, providing the good features and making them easy and enjoyable for the user!

I also work on my own projects, and some free lancing as well for really small projects aside from work, which is what Melion Design is about! So don't hesitate to contact me if you want a good front-end and back-end developer for your web app.