Backbone in Titanium

Using Backbone in Titanium Alloy is a very powerful mechanism but it can backfire on you if you don’t take into account how it works. Remove event listeners from singletons A common pattern is to create a singleton when a window opens and attach a change event handler to the model so the views will update when […]

Store mcrypt values from PHP in MySQL

The mcrypt functions return a binary string, so you can store it in a VARBINARY or BLOB field or as VARCHAR or TEXT if you first base64 encode it. When using the CBC (Cipher Block Chaining) mode, the input is divided into blocks of X bytes. The last block is then padded with NULL bytes […]

Android UI thread

I wanted to query a database on the onCreate method, but I ran into issues when doing this from another thread. First I tried to do it with the method, but it seems like the View is not always attached to the window, so the run() method of the Runnable was never called. Another […]