Thanks to the second incarnation of the raytracing course in the Uni, I'm having the rare opportunity to experience how it feels to rewrite a modestly-sized (7k sloc) project from scratch. Sounds familiar? Raise your hand, if you, at some point, did have the burning desire to scrap the whole ungodly mess you're currently working on, and restart from Square One. Doing it right™, this time.
Yes, I know. Probably some of you even did that.
Well, it's a known fact, that this could be the worst strategic mistake for any bigger project.
For smaller stuff, it's quite okay though. I feel that we got the sample raytracer a lot better this time. Today, I even decided to compare the global illumination results (with path tracing) against V-Ray (the scene is courtesy of Kevin Beasons's smallpt).
This even poses an opportunity for a small challenge. Can you guess the renderer? V-Ray on top, or the bottom?
Browsing around SmallPT, I stumbled upon something of interest, which made me acknowledge (again) how cool 3D graphics programming could be.
For comparison, imagine you're writing FS stuff. And you've got a bug. What follows next is a kernel panic, reboot, and keeping your fingers crossed that the test partition is not completely invalid, so you can spare the reformat. Oh, and you still have a bug to fix.
Or, you could be writing some web software, and you've got a bug. Three months later, someone figured out how to exploit it, made your site blinking pink, tens of hours of human input are lost, etc. Oh, and you still have a bug to fix.
Or, you could be writing 3D graphics stuff - just went on optimizing some rendering code, which renders the images above. And you've got a bug (you should have seen the trend by now). And the bug manifests itself into this:
The best part is - you can even publish it as is, bugs included.
What else: I'm up for finishing the latest major version of AGG, 0.3.0. After that, I'm going to delve into ucbench and add OpenCL support (which, sadly, this implies a lot of website-related stuff, too).
A wise guy once said, „Assembly language programming is an extravagant waste of human talent and should be avoided whenever possible“.
While the previous week I was playing around with SimNow, ucbench and assembly language for x86, this weekend (partly as a tribute to the recently deceased master, Dennis Ritchie (R.I.P., dmr!)), I went for a higher-level language on a lower-level CPU: C for PIC.
That Peter Norton quote on the top is soooooo true¹, applied to my last PIC project; it is partly finished, but there's still a lot of not-very-hard-but-obtrusively-massive code left to be written. Thus, the mentioned waste comes easily to mind, and the temptation to avoid it is very hard to resist. So, to start clean, I went from scratch, on a new (but easier) project, new breadbord and all. I'm using Hi-tech's C compiler, and this is the first test program that I wrote:
Click (h.264 format - opens fine VLC).
Whether the ways of C could be successfully applied to the "big" project is left to be checked - as even the tiny program on the video utilizes some 10% of the code memory, and also around 10% of the data, too. Yet, there's hope - I wasn't sure I'd have the mental persistence to write that amount of assembly :)
There was a fun moment with the electronics I bought: I needed a good 3.3V low-dropout regulator, and, after some research, I settled on the MCP1703. I bought it along with some other parts, but haven't checked the purchases until I got home. I didn't see the regulator in the bag at first, and thought they must have forgotten to put it. Then... I saw it... It's just unreal: I was expecting something like this, while it turned out like that instead (see the arrow)... You should have seen what's it like to solder pins to that thing! Having completed this feat, I bet I could now solder wires to a grain of sand, too... :)
¹ even though that smart ass didn't write even a single line of anything, except assembly, for the first few versions of Norton Commander :)
Some miscellany, non-serious stuff around programming that recently occurred to me:
First, I got the impression that working as a law maker (or, more accurately, a law maintainer) is not much different than working as a programmer. Both the programmer and the lawmaker have to be very explicit and unambiguous; they are working on laws (directories), consisting of parts (files), filled with articles (classes), constituting of paragraphs (methods). Everything is in strict order. Changes to these laws come (at least in my country) through a state-issued paperwork (called the State Gazette in my case), which explains that law AAA, Part BBB, Article CCC, paragraph DDD, which formerly stated XXX, should now read YYY. Just a plain diff, that is.
So, in spirit of this comparison, here I demand: when will the Bulgarian lawmakers finally put up a Subversion access to all of the Laws, and stop applying patches through the State Gazette? This is so 20th-century...
Anyways, what else... I was pondering through some Linux kernel sources recently, more precisely within intel.c and amd.c... and got just truly convinced that there is nothing hardware-y in these processors anymore. They are full of bugs! So, did you actually think that your $150 you prepared for the shiny-new quadcore CPU pays for the silicium/hafnium in the crystal, or for the gold in the pins (for those of us who actually got pins; Intel owners are exempt from this)? Think again...
And I did some fun coding for valgrind, out of a necessity at work. I'm really glad when I can purposefully use work time to help open source projects like this. I love my job :p
Last moments before the new year. Everyone is gathered around the table, in front of the telly, listening to the wise (hm?) speech of the President. Glasses of champagne in the hand, and some are already slightly drunk...
... but not me. I'm in front of he desktop, the broadband is up and running, but I'm also hooked up through an old 33.6 modem to another ISP. Redundancy, you know? You are never sure, one of the ISPs might freeze up in the worst moment, right? The rest is obvious. Firefox. I'm hitting the Refresh button every five seconds...
The website? Nothing special, C++, Stroustrup, that sort of boring stuff...
Time is ticking away.
... the last seconds they can still publish C++0x in...