# Sunday, 28 January 2007

In the context of console gaming, I'm not fanboy. No one console company has a monopoly on my gaming interests. No chance in hell am I going to be a one console person. I go where the games I want to play are.

And right now that means the Xbox 360 and the Nintendo Wii, I'm not giving up one console just because I'm playing another one. I'm just enjoying myself in all the great games I can play, and one day.. with my son.

That said... bias wise I'll always lean towards... Nintendo for giving me the best gaming experience since.... hmmmm... a long long long time ago.

Sunday, 28 January 2007 21:01:31 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [1]  | 

Mmmm... motion controled simplified boxing. Very nice!!

Sunday, 28 January 2007 12:58:15 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Saturday, 27 January 2007

But I'm not in that some minority! :P

Saturday, 27 January 2007 01:48:14 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [1]  | 
# Wednesday, 24 January 2007

7 days ago I was rudely awakened by my wife telling me her stomach was hurting, and she felt like shitting, and my son was born soon after.

Better put some more pictures up now as any good father would do!

It's just so hard to get a good picture..

Stop squirming...

There.. this will do I guess! ;)

And of course.. the coup de grace..

Wednesday, 24 January 2007 22:56:09 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [3]  | 
# Tuesday, 23 January 2007

So.. you've got this cool Pocket PC .Net CF 2.0 application, which reads off a SQL Server Compact Edition database, everything works fine when you're in debugging mode, then as you're testing the app you get the dreaded OutOfMemory exception thrown when you try to open a connection to the database.

You go to the memory app under settings and notice that the Pocket PC only has 1MB of program memory left, obviously it can't load the SQLCE runtime AND do your queries at the same time. You hit the running programs tab and select close all, but you don't expect a user to do that. There must be a better way to do this!

The OS is supposed to close applications in low memory situations, but exactly how low is LOW? Gleamed from the Pocket PC SDK we find this little tidbit:-

The Shell in a Windows Mobile-based Smartphone sends WM_CLOSE messages if there is less than 128 KB of free memory. The shell does not send WM_CLOSE messages if you ask for more memory than is available. For example, the Smartphone does not allocate 200 KB of memory if it only has 190 KB free. Instead, the shell displays an Out Of Memory dialog box to the user.

Wow.. 128KB is what the OS considers to be low... so what can we do about it? Well we call the function which the snippet above was taken from, SHCloseApps. What this API function does is that you pass the amount of memory you want and the OS will keep sending WM_CLOSE messages to applications until the memory requested is achieved. To use the function in your PPC program first you need to declare the P/Invoke in your class (For C# examples.. well start reading the documentation on how to do P/Invokes!)

Public Declare Function SHCloseApps Lib "aygshell" (ByVal MemorySought As Int32) As Boolean

Then when you need to, just call the function with the number of bytes of memory you need.


Simple and gets the job done, before I did this my app kept getting OutOfMemory exceptions (no thanks to the RSSReader, GPS Map program AND Pocket IE) during execution. Now it just works... like it should.

PS. Here's another tip, you might want to use this function if you ever want the user to take a picture with the device's builtin camera, cause they usually need about 1~2MB to take a 1MP picture, so be sure to free up some memory BEFORE you show the picture selector dialog box.

Tuesday, 23 January 2007 00:29:19 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [3]  |