Devlog

Catch errors in Promise

When using the static resolve() Promise method, you often see code like this: Promise.resolve(func()).then(function(result) { console.log(“Ok for: ” + result); }).catch(function(error) { console.log(“Error: ” + error); }); console.log(“Some code running after Promise.resolve…”); Everything is ok when the func() function has no errors: function func() { return “OK!”; } Output: Some code running after Promise.resolve… Ok […]

Titanium switch in listview item

I was using a listview with rows that had a label and a switch element. The switch element could be turned on or off and new items could be inserted into the listview. When new items where inserted I just replaced all items. This was giving me some nice surprise, as the value of the switch […]

Arch Linux

Arch Linux is really a great desktop distribution, especially for older hardware like my Asus Eee pc 1015PEM netbook. Windows 7, the OS originally installed on this netbook, is very slow and even Xubuntu is not very fast, though faster than Windows 7. To install the distribution you have to execute some commands in the […]

Checking in an existing project in SVN

Create the directory in the repository. Check it out somewhere (NOT in your local working directory). Move the .svn directory to your local working directory. Add all folders an files. Commit.

Titanium fireevent and bubbling

In iOS events bubble up from child to parent view by default, but in Android you have to explicitly say so. For example if we have a parentview that adds a childview that has a button in it. After clicking the button, the childview fires a “logout” event on the button. The parent view listens […]

Titanium, Backbone and Promises

An easy way to let Backbone work with Promises in Titanium: Get the bluebird Promise library. Now you can add a fetchAsPromise to the Backbone.Model.Prototype and Backbone.Collection.prototype objects: Backbone.Model.prototype.fetchAsPromise = function(options) { var me = this; return new Promise(function(resolve, reject) { options.success = resolve; options.error = reject; me.fetch(options); }); }; The same can be done […]

UTC date in javascript, php, mysql and sqlite

It can be very challenging to work with dates and times across different timezones. In this post I explain some of the things I do to make this work. I focus on Javascript, PHP, MySQL and SQLite development. MySQL The most important action first – put the connection session in UTC mode: set time_zone = […]

TiShadow

TiShadow enables you to test faster on multiple devices at once. This is a step by step article to use it. If you want to use it on Android Genymotion emulators, you first have to install Google Apps on these emulators. TiShadow consists of 3 elements: The server that pushes apps and updates to the […]

Node.js installation and npm prefix

Some things regarding Node.js installation and setup: When installing Node.js with the installer, it will install the npm inside the Node.js location. So if you’ve set another prefix, you have to delete the npm packages from within the Node.js location, so they won’t shadow the one in the prefix location. The npm prefix variable is […]

Find sqlite location

Te find the sqlite location for your iOS simulator, you first have to know the simulators uid. To see all available simulators and their device UIDS: /Applications/Xcode.app/Contents/Developer/usr/bin/simctl list The sqlite location is: ~/Library/Developer/CoreSimulator/Devices/<device-id>/data/Containers/Data/Application/<application-id>/Library/Private Documents/<db>.sql Unfortunately it’s (as far as I know) not possible to get the application id. If you know the name of the […]