Author Archives: evangozali

SQL Select with Write Lock

SQL transaction is usually used when we want to make database changes in a consistent state. When inserting/updating row in a transaction, a write lock will be held by the transaction so other transaction cannot do update at the same … Continue reading

Posted in Programming | Tagged , , , | Leave a comment

A Little Misconception about Promise (nodeJS)

Consider the following code var Promise = require(‘bluebird’); function f(x){ return Promise.try(function(){ console.log(“start ” + x); return Promise.delay(500); }) .then(function(){ console.log(“finish ” + x); }); } var promises = []; promises.push(f(1)); promises.push(f(2)); Promise.each(promises, function(){ return f; }); Expected result: start … Continue reading

Posted in Programming | Tagged , | 2 Comments

Parallel asynchronous functions with NodeJS promise

Long time since I last wrote a post. So recently I’ve been doing NodeJS and meets a cool feature: Promise. Promise is a way to make asynchronous callback look like serial, so instead of writing doSomething(function(err,obj){ if (err) … … … Continue reading

Posted in Programming | Tagged , , , , | Leave a comment

[ios] Drawing unicode string in CGContext

There’s one big, big defect in CGContextShowText function. It only works for ASCII characters. There’s actually another way to draw in CGContext using NSString drawInRect: method, but it doesn’t work in my case because I need to calculate all the … Continue reading

Posted in Programming | Tagged , , , , , | Leave a comment

[iOS] Automatic Reference Counting and cross reference

Even with Automatic Reference Counting (ARC) feature in iOS 5, cross reference between objects should still be treated with care. A cross reference is where 2 or more objects are referencing each other, making circular reference. In which case, the … Continue reading

Posted in Programming | Tagged , , , , | Leave a comment

After Effects: Exporting alpha channel on separate file

Lately I’ve been playing with videos at my workplace (programming related). The widely supported video codecs, H.264, cannot have alpha channel, so in some cases I have to export the RGB channel and alpha channel into 2 files and then … Continue reading

Posted in Komputer | Tagged , , , , | Leave a comment

Easy comment-uncomment with 1 character

This is commented. /* do_something(); //*/ This is not. //* do_something(); //*/ Got this from a friend who got this from a friend who got this from a friend who…

Posted in Programming, Tips | Tagged , , | Leave a comment