Tips for rusty system builders

As promised.

Your mileage may vary, I give no warranties. For tips that give the colour order of wires, always view the motherboard in the correct orientation; i.e. when facing you, the CPU portion is on the top.

  1. Let the pros handle the difficult parts. I’ve always struggled with the mounting of the heatsink; most of the guys at Sim Lim Square take 15 seconds to mount the CPU, apply the thermal paste and mount the heatsink. Plus the fact that he actually curled up the CPU fan wire nicely so it looks neater.
  2. Mount the replacement rear panel before mounting the motherboard. In my case, the panel is mounted from the inside, so if you’ve done applying the screws to the motherboard, happy unscrewing.
  3. The power cable for floppy drives is plugged in reverse order to hard drives. The red wire is on the outside, whereas for hard drives, the read wire is on the inside. How do you know if the power is on the wrong way? When the drive read/write light is always on.
  4. Purchase a casing with front-mounted USB port wires that come in a bundle. Otherwise you’ll spend time cussing when plugging in four wires per connector, each of which is insy-weensy. For my case, the wires come unbundled, and from left to right: red yellow green black. Repeat as required.
  5. The mainboard manual is your best friend. Read it like the Bible, especially the “system panel connectors” part. This tells you how to fix up the hard drive/power LEDs, reset/power switches. If your Bible is too thin, consider another manufacturer.
  6. System connectors come in two or three pin bundles. The coloured bundle is always on the left; e.g. orange white or red white.
  7. Purchase DDR/DDR2 memory modules in pairs. So you get dual channel (fast) as opposed to single channel (slower). Get ones that are the same size (e.g. 512MB). Most modern motherboards have 4 slots for memory, and they look like (red) (black) (red) (black). If you have 2x 512MB, fix ’em in slots of the same color; e.g. black black or red red.

New computer

I went to Sim Lim Square/Laser last night with the intention of purchasing some parts for a destroyed computer. Basically the power supply fried everything except the memory, sound card, floppy(!) drive and the cd burner. I think the graphics card, a beautiful Radeon 8600 was fried too, but I couldn’t confirm cos I had no AGP slot for testing. I had purchased a new power supply and a 200GB harddrive in the hope that the system was undamaged, but to no avail.

So off to shopping:

  1. CPU: A recent Intel Dual Core processor, something like the E4300, which my in-the-know friend, has advised to be “fastttttt”. This should cost something like (SGD) $250.
  2. Mainboard: Asus/Gigabyte/MSI LGA 775 (compatible with the CPU, of course). About $110.
  3. Memory: 1x 512MB Kingston KVR (DDR400). $80 max.

The total is estimated to be $440, which is decent since we’re reusing some parts. I was looking for a DDR system — as opposed to DDR2 — since I already had some memory to begin. I was also looking for a mainboard with a AGP slot although I know that’s becoming really rare nowadays.

When I finally arrived at the shop it was 8pm+. Shops at Sim Lim close soon after that. So I was in a big rush, having delayed my attempts to troubleshoot the entire system for 3(!) months.

In the end I was convinced to purchase:

  1. CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 3600+
  2. Mainboard: nVidia GeForce 6150 rev. A2.
  3. Memory: 2x 512MB Kingston KVR (DDR2 533).

The total price was $342 $372, so in the end I had a slower system for a significantly lower price. Yeah OK so it’s a different processor/mainboard altogether, no graphics card and faster memory, that’s all. Hehe

I considered getting some decent, mid-ranged graphics card as well, but for now, the built-in graphics will do. Oh! And it has VGA/DVI connectors! Nice.

Currently blogging using the system so as to test for stability. After all, you have to eat your own dog food. And its great, the noise level is almost zero, can you believe it?!? This is compared to my own Opteron 144, which is like, thrice as loud.

CodeIgniter: Smarty as a full-fledged template engine


I’m a newly converted fan of the CodeIgniter (CI) framework for PHP. I was introduced to it a few weeks back, and there’s been no looking back. PHP has suffered much critique of late here, here and here, but if there’s a star example of beautiful PHP code, here’s it. It helps developers write code better, period.

I really like the many libraries and helpers available, they make the many tiresome things (forms, pagination, input validation) that are rehashed every time a new web application is written a joy, since this is all done for you already. Not that I would recommend someone new to web development to CI, since I’m an advocate of the fact that you must go through some pain to appreciate the beauty in things. But then I digress.

I’m not so keen about the template parsing part though. I had almost expected something like Smarty, but guess I was spoilt. I felt that mixing PHP/HTML syntax was simply… ugly. Tsk, tsk. The user guide indicates that it was an intentional decision to not include a full-blown templating solution, and I think CI suffers for that fact.

So… why not combine CI and Smarty? Note that this is not a CI or Smarty tutorial, if you need help on those things, read the manual! :) According to CI convention, I’ve put the Smarty source code into the libraries folder. Since there are quite a number files, I put it in a subfolder “smarty”, so the path to Smarty is:


Now, we need to extend the Smarty (we’ll call it smarty_library), the code which we stored as:


There are plenty of Smarty configurations to play around with, but we’ll stick to just two (template_dir and compile_dir). Using absolute paths help prevent those pesky “template not found” errors.


		// absolute path prevents 'template not found' errors
		$this->template_dir = '/path/to/CodeIgniter/system/application/views/'; // use CI's views folder
		$this->compile_dir = '/path/to/CodeIgniter/system/cache/'; //use CI's cache folder -- chmod 777 cache required

		// URL helper required
		$this->assign('site_url', site_url()); // so we can get the full path to CI easily
} // END class smarty_library

Now that this is done, you can put the library load call in your CI application as:

$this->load->library('smarty_library', 'smarty');

Access your Smarty object at:

$this->smarty->assign('foo', $foo);

Please drop comments! I’d love to hear from other like-minded developers! :)