Titanium Alloy as a mobile platform

May 5

Back on track now after the last, somewhat off-topic, blog post! Today I want to talk about a new platform I’m using for work called Titanium. What it does is it allows you to create fully native mobile apps using JavaScript as the language.

Why this? Why now?

Well, it’s not the first framework to provide cross-platform development tools for deploying the same codebase across multiple devices. Phonegap has been doing that for years! And up until very recently, Phonegap has been my go-to-guy for easily creating mobile applications without the nightmare of Objective-C based programming or even worse, Java based coding. What happened was I had just finished programming the app for iOS; it looked beautiful and it functioned perfectly. Transitions were smooth, pages loaded quickly, basically everything was awesome.

Sure enough, when I go to port it over to Android to make sure it works the same, it doesn’t even look remotely the same let alone function properly. I was getting probably 2fps max on page transitions on top of the already ridiculous 5 second delay between a tap on the screen and a reaction of any kind from the UI.

I was disappointed and frustrated. I had just spent the last 2 months building this beautiful app on iOS just to have it look and function like crap on Android. So, after many long hours of research and some help from some friends, I found Titanium (actually my friend had mentioned it a while back but I forgot about it :P).

So far so good!

I’ve been using Titanium for a week now and all I have to say so far is that it is amazing. You get the performance and the feel of a native app, all while maintaining that cross-platform portability that Phonegap brought to the table. The best of both worlds I think! It’s incredibly easy to use and the results outperform any Phonegap or “hybrid” application out there.

I’ll be working with Titanium for the rest of this week and I will post another blog post shortly with some thoughts 🙂

Filed Under: Dev

NodeJS – “CURL”

Mar 9

If you ever find yourself in the same situation I did where I needed nodeJS to pull data from a remote “API”, you’ll possibly know that it’s not as straightforward as it can be 😛

Since this took me a while to find I think it’s only fair that I post it in case anyone else can make use of it. To get data from an external server you can use the following function.

Hopefully that’s helpful 🙂

Filed Under: Dev

NodeJS + Socket.io + PHP

Mar 9

Over the past few days, I’ve been writing a custom Chat in an attempt to optimize resource consumption and make use of AWESOME web sockets. I stumbled across the idea of being able to “push” events that happen on the site such as receiving new messages, or new posts on topics you follow to the shoutbox. As a result I went out looking for a way of PHP connecting to a nodeJS server and being able to broadcast to the socket from there.

The result is a sort of hack which involves creating a secondary HTTP server and listening for connections. When a connection is received, the URL is parsed with the parameters and action can be taken accordingly 🙂

Here’s the code:

To push to it from PHP just fire a file_get_contents() or curl request to it. For example the one I use is as follows:

Hopefully this can help someone else with the same issue I had 😀

Filed Under: Dev