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 other 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

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 with 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 wold create the “life” with its basic attributes and then stick them in with other “life” to compete for food and the like. I think it would be a great project for me since it would involves a few technical challenges I am not sure I have encountered before.

Just an honorable mention of 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).

Force an fsck Check

In order to force an fsck check on reboot simply stick a file in the root of the filesystem you wish checked named forcefsck and reboot. You can use the line touch /forcefsck to create it. If you have the filesystem mounted under another path edit the line accordingly. fsck will automatically remove this file when it is done with it.

If you wish to check a filesystem you can not mount for whatever reason boot into a live-CD (such as Ubuntu) and run fsck /dev/sdXY where X and Y are your device and partition. Assuming the issue is not with your partition table you can use fdisk -l /dev/sdX to help figure out which partition is which.

These commands may require root privileges depending on your distribution.

Apache 2.2 with SSL on Windows

There are a few services I run that I need to access over the web that I do not want anyone watching (phpMyAdmin, for example). The simple solution is to encrypt this traffic with SSL certificates. Here is how I did it on Windows with Apache 2.2:

  • Install the latest Apache 2.2 with OpenSSL: http://httpd.apache.org/download.cgi.
  • Open the Command Prompt and browse to [apache 2.2 path]/bin.
  • Enter openssl req -config ../conf/openssl.cnf -new -out foo.csr -keyout foo.pem. Fill out this information the best you can but you can leave most of it blank. The most notable exceptions are the PEM Pass Phrase fields and the Common Name field (which should be the domain name you will use this certificate on). It is best that you leave the Challenge Password at the end blank.
  • Enter openssl rsa -in foo.pem -out foo.key. You will be asked to reenter the password you entered in the last step.
  • Enter openssl x509 -in foo.csr -out foo.crt -req -signkey foo.key -days 3650. You can replace 3560 with however long you want to certificate to be valid for.
  • You will now wind up with four files: foo.crt, foo.csr, foo.key, and foo.pem. At this point you really only need foo.crt and foo.key and may delete the other two (unless you want to sign more certificates later on).
  • Move your two remaining files somewhere safe (not any place where the web server will be able to serve them to clients).
  • Open [apache 2.2 path]/conf/httpd.conf in your favorite text editor. Uncomment out the line LoadModule ssl_module modules/mod_ssl.so.
  • Open [apache 2.2 path]/conf/extra/httpd-ssl.conf. Uncomment out the line Listen 443.
  • In Windows Explorer browse to [apache 2.2 path]/conf and open up the configuration for the site you want to SSL enable. Make sure you are setup to listen on port 443 if you are running a virtual host. Add the lines SSLEngine on, SSLCertificateFile "[foo.crt path]", and SSLCertificateKeyFile "[foo.key path]".
  • Restart Apache 2.2: net stop apache2.2 and net start apache2.2

Some notes:

  • Certificates can only be used for whole domains or virtual hosts as opposed to a single directory. However with some clever allows, denies, and redirects in your web root you can do just about anything.
  • Only one SSL connection per IP on the same server is allowed. This is by design within SSL.
  • These certificates are self-signed. That means that anyone who views your new secure site will most likely be greeted with a warning they must accept before continuing. You setup the certificates yourself so you know there is nothing fishy going on but they might not know that. If you want to avoid this you will have to put out the cash to Verisign or someone else who can offer the same service.
  • Check out the SSLCipherSuite and SSLCARevocationFile directives (which you will notice are missing in my instructions) to further lock down your site.
  • Remember that if you ever change your certificate in any way the client may need to remove their old certificate before they will be able to view the site again.
  • I generally replace foo with the domain name.
  • Since this was always meant as a quick-and-dirty howto you can find more information at the Apache site.
  • I am running Windows XP SP3, Apache 2.2.14, and the included OpenSSL 0.9.8k.

Manually Empty Linux Swap and Control Linux Swap Usage

I have noticed that the Linux versions of VMware products love their swap usage. I do not know if this is a “fault” of Linux or the VMware software but it annoys and slows me down. After looking around for an elegant solution I just decided to take the brute force method to emptying my swap: running swapoff -a && swapon -a as root (make sure you have enough free RAM to fit the contents of swap).

There is also the option of swappiness included with the 2.6.x kernel. Just edit /etc/sysctl.conf to include the line vm.swappiness=0. Either change the existing value or, if it does not exist, add it (changing this value will require a reboot). vm.swappiness can be between 0 and 100 (inclusive) where 0 will try to never swap anything and 100 will aggressively swap. If you would rather just change the value until next reboot use the line sysctl vm.swappiness=X. You can view the current value with the command cat /proc/sys/vm/swappiness. Ubuntu 10.04, for example, has a default value of 60.