iDOS / DOSpad
Seems like I missed quite a storm last night while I was sound asleep.
Somebody released iDOS – a DOS emulator (based on the open source dosbox) onto the App Store. It lasted a few hours, people managed to run Warcraft 2 and even Windows, until it was pulled (no surprise there, Apple explicitly restrict executing additional code). Just 0.99c too – would have been worth purchasing.

This is the full screenshot, that is the keyboard you get. It even makes an old clacky sound!
Good news however: if you jailbreak you can get it on Cydia (under DOSPAD apparently), or if you are a developer, you can just grab the code and run it – no jailbreak, no 0.99c. It’s open source :)

Pretty cool...
In other iOS news, they released a Chinese Language App Store and Apple Store today, so I guess it’s time to sharpen up my zh-Hans sell text…
MySQL Foreign Key Constraints & Cascade Delete
I’ve never actually used a foreign key constraint with cascading delete in a production environment, least not that I can remember.
But for GPS Log this is very useful, to enforce key constraints, and also make deleting users extremely easy! Just 1 delete statement on the UserId and the DB takes care of the rest.
This is a great post on where to find the foreign key feature in phpMyAdmin
His SQL to help fix the cases which voliate the key constraint is extremely useful:
(where ‘agenda’ is the table with the foreign key constraint referencing ‘meetings’)
SELECT * FROM `agenda` LEFT OUTER JOIN meetings on agenda.meeting_id=meetings.meeting_id WHERE meetings.meeting_id is NULL;
Android Icon Spec
Thankfully they changed from the horrible 45 degree perspective of Android 1.
PHP Shortfalls
Been reading up a lot on PHP, Ruby and various other web languages recently.
PHP cops a lot of flack. This is one very good article of PHP’s shortcomings, and touches on one things I really really hate.
That is inconsistant API naming.
The one that gets me is is_null and isset. To me they feel similar, one checks if the value is null, the other if it exists at all. I force PHP to be strict which means I can’t reference variables that are not set (highly, highly recommended, and has caught many bugs) so am using isset everywhere. But I always forget which one has the underscore, and frequently have to look it up (as I did just now). To make it worse, some functions are camelCase’d too…
I’m glad PHP has the strict option at least. But I prefer being forced to declare variables. Nothing like finding a typo in one of your variable names after 1 hour of debugging :-/
On scalability, it’s easy to think Facebook (PHP) scaled, where as Twitter (RoR) did not. But when you drill it down, maybe it’s not the case. Facebook has 30,000 servers, which that article I linked calculated to mean each services only 128 visits (multiple requests) per hour. And I have found many references for Twitter where it seems to be squarely their fault (and maybe using Ruby in places that are not so suitable). So maybe Facebook just planned for growth and scaled up better.
Chinese iPhone4, Map Offset Fix
Chinese iPhone4
Before you buy the Chinese iPhone4, check some info. Apparently it has the following software limitations:
- The maps only display HanZi, regardless of local setting, and even for other countries
- There is no YouTube app
But apparently:
- in the next version of iOS, the chinese map offset issue is fixed for Chinese iPhones.
I have not personally verified this.
Other Region-Specific Modifications:
– in silent mode, Japanes iPhones still make the “shutter” sound when you take a photo. It can be made quieter by changing the volume. (seen on my brother’s iPhone 3GS).
– in HK, by law, phones can’t be sold locked. So it makes quite a good place to pickup an officially unlocked iPhone
Map Offset Fix update:
The good news for people with non-chinese iPhones (that suffer the map offset issue), is that there is a software fix, if you jailbreak. Info here (original)
Once you add the MirrorDev source in Cydia, look for ‘Location Fixed’. There are not many packages, so you just browse for it in the source.
Installing unofficial Android Apps
One cool thing about android, is that alternate market places are actually allowed by google (for example, you can download AppBrain).
As for the developer contract, they don’t restrict you selling your app however you like – you can even just sell the .apk file directly.
According to this page, installing .apk files directly is possible as follows:
- Copy the APK file you want to install to your phone’s memory card and insert the card into your Android phone.
- Go to Android Market and search for the Apps Installer application.
- Open it and click on the Install button.
- After it is installed, just open it. It will show you all the APK files stored directly in the root directory of your memory card.
- Just click on the application you want to install and it will be installed.
Since I have the SDK installed, I can use that to install. It’s quite easy (if you have the SDK, otherwise maybe a fair bit of bother just for installing apps).
- Make sure you have the Android USB Drivers (OS X users need not).
- Go to Settings -> Application Settings and enable Unknown Sources. (this allows you to install from outside the Android Market).
- Also go to Settings -> SD Card and Phone Storage -> Disable Use for USB Storage.
- In the command shell, type: adb install path/file.apk and you’re done!
Market Enabler is a good starting point, which allows you to fake various countries for your SIM card in order to buy applications from countries which are not yet supported. It’s a bit ridiculous really, I hate it when a silly boolean switch is imposed by the corporate folks like that…
WHR-HP-G54 running OpenVPN
Today I set up a second wired+wireless network in my home – this one running a secure VPN (provided by StrongVPN).
What follows is my setup experience, and some links that were helpful to me. YMMV.
Firstly I had to install the DD-WRT firmware. This is an open source firmware that runs on a bunch of routers (I chose the router specifically because I learnt it was capable of running this firmware well). Make sure you check before you buy.
Following the steps here worked fine (on OS X). Apparently you have to get the timing just right, I managed to get it to flash on the first attempt. Now that DD-WRT is installed, I can easily re-flash the device with my desired version of DD-WRT (in my case, the vpn build) from the web interface.
My first crack at setting up the VPN failed (using the latest vpn version from here), I think because I had too little available flash memory (they say you need 5.5kb and I didn’t).. The helpful folks at StrongVPN linked me to this version to try, which worked a treat (after following the StrongVPN setup instructions to the letter). StrongVPN is not only a great service, but they actually officially support DD-WRT, provide a single shell script which you run on the device to install it, and can even provide live troubleshooting help. wow.
$ scp ovpn272_ddwrt.sh root@192.168.11.1:/tmp/ $ ssh -l root 192.168.11.1 # once you're connected... $ sh /tmp/ovpn272_ddwrt.sh # which should output something like "size: 27011 bytes (5757 left)" $ reboot
First troubleshooting tip: make sure you can actually connect to the VPN using your computer (via the router’s network) before you try to debug it on the router. If you can’t connect from your PC then what hope does your router have?
If you’re uncomfortable working in a bash shell with ssh/scp tools, then these steps may be pretty difficult for you. Otherwise it’s not that hard.
So now I have two networks to pick from my devices which is handy. Previously the VPN would only work on my laptop, whereas now I can use it on all devices, and also switch rapidly when needed.
WHR-HP-G54 is a damn fine piece of hardware (even if you don’t need DD-WRT). I recognise it from the awesome Ace Inn Shinjuku hostel which had one on every floor, and I’ve seen the distinctive default SSID network names around (they assign a random one, not a stupid one like ‘dlink’).
Starting and stopping:
killall openvpn sleep 10 openvpn --daemon --config /tmp/ovpn/ovpn.conf
A tale of 2M
If you want something done right, do it yourself :-/
I moved into this house back in February. It has a 1M unlimited internet connection. I was happy with this at the time, it was better than anything I used throughout 2009, but nevertheless I asked to be upgraded to the best available. The account is in the landlord’s name (in China, the internet is like gas and electricity – they don’t switch it off between tenants which is really freaking smart). So I asked my landlord to make it happen.
It took so long I basically gave up. Until this week, it really started to piss me off (the iPhone SDK is now a whopping 3.5GB which takes a while).
Landlord said he had tried many times to upgrade me at the shop, but they didn’t let it happen. We tried the chinese language hotline and they said I had to go to the office with my ID card and the landlords.
So today I rang the company (10000), got the English hotline, spoke to #9434. Asked to be upgraded. They said sure. Cost is ¥1958 for the year (pro-rated for the remainder of this year as I’d already paid for 1M). Contract is 3 years with a minimum of 1. I asked what happens if I cancelled it within a year – she said I’d have to go to the store for that (???). She then asked me the name of the landlord (I gave her the surname but only knew the english nickname – “close enough” she said). Then she asked me for the ID card number, which fortunately I had from the lease agreement. And now I will have 2M (and still unlimited) internet in 24 hours :)
I also feel the ripe fool. Why didn’t I do this back in Feb? Old assumptions I guess – no Australian teleco would have let me do what I just did. It seems even the chinese ones don’t – unless you ring the English hotline! We get special treatment (probably because they know if we go to the shop an hour of miscommunication would ensue). how nice…
Hope the contract I agreed to on behalf of someone else wasn’t too onerous… :-/ (shouldn’t be… I think).
