May 5

Titanium Alloy as a mobile platform

appcelerator-titanium-cover

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 :)

Apr 23

SLP Loudmouth II Exhaust

SLP Loudmouth II Axle-Back Exhaust Featured
SLP Loudmouth II Axle-Back Exhaust Side View

SLP Loudmouth II Axle-Back Exhaust Side View

SLP Loudmouth II Axle-Back Exhaust Top View

SLP Loudmouth II Axle-Back Exhaust Top View

 

 

 

 

 

 

 

 

 

 

 

 

I know this is a little bit different from what I usually post but I just wanted to put this out there for anyone looking to upgrade the exhaust on their car. I just recently upgraded mine on my 2011 Camaro and I’d like to share it for those researching the various brands and types of exhausts available out there.

The exhaust that I chose to go with was the Loudmouth II made by SLP which is an Axle-back system. I’ve been driving with it now for the past week and I must say I am really impressed. The 2010+ Camaro stock exhausts are very very tame so I wanted something with a bit more muscle/growl to it – and I must say, I love the sound of the Loudmouth II.

I made some quick videos with my bud Isaac when we got back from having it installed and although the audio is kinda quiet, you can clearly tell the difference in the rumble. I’ve already been asked by two people where I got it/which exhaust it was so it goes without saying, the car is finally getting the attention it deserves :P

Here are the before and after videos. Enjoy! :)

Dec 16

Multithreaded Socket.IO Server

Turbo charge your NodeJS applications with Multicore

Recently, I’ve been developing a new chat/messaging platform for my site, DarkUmbra.net that will be used throughout the website as well as for upcoming mobile applications. I started running into issues first with the linux kernel killing my chat processes because of open connections but after increasing the ulimit that issue subsided. Because of these crashes, I began looking for a way to run the chat on all 8 cores of the system to optimize performance and add redundancy in the case that one of the worker processes fails.

As you all know, NodeJS only runs on a single thread on one core of the server it’s running on by default. However, it comes installed with a simple utility that allows you to fork extra processes/workers as desired that can all access the same port/server running on Node. This is an incredibly useful feature and I recommend that everyone migrates their applications to multicore as it easily octuples (is that even the right word? Lol) the performance of the application. To illustrate this, I performed some ab benchmarks on my local installation which just served up which worker ID it was connected to. The test was to perform 10,000 requests and the results were really encouraging.

On the single core machine, the test took 4.503s. The multicore server however completed the test in 3.376 seconds, more than an entire second quicker; and that’s just running on my MacBook Pro. Throw in some server-grade hardware and wow does it fly. I’ve posted the Apache Bench results below for those who want to see the full output.

Now multiply that 1.1 second savings over 1M requests and you’ll quickly see the performance increase is exponential! Here’s how to do it:

What you Need

Scaling to Multicore

Let’s start with the basic file:

Configure the Master Process

Now that we have the basic structure that will control both the master process and the worker processes, let’s setup our master process. To make sure socket.io can talk to other socket instances on different workers, we have to configure them to use a Redis Store. Thankfully Socket.io comes packaged with Redis already so we don’t have to install it separately, simply tell socket.io that you want to use a separate Redis server. Let’s add this inside the if( cluster.isMaster )  if block:

Create Workers

Time to create the additional processes that will the server simultaneously. This can be done manually by calling  cluster.fork() as needed, but I prefer to spawn one process per CPU core:

Deal with Worker Crashes

Sometimes an exception will occur that is uncaught by your application causing your server to crash. When this happens, normally the application itself terminates. However, since we are running a multithreaded environment, we can detect a worker process has died and restart one in it’s place:

Adding Worker Code

Now that we have our Master process all set up to create worker processes, let’s go ahead and add some worker code to run on the threaded processes. Working now from inside the if( cluster.isWorker )  if block, let’s configure the server and the Redis store like we did before, this time, we’re going to add an extra line to start the server listening on the port:

Add Socket Bindings

Realistically we’re all good to go now, but our server doesn’t actually do anything yet. Let’s add some simple socket.io bindings:

That’s It!

If you start the server up, you’ll now see something like this:

Multithreaded Socket.io Server

Multithreaded Socket.io Server

There you go! Your server is now running socket.io in full multicore mode! If you wanted, you could even get fancier and spawn more workers as processor load increases and then kill workers off as the load goes down ;) But I’ll leave that to you :P

As always guys if you have any questions or comments, post ‘em below and I’ll do my best to answer them :)

Apache Benchmark Results

Aug 22

Copy – The New DropBox

Copy Banner

There are dozens, maybe even tens of dozens of online cloud storage services that offer free online hard drives for people to dump their stuff to and share it with people. Dropbox, Google Drive, SkyDrive, etc… All free, all secure, all share-able. Copy is the new kid on the cloud storage block and they’re bringing out all the big guns. For starters, they offer you 15GBs of space right out of the box. Google drive up until very recently only gave you 5GBs (they now offer 15GBs), Dropbox even less at 2GBs. So Copy beats Dropbox by 7 and a half times… and ties with Google. Unless of course you are referred by someone in which case you start out with 20 and then you beat Google by 5 =P So tell me, why wouldn’t you?

Naturally all these services have the option to invite some friends and get more space but again, Copy trumps all. For a limited time (they don’t say how long), Copy will give you and a friend 5GBs of extra space for every user you refer. That is to say that anyone who signs up through your link starts out with 20GBs out of the box!

Copy.com Huge amounts of free storage

Copy – huge amounts of free storage

Now I’m not posting this just to spam invites out of people… I’ve already invited a bunch of people through Facebook, my forum DarkUmbra, etc etc so the real purpose of this post is to attract the attention that Copy deserves. It is a killer service, with full apps on phones, tablets and it is putting other cloud services like Dropbox to shame! I’ve jumped ship and I advise all of you to as well!

Claim your 20GBs of FREE cloud storage on Copy.com and I promise you you won’t regret it =)

And no, they didn’t pay me to write this or anything lol… it’s just a killer service and I love them =P

Apr 23

The Modern Web Design Process

The Modern Web Design Process

This assignment tasked us with having to create an infographic portraying the general process one follows as a web developer/designer. This was done as a group so I have included my personal design and the final design we came up with as a group.