Friday, December 21, 2012

Coding tip: readability first!

In this 'Coding tip' I'll introduce you to one of the most sustainable coding tip of mine IMO. You may or may not agree with me but this has proven to be a valuable tip for me in terms of coding maintainability.

This one tip is was I call 'put material where the work needs to be done'. It is the opposite of offshoring :)

Coding tip: early exit

In this series of 'coding tips' articles I will show you some of the lesson learned tips I am using on a daily basis during development. They are general purpose tips which can easily be adapted to most development languages.

The first one is what I call Early exit

Saturday, December 1, 2012

Push Notifications to Apple, made... almost reliable!

For one of my projects I need to push informations to iOS devices. Apple has made a great doc on how to implement push notifications but as a matter of fact the ideal world of the documentation is not the one most developers experiment when dealing with push notifications to Apple's servers.

The thing that bothers most of us is the lack, or at least the manner, of feedback when a notification is sent. That is asynchro-loosly ;)

Thursday, November 15, 2012

expressjs with ... no layout ?!

Yesterday, I was working on a backoffice web application I will be releasing soon for one of my iOS projects. This web application is powered by node.js. I love node.js.
When it comes to creating web apps with nodejs I first had tried to managed all the routing aspects and stuff myself but lately I crossed expressjs.
expressjs is not as overbloated as most web frameworks in my opinion. I like simple stuff because when it comes to debug or extend the thing it's always easier. And it happened, I had to get my hands into expressjs because it appears that the layout abilities were removed from expressjs since 3.0.

The solution they (the developers) give is to have two separate files which you will include in any view before and after your custom content. Something like (with ejs engine):

<%- include 'top.ejs' %>
my custom content
<%- include 'bottom.ejs' %>

As a former ruby on rails developer, I am used to partials and layouts, so this workaround is rather repelling to me.

Saturday, October 6, 2012

Yet an other Objective-C block for fun

You know what, I could not live without blocks... It's sad but true.

Action blocks!

If you read all my previous block posts you now know how to use a block in a NSTimer. It's pretty neat and few people did take the time to say so in the comments which is great!

Now let's push the principle in the UI land. How about a block as target/action for any UIControl subclass ? That would be great not to have to write an other delegate method...

Thursday, September 27, 2012

Easy Updating of UITableView-s

When it comes to update a UITableView you have two choices. Either you reload the whole UITableView by sending a reload message or you can do differential updates by inserting, deleting and reloading rows with changed contents.

However it may be somehow difficult to always succeed in differential updates. Very often a UITableView assertion error falls down. And it can become very confusing with many sections etc...

Thursday, September 20, 2012

Seamless downloads with MCCURLConnection

I already told you about this class of mine which is a queued NSURLConnection with block delegates.  I use it as a ASIHTTPRequest replacement. Now it's been updated (here) and there are new features I'm going to show you.

Friday, September 7, 2012

Objective-C blocks for fun (part 2)

Last time I gave you a trick to run a block in a timer using a NSBlockOperation and I hope you enjoyed it ;)

Today, I will show you how to avoid delegate method implementations using blocks.

Wednesday, September 5, 2012

On ASIHTTPRequest replacement

When it comes to making HTTP requests, the most used library historically was ASIHTTPRequest. But since it's development was abandoned by it's creator many developers are seeking for a good replacement.

Thursday, August 30, 2012

The Simplest Gallery UIScrollView class for iOS 4+ ... ever ;)

In my last post about UIImage decompression nightmare, I told you I was working on a Gallery scrollView and now it's been released on github.

the gallery in action on iPhone

Wednesday, August 29, 2012

On iOS UIImage decompression nightmare

Yesterday I tried to polish a Gallery class that I work on which I'll be posting to Github soon. This class is intended to be used as the ultimate gallery view ;) It's really easy to understand and thanks to blocks it is really easy to use. But anyways I will make a post when it's available on github.

The problem I encountered while using my new gallery class to display images was that even though the pages creation was separated from the data sourcing using dispatch queues the first time an image was loaded, the scrolling would be really bad.

Friday, August 17, 2012

Objective-C blocks for fun

Today I had to solve a simple problem and since I am a lazy programmer I always tend to look for the solution that is the most easy to implement (less coding) but I never choose the easiest path to find this solution. I mean I try to follow this sentence: "Un objet est parfait quand on ne peut plus rien lui retirer de futile" which could more or less be translated to "An object is perfect when no more can be taken away". I don't know who ever said that but I often remind me this sentence when I work.


I want to register a timer (NSTimer) that runs a block.

Sunday, August 12, 2012

Two hours I'll never get back

Today I had to install node.js on a CentOS 5.7 box.
As usual with system administration you never know how long it will take to complete. But since I managed to do it and found it rather painful I wanted to share the moment with you :)
This is a commented copy/past of the operation log.

Wednesday, July 25, 2012

On javascript asynchronous callbacks

One of the true beauty of javascript, in my opinion, is the callback we use in asynchronous calls.
Most of the time callbacks are anonymous functions passed as the last parameter to an asynchronous function. We use a lot of callbacks in node.js environment.
However, sometimes it can become a bit confusing when many asynchronous functions need to be called. In this post I'll focus on parallel asynchronous function calls and overall completion callback.