Category: Tech, Code & AI

  • Offline HTML Mobile Apps

    Picking up iOS is quite a bit of work plus you need to buy a Mac to get Xcode running.

    Yes I know you Hackintosh folks are going to start making some noise but let’s keep this legal.

    So I’ve decided to build quick apps using jQTouch.

    To get an App icon on your home screen, simply… add the page to your home screen! Duh. It’s like adding a bookmark. Try it – it works!

    But here’s the next problem – how do we get the apps to work without network connectivity?

    HTML5 introduced something called the offline cache manifest. Here’s how to use it…

    Step 1 – Create a file called yourfilename.manifest with the following content

    CACHE MAINFEST
    demos/main/ajax.html
    demos/main/ajax_post.php
    demos/main/index.html
    demos/main/jqt_startup.png
    demos/main/jqtouch.png
    jqtouch/jqtouch.min.css
    jqtouch/jqtouch.min.js
    jqtouch/jquery.1.3.2.min.js
    themes/jqt/img/back_button.png
    themes/jqt/img/back_button_clicked.png
    themes/jqt/img/button.png
    themes/jqt/img/button_clicked.png
    themes/jqt/img/chevron.png
    themes/jqt/img/chevron_circle.png
    themes/jqt/img/grayButton.png
    themes/jqt/img/loading.gif
    themes/jqt/img/on_off.png
    themes/jqt/img/rowhead.png
    themes/jqt/img/toggle.png
    themes/jqt/img/toggleOn.png
    themes/jqt/img/toolbar.png
    themes/jqt/img/whiteButton.png
    themes/jqt/theme.min.css
    some/other/file.name

    Step 2 – Make sure your web server reports the MIME type correctly by adding the following config to Apache. You might need to contact your hosting provider to get this done.

    AddType text/cache-manifest .manifest

    Step 3 – Add the following tag to your HTML page so the browser knows where to find the manifest.

    <html manifest="yourfilename.manifest">

    That’s it!

    Original reference material here.

  • IPv6 over GRE in RHEL/CentOS

    Note: This article is not about 6-to-4 tunneling. This is about carrying IPv4 and IPv6 at the same time (aka Dual Stack) over a GRE tunnel in RHEL/CentOS

    I was configuring an existing GRE tunnel on my Linux router when I found that the initscripts in CentOS 5.5 didn’t support IPv6 for the tunnel devices.

    The quick hack was to edit /etc/sysconfig/network-scripts/ifup-tunnel and look for this line:


    /sbin/ip link set dev "$DEVICE" up

    Add these lines just after the line above:


    # Added to accomodate IPv6 in tunnel
    /sbin/ip addr add "$IPV6ADDR" dev "$DEVICE"

    Then modify /etc/sysconfig/network-scripts/ifcfg-tun0 (or whatever your device name is) and add the following lines to run dual stack over GRE:


    IPV6ADDR=2001:abcd:1a2b:3c4d::2/64

    If you need to use the tunnel as an IPv6 default gateway, create /etc/sysconfig/network-scripts/route-tun0 and add an entry


    ::/0 via 2001:abcd:1a2b:3c4d::1/64

    Then just restart the interface and bingo IPv6 and IPv4 dual stack on a GRE tunnel.

  • Review of iOS 4 on iPhone 3G

    I’ve just updated my iPhone with the new iOS 4 firmware yesterday and here’s a short review.

    There has been lots of commotion about multi-tasking but I’m not the least concerned — not because I am not getting it on my iPhone 3G, but because I don’t see a need for it with the type of apps I use. Mail and Google Maps in the background doesn’t make sense. I might change my mind if there’s a good IM client someday.

    For now, the only useful features are shown below.

  • IPv6 over IPv4 (6to4) all up and working

    Yes, I’ve set myself out to learn IPv6. I thought it was simple – or at least with my understanding of IPv4. I was completely wrong! IPv6 has a much more complicated addressing scheme and “rules”. It requires a change of mindset for a start. The worst part? Getting it all to tunnel through IPv4 when you’re running dynamic IP.

    Anyhow, I’ve got my Linux (CentOS 5) box working and my home network is now “IPv6 ready” (hooray!) but I’m still tweaking the settings so I’ll update the technical stuff later.

    Some little bits about IPv6 I’ve learnt so far is that DHCP servers aren’t really required anymore. Interfaces can self-assign an IP based on their MAC address and this will be almost certainly unique (since MAC addresses are unique). Even in a controlled network, the interface would assign it’s own address.

    Meanwhile, here’s my traceroute to ipv6.google.com. šŸ˜€

    traceroute6: Warning: ipv6.l.google.com has multiple addresses; using 2404:6800:8005::63
    traceroute6 to ipv6.l.google.com (2404:6800:8005::63) from XXXX:XXXX:XXXX:1:217:f2ff:fe40:3848, 64 hops max, 12 byte packets
    1Ā  XXXX:XXXX:XXXX:1::1Ā  0.534 msĀ  0.392 msĀ  0.410 ms
    2Ā  2002:c058:6301::1Ā  199.142 msĀ  199.858 msĀ  199.485 ms
    3Ā  2001:470:0:13b::1Ā  201.157 msĀ  200.728 msĀ  198.965 ms
    4Ā  2001:504:d::1fĀ  197.870 msĀ  199.858 msĀ  199.927 ms
    5Ā  2001:4860::1:0:21Ā  290.454 msĀ  203.619 msĀ  264.787 ms
    6Ā  2001:4860::1:0:77dĀ  220.451 msĀ  220.804 msĀ  436.060 ms
    7Ā  2001:4860::1:0:75Ā  511.964 msĀ  511.896 msĀ  320.166 ms
    8Ā  2001:4860::1:0:16Ā  703.447 msĀ  399.187 msĀ  624.945 ms
    9Ā  2001:4860::2:0:119cĀ  511.687 ms *
    2001:4860::2:0:119bĀ  529.863 ms
    10Ā  2001:4860:0:1::e3Ā  403.409 msĀ  517.593 msĀ  400.969 ms
    11Ā  * * *

    Hop 11 seems to have packet filtering and dropped my traceroute.

    I’ve also masked my internal LAN IP to XXXX:XXXX:XXXX otherwise somebody could connect back to my LAN segment. I haven’t had time to figure out the firewall yet. But you can say this is the beauty of IPv6. With a 128 bit address space, every machine has a public routable address.

    Once I have my home network all ready I will begin transitioning all my servers to IPv6. Embrace technology.

  • Second last CS3216 blog, lah!

    OK, Prof. Ben is chasing me for a blog and since I’m sitting here (at work, at this hour) waiting on a colleague, I shall write a short entry. I realized I haven’t been blogging for a while and my 105% honest excuse is that my manager went to Sungei Gedong Chalet (a.k.a. Reservist) so I was busy as hell covering some of his work.

    So here comes the second last blog entry. Aheem… (clears throat)

    I’d love to thank my wife, mother, father, etc. and of course Prof. Ben for inviting me to attend this class out of nowhere. I truly enjoyed my time and learnt a lot of things. Actually, I joined the class with the aim to learn anything, or what Prof would call “random stuff“, not to develop Facebook apps. I’ve actually had enough of Facebook apps back in 2007 where I worked in a small company dealing with some very first Facebook applications being made out of Singapore, although building an app for others and building an app for yourself is a different thing altogether.

    So what have I really learnt? I’ve learnt that my English sucks after four years of being bombarded by Singlish in the local workforce. I’m actually struggling to write a proper blog entry every time.

    I’ve also learnt that I’ve lost touch with the geek world. I didn’t even know what Google Wave was. I’ve never heard of Prezi, and I’ve never heard of DropBox. There’s probably about 100 other things I’ve never heard of that I found out during these 13 weeks.

    I’ve also found out that damn NUS students can talk and present! Sorry lah, but to the outside world NUS students are either like nerds or CMI. šŸ˜›

    I’ve also found out that a year 1 freshie can actually learn ActionScript 3 build a Flash game within 1 week.

    So there are super things that people can do that you’ve never thought was possible. But, now I know the power to create lies within, and I finally kicked myself in the ass and learnt how to build stuff in Flash. So, yes, I picked up a new language. Programming language, not French.

    I also face newĀ challenges trying to get things done. I think it’s a little different everywhere. Back in Polytechnic, it was either nobody cares, or maybe I cared too much. Yufen once said doing project a with me gave her “ę»”č¶³ę„Ÿå¤šå¤šļ¼Œęˆå°±ę„Ÿå°‘å°‘”Ā (great sense of satisfaction, no sense of achievement. Did I translate right?) because I practically wrote most of the code and we’ll all get an ‘A’. šŸ˜›

    Then at work you could K people ‘cos they either deliver the goods or get fired. It was the root of all evil at work. $$$

    Then in NUS it was also different – everybody cared too much, but was too busy. Like Prof. Ben said, this is not the typical NUS class. OK, I buy his explanation.

    So anyway, CS3216 is a weird class, but I guess it’s weird in the right way.

    Back to work…

  • Advertising as a Monetization Idea

    I was chatting with a few folks who made the pitch last Friday and it seems a lot of people think selling ads is the only way to make money.

    While Google probably made close to $100m in Singapore selling advertising alone, I still think citing pure advertising as a form of Ā monetization is an extremely bad idea.

    Advertising is an extremely crowded space. Search engines are doing it, news portals are doing it, forums are doing it, social networks are doing it, so where do you stand in this crowd, especially if you’re a new startup?

    Instead of looking to sellĀ advertisementsĀ for money, think of how you can monetize your strengths such as selling a service or Ā selling data and statistics for market intelligence, or even being acquired by another company.

    Think about it…