Links

Twitter

Categories

The latest app from raaza, UK Terror Alert, has just gone live in the iPhone App Store. This is another Ruby-on-Rails backed app that feeds data sourced from the UK Home Office and the MI5 Secret Service into native app format. This was the first time I’ve used Apple push notifications in an iOS app and it was a bit of a trying process getting an APN server up and running on top of RoR.

As for the basics, with UK Terror Alert you can:

see the latest alert levels for international and Ireland-related terrorism

Postcode Envy for iPhone has just gone live in the iPhone App Store. I really enjoyed doing this app as everything from design to development was under my own control. With the app, you can:

See house prices for postcodes in England and Wales.

View area ratings for these postcodes.

Compare average house prices across postcodes.

There are a number of ways to get the skinny on a postcode. You can look up postcode data for:

Your current location.

A postcode you choose.

A random postcode.

FYI the app only provides house price data for England and Wales.

As with the iCondom, I did the backend of this app in Ruby on Rails with JSON for transport. I’m finding the combination of Rails + ActiveScaffold + ObjectiveResource to be the fastest way to get apps of this sort up and running, much faster than any of the frameworks and tools I’ve tried for PHP and Java.

Another new iPhone app has just launched from raaza: the Addicted to Ibiza Island Guide 2010. This is the app you need to discover the best parties, places, news and music on the island. The app features all of the following:

The Addicted to Ibiza Blog for all the latest island news.

The Addicted Island Map with all the hottest bars and clubs, and how to get there.

Addicted’s Recommended Places guide with the best clubs, bars, beaches and more all detailed for you.

The Addicted Events Guide, with the deets for literally hundreds of the island’s hottest parties, from Amnesia to Pacha and more.

We did this app in partnership with the Addicted to Ibiza blog. And had a lot of fun doing it. I feel like I know the island pretty much inside and out now. Could come in handy if I end up going there in September. Pick up the app below.

There are a number of articles online that claim that neither Objective-C nor Java is better than the other, they’re just different. Well in terms of the mechanics and elegance of the language, I don’t agree– Java is the front-runner. Objective-C feels pretty archaic by comparison, and I suppose it truly is, being only a thin layer on top of standard ANSI C. Here are my top 10 gripes with Objective-C:

1. Lack of abstract/virtual classes and methods. Sometimes I want to ensure that a base class is never instantiated itself, other times I want to be sure that a subclass of a base class implements a particular method. In the case of the former, this is simply not possible– Objective-C has no concept of abstract classes. In the case of the latter, this is only achievable using protocols (i.e. similar to a Java interface) which seems slightly awkward- it requires considerably more code and bother than would be required of an abstract method in Java.

2. Lack of namespace support: It seems a bit silly that object types are prefaced with a Hungarian notation-like two characters indicating their source. The lack of namespaces also drastically increases the probability of naming collisions.

3. Header files… Groan. Defining an interface for every class is such a pain and requires so many more lines of code than are necessary. I find myself dreading every time I require a new class because of this and the fact that XCode’s code completion features are pitiful compared to Eclipse’s.

4. Managing memory: how I miss garbage collection.

5. Pointers: it is exceedingly rare that I would ever want or need to know the memory address of a variable, so why not abstract this information away? It’s easy to forget an * or @ and it can be difficult to debug problems relating to this.

6. Poor logging. NSLog is pretty poor and I haven’t been able to find anything like log4j for Objective-C.

7. Delegation, delelgation and more delegation. Objective-C makes huge use of the concept of delegation and I find that this can lead to spaghetti like code that can be difficult to follow.

8. Compiler reporting: Cryptic error messages and the poor logging described in 7 can make for challenging debugging.

9. Unit testing: OCUnit and OCMock are fairly immature compared to jUnit and jMock. And furthermore, a number of Cocoa classes include real work in their “constructors.” For instance, NSUrlConnection actually opens an HTTP connection and interacts online in its initWithRequest:delegate: method. The problem this creates is that object creation is tied to real work. This makes dependency injection difficult because we can’t separate the creation of the object from the logic, which would be required in order to substitute a test stub with test logic in its place. Dang. For more on this, see Misko Hevery’s great article on unit testing, object creation and logic.

10. No private methods. I often find myself in the position of using private methods within a class to define the specification of a procedure within that class… e.g.

loadSomeData();
doSomethingToData();
sendDataSomewhereElse();

These would all be private methods with the detail abstracted away. Unfortunately such methods need to be defined as part a class’s (public) interface even if only used within that class. Argh.

Simon 3000 is a modern day take on the classic Simon game from the 1980s that lets you compete against your Facebook friends and other players nearby. It’s a contemporary Simon with social and location-based features.

I recently switched to Chrome as my primary web browser because I was becoming increasingly frustrated with how resource hungry Firefox is. FF would regularly consume more than 1GB of RAM and problems with one web page would occassionally take out the entire browser. Chrome’s unique process model ensures that this never happens, and it consumes considerably less RAM than Firefox.

That said, Chrome is feature-poor when compared to FF and it is not without its flaws. And so here I present a list of the things I miss most about Firefox:

A wide selection of extensions/plugins. I rely heavily on Firefox plugins like FireBug, HttpFox, ElasticFox and S3Organiser for debugging websites and managing resources in the cloud. Chrome only introduced extensions at the end of last year and currently there are not many available, though thankfully this will change over time.

RSS support. Chrome simply isn’t there yet. I was a bit surprised to learn that Chrome does not have a feature for auto-detecting and subscribing to RSS feeds, nor does it even display RSS content in an easily digestible format. It’s funny to think that Firefox is better integrated with Google Reader than Google’s own Chrome.

A design consistent with Windows / manageable toolbars. Google has applied their own unchangeable design ethos to Chrome that is a departure from the typical Windows app. For one, tabs are where the title bar normally appears and there is no menu bar in Chrome. I can understand why Google did this, wanting to maximise space and put the most important information at the top, but I think this lack of consistency with other Windows apps makes Chrome appear a little cludgy and can lead to momentary confusion when working at rapid speed, switching through windows quickly. Ultimately, it would be nice to be able to customise the top-most toolbar area as you can with other browsers.

Windows that size correctly. I’ve tried various fixes for this with no success under Windows 7. For the life of me I cannot get Chrome to open a new window in a maximised state after the initial start of Chrome. Instead, new windows after the first open at a greatly reduced width which results in me having to maximise them myself before any serious browsing.

Comprehensive bookmark support. I am a serial bookmarker. I bookmark hundreds of web pages each month and thus require a fairly extensive system for managing them that consists of organising them into folders, tagging them and adding descriptions. Unfortunately Chrome at this point only allows you to organise bookmarks into folders, and this is going to make them difficult for me to recall in future. Particularly, I need tags so that I can apply more than one nested dimension of categorisation to my bookmarks. It would also help if Chrome’s Bookmark Manager had more sortable columns of data for bookmarks like FF does.

Firefox is clearly a much more mature browser and Chrome has a fair bit of catching up to do in terms of feature support, but Google is no doubt hard at work trying to pick up the slack. In the mean time, Chrome does perform infinitely better than FF and that is enough for me to continue to use it as my primary browser.

For some time now I’ve been comparing my usual search queries using this Google vs Bing tool, and the frank truth is that for a lot of the things that I search for, Bing gives me more accurate results that are more relevant to me than Google. This is likely only to improve when Wolfram Alpha is incorporated into Bing, but even now I can’t deny that Bing is the best default search engine for many of my queries.

But I haven’t switched, and I won’t. Google is still my default home page in every browser I use. There’s one simple reason for it– my online behaviours have become so enmeshed with Google that any sort of divorce is quite simply not an option. So what serves as the ball-and-chain? iGoogle and Google Apps, which have become products that drive me continually back to Google’s economic engine: Search.

Many years ago I began using Google Apps as a matter of curiosity and convenience. It started with Gmail, and some time later followed with Google Reader, Google Maps, Google Calendar, and Google Docs. Now I have become so dependent on all of them that they effectively act as an impetus to continue to use good old iGoogle as my home page, even if better search results are out there to be had. Giving up easy and immediate access to my all-important iGoogle + Google Gadget-based Apps dashboard is simply unfathomable. The plain truth is that I am no longer simply a regular user of Google Search but rather a hooked user of the Google Platform, of which Search is only a part, and for me to give up my dependency on the platform would be a huge task.

The introduction of social features into Google products only tightened their grip on me. With the arrival of Google Talk/Chat in 2005 I was suddenly able to interact with my Gmail contacts in the immediate form of instant messages. Google almost overnight took on characteristics of a social network, and I found myself with yet another compelling reason to have Gmail and hence Google itself open on my desktop at all times. Even the fact that Google Talk uses open protocols and that I could use any XMPP client with it is not enough to dissuade me. And midway through last year Google introduced social features into Reader. The nefarious Google Grip tightened fruther. Social features tend to make products especially sticky for the simple reason that everyone wants to be where their friends are, and the cost of switching tends to be high (e.g. building up a whole new network of contacts in a new product).

Two things are set to draw my relationship with Google even closer. One is the emergence of Android. I have avoided adopting an Android handset for the same reason that I have in past shunned the iPhone: poor feature set. But this is set to change this year. Android will finally see handsets with good quality cameras, zippy processors and all the other high-end features we’ve come to expect. And because of Android’s fantastic integration with Google apps, these new devices will only serve to further the Google platform’s importance and dominance.

The other, of course, is the coming of Chrome OS. As Google Apps already acts as a sort of social and professional productivity platform, an operating system that supports and increasingly intregrates the products of the platform makes perfect sense, and yet will further indenture us to Google. Then, like the hive mind stretching its tentacles into the consciousnesses of all its Borg followers, so too will Google’s reach extend out to all of us via our mobile and desktop operating systems, with Search at its core.

So even if Google Search isn’t the stand-out it once was, ultimately Google and me look set to be partners for the longhaul. iGoogle & Google Apps have effectively bound me to using Google Search. Google’s operating systems will cement this relationship further. If Bing could match the ease and convenience of iGoogle + Google Apps with similar products, then they’d still have the enormous barriers of social software change to overcome. You’re fighting a tough battle, Microsoft.

Whenever I revert to coding in PHP after an extended sprint in Java, I inevitably find myself somewhat frustrated by some of the shortcomings of PHP. Most of these have to do with how much less maintainable a large code-base becomes in PHP as opposed to Java. Recently, I wanted to quickly whip up a few webapps and decided to try working with the Symony PHP framework to see how quickly I could generate a webapp compared to using Struts 2 in Java.

I found Symfony to be a very effective and well-thought out framework. It was easy to learn and yes, it was not long before I had a functional web app online.

My issues are not with Symfony, but with PHP itself. First off is the plethora of static functions that PHP has on offer. Most of these would be encapsulated as methods of objects in Java (for instance instead of string.equals(otherString) in Java one would use in PHP the static method str_cmp(string, otherString)). This lack of encapsulation and the huge number of global methods makes for a very messy and expansive domain in which to work. Ultimately, I suppose this is a vestige of PHP’s procedural roots.

The lack of namespaces is another gripe, which further adds to the murky domain space of a PHP project. It’s not easy to see how objects relate to each other in terms of an organisational hierarchy in PHP, whereas this is a necessity in Java.

I also find awkward that in PHP you are in the postion of having to import files in order to gain additional functionality rather than importing classes. While technically these two things might not be so different, conceptually they are. An imported file can have functions and variables defined with no association to an object that effectively become global in scope on import. Static classes can have the same effect in Java, but I think most Java programmers have by now learned to avoid using static objects for the most part. The default behavior in Java is to use instances of classes whereas in PHP the default behaviour for many still seems to be to use collections of functions and function libraries.

I also find that PHP feels really quite verbose. All my PHP templates look rather ugly with echo statements littered everywhere. It’s not nearly as elegant as Freemarker.

With all other factors such as scalability, support, and resilience aside, I think PHP works great for small- to mid-sized web apps where maintainability of the code base is not a top priority. But for large, complex, long-life webapps, It seems to me that using a Java framework may be more appropriate in no small part because the quality and maintainability of the code will be considerably higher. This is not to say that you can’t create quality, maintainable apps in PHP, but that it is easier and more natural to do so in Java, where types are static, code encapsulation is paramount, and namespaces rule the roost.

It’s amazing how Google’s product announcements can instantaneously shake up the landscape of a market. When Google announced Google Maps Navigation at the end of October, the share prices of Garmin and TomTom crashed by 16% and 21% respectively. And since then they’ve only gotten worse.

I’m currently running several web apps from one Tomcat instance and they share several libraries that require log4j logging, Sitemesh, for instance. For this reason, I removed log4j.jar from each of my webapp’s “lib” folders and placed it instead in “${catalina.home}/lib” (note that I’m using Tomcat 6. This would be “${catalina.home}/common/lib” in earlier Tomcat versions)

I didn’t realise that this would create a a myriad of problems. What I found was that in my test environment, logging for all webapps ended up going to the log file for one particular webapp, while in my staging environment logging for all webapps went to the log file for a totally different webapp.

It took some time, but ultimately I got to the bottom of it. Apparently log4j does not play nice when the same log4j.jar is being used by multiple webapps. Configuring the rootLogger for one webapp appears to overwrite rootLogger settings for another webapp if log4j.jar is shared. Since each of my webapps was configuring the rootLogger to append to a different particular file, this meant that all logging ended up in only one file.

To circumvent the issue, log4j.jar must be place in each individual webapp’s “lib” folder in addition to Tomcat’s common library folder. Additionally, your web apps must be configured to use their own class loaders before using the parent class loader. This was my stumbling block. Your Tomcat context containers need to be set up something like:

<Context><loaderdelegate=“false”/></Context>

If delegate is set to true then each webapp loads the common log4j.jar in favour of its own log4j.jar, giving rise to the problem.