Preventing Flash Builder debugger timeouts in Firefox

Nov 13th, 2011 | Filed under Flash

If the debug session terminates unexpectedly when using the Flash Builder debugger to debug a Flash project in Firefox, this problem can be solved by going to about:config and changing dom.ipc.plugins.timeoutSecs from its default value to -1.

Determining CPU endianness at runtime

Jun 12th, 2011 | Filed under C, Programming

Since the short 1 is represented as 00 00 00 01 on big endian machines and 01 00 00 00 on little endian machines, it’s a rather straight forward matter to detect the endianness of a machine, by simply looking at how it stores a short.

#include <stdio.h>
 
int main() {
    unsigned short i = 1; // store a short
    char* p = (char*) &i; // convert the short into an array of bytes
 
    if (p[0] == 1) {
        // if the first byte is 01, then it's a little endian machine
        printf("Little endian\n");
    } else {
        // otherwise, it's a big endian machine
        printf("Big endian\n");
    }
 
    return 0;
}

Deleting a remote branch in git

May 31st, 2011 | Filed under Git

To delete a remote branch, run:

git push origin :branch

How to change the Android emulator temporary directory

May 3rd, 2011 | Filed under Android

If you’d like the Android emulator to store its temporary files in a directory different from /tmp/android (maybe you’re sharing your computer with someone else that needs to run the emulator and you both want to run it at the same time), then there’s unfortunately no other way to do it but to change it directly in the emulator binary, since it’s hardcoded.

To do that, open up the binary in vim:

vim -b path-to-android-sdk/tools/emulator

Once the file is open, search for the “/tmp/android” string by typing the following and pressing ENTER:

/tmp\/android

Now press a, modify the path to whatever you like, as long as it contains the exact same amount of characters (make sure you don’t change anything else). After the path is changed, press Esc, then :wq, ENTER and start the emulator.