Archive for October, 2009

New home server!

Wednesday, October 28th, 2009

I went and bought a new PC for my home server. The old PC was running 700Mhz P3, 192MB RAM, 20GB IDE hdd. This one is a tad more powerful.

Intel Celeron 430 1.8GHz $80
Kingston 1GB RAM $40
Gigabyte GA-G31M-ES2L mobo $100
2x Western Digital 1TB hard drives $280
Cooler Master Elite 341 w/ 350W PSU $100
  $600

Spent the whole afternoon building and configuring it. Debian was being lame and wouldn’t find a driver for the hardware ethernet port, so I had to find an old PCI ethernet card. Apart from that, everything went pretty smoothly.

I’m mainly using this as a sort of backup/mass storage PC, but since it’s going to be connected to the internet anyway I may as well let it run as my server in place of the old one.

I just got WordPress going, so thought I’d drop a post on my blog before carrying on (should only be samba shares left).

Knapsack problem

Monday, October 19th, 2009

So this morning the first years taking ENGGEN 131 handed in their solutions for a simplified knapsack problem. The story goes like this:

You have some number of boxes of a predetermined size, along with some number of weights, each with its own specific weight value. Your job is to find the best possible packing for the weights into the boxes so that you have a minimum number of unused weights.

I don’t have to take ENGGEN 131, but I decided to take a shot at it anyway.

After several miserable failures with ideas such as packing the boxes one at a time, I arrived at my semi brute force solution involving three (and a half) simple optimisations which can cut the number of combinations to test by quite a large number (eg. 4 billion combinations cut to around 300k).

Source: knapsack.c
Explanation: knapsack.txt

edit:

Also you can flip single line /* */ style comments to // comments while preserving whitespace at the front of the line using VS regex find and replace. Search

^{.*}/\*{.*}\*/.*$

and replace with

\1//\2

office07?

Wednesday, October 14th, 2009

OK, so after all I said about never installing it on my main rig…

I did it.

Happy now, all you .*x fans?