Browsed by
Category: Software Deveolopment

Microsoft Visual Studio C++ 2010

Microsoft Visual Studio C++ 2010

I just built myself a new Windows VM. After I spent the next ~six hours patching and rebooting several thousand times I went to install Microsoft Visual C++ Express. I had not yet had a chance to play with it before today but 2010 has been released into the wild. So I download it and start the installer. To my absolute surprise the bare-bones install is 2.4GBs. Two, point, four gigabytes. Two, point, four gigabytes. I was floored.

I have not been quiet about my great exodus not so much towards Linux but away from Windows. I used to get phone calls every week from family and friends about how their computers were slow, something stopped working out of the blue, or whatever. I have since moved most of them to 100% free software built by the community and have never hear of any problems since. As a matter of fact my father (who requires Windows-based software for work that mandated he stay with Windows) uses my mother’s Ubuntu-based laptop whenever possible because he is absolutely sick of the headaches. This is a man who does not know a mouse from a trackball and given his inexperience even he is sick of the God-damned horror show that is Microsoft Windows.

Any way, back to the point before I wrap up my short rant. I will now move all of my software development over to another operating systems and cross-compile from now on.

Hey, Microsoft. I am disgusted by you. I have a choice and I no longer choose you.

Automatic Games

Automatic Games

I have always loved games that masterba… er, play themselves out. In such games the player sets the initial conditions– perhaps even writes a little code or designs something– and then lets it all hit the fan.

As of late I have been staring at Gratuitous Space Battles. In this one you design a small fleet of space ships, complete with hulls, engines, weapons, shields, and the like, and then set them against waves of enemies. The beauty of the game is no setup will work equally well against every enemy (at least once you are past the first few levels, that is).

This has re-sparked interest in my idea for something I am currently calling Evolution Battle (yes, yes, it is a dumb name). I envision it as SimLife mixed with something similar to Gratuitous Space Battles. Players would create the “life” with its basic attributes and then stick them in the world with other “life” to compete for resources. I think it would be a great project for me since it would involve a few technical challenges I am not sure I have encountered before.

Just an honorable mention for a few of my other favorites: Crazy Machines (a near-clone of The Incredible Machine), the classic Conway’s Game of Life, Robocode, Bloons Tower Defense 3, and Lemmings (sort of).

Developers of Facebook

Developers of Facebook

Facebook maintains a large community developer base. Some of these developers are responsible for the well-off Farmville and the like. If the user base is there so will there be developers with dollar signs in their eyes.

Anyone who likes can view the API for free and start writing code. This availability– plus the large user base– is proving to be a fertile ground for mom ‘n pop-style, web-based applications. Perhaps this is worth a look?

Update 2010.04.10
After spending days researching this I have come to the conclusion that there is virtually no documentation of substance. Even the Facebook-supplied examples do not function as promised. Although there are some great, complex applications out there I do not consider this worth my time right now. My hat (and my pitty) go off to the people who got a job working with these APIs. May your families find another way to eat.

RoboCode Tournament

RoboCode Tournament

I have become very interested in playing with RoboCode as of late. Wikipedia sums it up pretty nicley:

Competitors write software that controls a miniature tank that fights other identically-built (but differently programmed) tanks in a playing field. Robots can move, shoot at each other, scan for each other, and hit the walls (or other robots) if they aren’t careful. Though the idea of this “game” may seem simple, the actual strategy needed to win is not. Good robots can have thousands of lines in their code dedicated to strategy. Some of the more successful robots use techniques such as statistical analysis or attempts at neural networks in their designs.

I do go on with my rants about Java however I have gone as far as proposing an in-house tournament between friends. I have even drawn up game types and rules for this tournament. This could prove to be a great introduction to programming for them and a lot of fun for everyone.

Also I get to crush their robots with great prejudice in robo-combat.

Missing JavaScript Functionality

Missing JavaScript Functionality

JavaScript does not offer a lot of things one would imagine would be included in such a seasoned scripting language. Below are a few functions I wrote to fill some gaps.

Dump variable contents

function var_dump(arr, level) {
if ( !level )
level = 0;

var dumped_text = “”;
var level_padding = “”;
for ( var j = 0; j < = level; j++ ) level_padding += "\t"; if ( typeof(arr) == "object" ) { for ( var item in arr ) { var value = arr[item]; if ( typeof(value) == "object" ) { dumped_text += level_padding + "\"" + item + "\" =>\n”;
dumped_text += var_dump(value, level + 1);
dumped_text += level_padding + “\”” + item + “\” => \”” + value + “\”\n”;
dumped_text = “===>” + arr + “< ===(" + typeof(arr) + ")"; return dumped_text; };

Trimming the whitespace off both sides of a string

function trim(str) {
return str.replace(/^\s\s*/, "").replace(/\s\s*$/, "");

Padding the start of a string

function pad(str, len, padding) {
str += "";

if ( str.length <= len ) {
var str_new = "";
for ( i = 0; i < len – str.length; i++ )
str_new += padding;

return str_new + str;

return str;

Getting the mouse position

function mouse_position() {
if ( document.all && !window.opera )
return [event.clientX + document.documentElement.scrollLeft, event.clientY + document.documentElement.scrollTop];

return [e.pageX, e.pageY];

Getting an elements absolute position

function element_position(element) {
var x = y = 0;

if ( element.offsetParent ) {
x = element.offsetLeft;
y = element.offsetTop;
while ( element = element.offsetParent ) {
x += element.offsetLeft;
y += element.offsetTop;

return [x, y];

All of these were tested in Microsoft Internet Explorer 8, Mozilla FireFox 3.5.8, Google Chrome 5.0.307.9 beta, and Apple Safari 4.0.4.

Please note I have not touched JavaScript in years and I am a bit rusty.

Creating is Hard

Creating is Hard

I was working on a combat-based board game for a number of months. I started off with some ideas I thought were unique and built from there. After a lot of work and begging threatening bribing asking people to help me play test I was slowly forced to either modify or remove my unique ideas (it turns out that it is difficult to be objective in these situations). It became clear that no matter how cool my ideas were they may simply not work. It seems, in retrospect, that these ideas were never all that unique in the first place but were absent from the market place because of the same problems I ran into.

I grew up playing video games a lot more than playing board games. As such while designing board games I brought to the table a lot of odd things; Some were good, some were bad. One of my biggest problem to this day is the limitation of the human brain for computation vs a computer. When I think of the gears of gameplay I think in numbers. Numbers, however useful, are not fun. I need a way to mix these two worlds.

One idea that comes to mind is the web as a gaming platform. I am not necessarily talking about Web 2.0 or AJAX. I am talking about a technology that even mobile phones have access to. The World Wide Web is so ubiquitous and easy to script for that I would be dumb not to at least consider it. A lot of my ideas transfer very well to this platform and I think I may give an old, failed idea a shot in this medium.

Java in the Real World vs in My Head

Java in the Real World vs in My Head

I was never a big fan of Java for a number of reasons; It was always so slow compared to my baby C++. It always generated such huge “binaries” not unlike my very much hated Visual Basic. It has automatic garbage collection while I prefer to retain an anal 100% control over my software.

Time has passed and some things have changed (plus I started using PHP religiously so there goes most of my objections both stated and otherwise). Of course it was sudden by no means and seems more of a “duh” statement that at this point in time Java is everywhere! Hell, most of my mobile devices run on the platform and since I change phones every ~six months so this is an impressive feat.

Should I give Java another look?

Robot Traverses Maze

Robot Traverses Maze

At the Singapore Robotic Games where “automation is a key factor towards advancement… to a technologically sophisticated country” some people have built a maze for robots to run through.

This is very similar to something I had done in high school except my maze and robots were virtual. With the introduction of the LEGO Mindstorms things that were the domain of nerds in academic labs before are now accessible to a wider audience. This audience includes people of a younger age than was commonly seen before. I often wonder what technology that I drooled over a year ago will soon be inexpensive enough for me to buy and screw around with.

2009 Singapore Robotic Games MicroMouse Robot Competition



It is odd I talk nuts and bolts here but here we go.

I have been playing with the idea of a backup file format that can store multiple files from multiple back ups. The biggest up side of this is space; Why backup redundant data? Create some low-overhead method of detecting changes, do the work once, and store it. The biggest down side is that there is no fantastic way to do this without either a ton of disk reads/writes or tons of memory. Since most users do not have 4GBs of RAM but do have a lot of free disk space the answer seems obvious. Of course disk writes are much, much slower than primary storage but there is no other portable solution for the average PC.

Here is the pre-pre-release file format I am currently kicking around:


= Terminology =



Collection of files within a pack-style format.


Files are broken down to chunks of N size and hashed. These hashes are stored and used to determine if a chunk of a file has changed.


= File Format =


String: "npak"

Integer: [Major Version]

Integer: [Minor Version]

Integer: [Chunk Size]

Integer: [Number of Pages]

foreach ( page ) {

Integer: [Page Size]



String: "end npak"


= Page =


String: "start page"

foreach ( file ) {

Integer: [File Name Length]

String: [File Name]

Integer: [Date Created]

Integer: [Date Modified]

Integer: [Date Accessed]

Integer: [File Location]

Integer: [File Length]

foreach ( chunk ) {

Integer: [Chunk Hash]



[File Data]

String: "end page"