Archive for the ‘Programming’ Category

Yakkerati

Tuesday, April 18th, 2006

The Yakkerati Project is dead…

Matrix Code Screensaver

Friday, March 3rd, 2006

As a big fan of the Matrix trilogy, what better way to entertain myself than write a Matrix Code screensaver for DOS. Yes, for DOS.

Nothing major, the trick is to directly write into the screen buffer. Clutzy, yes, but a good experience.

Download the Matrix Code Screensaver Source Code

Update:
Matrix Code Screensaver v2

Yakkerati

Monday, October 31st, 2005

The Yakkerati Development Blog is live @ http://yakkerati.nirenjan.com/.

Debugging - It’s Really Bugging!!!

Thursday, September 22nd, 2005

Ever notice when your code doesn’t work, you spend a week trying to debug it, trace the problem, bang your head in frustration, veer on the brink of suicide, and finally find out what you think was the problem? You correct it and find out that it still doesn’t work. Go back and repeat, until you find out that it was one teeny tiny stupid mistake in some obscure location in some other module?

QBasic

Wednesday, August 31st, 2005

For those of you who don’t know what QBasic is, then you should do some research before reading this. Just kidding. QBasic is, essentially, Microsoft’s interpreter for the BASIC programming language.

I was digging through my old files today evening when I noticed an archive file titled QBasic. It’s been a very long time since I have programmed in QBasic. The last time I did something like that was about 6-7 years ago.

Digging through the archive, I found some pretty interesting programs that I wrote just for fun way back in ‘97. Just looking at them is a reminder of those glorious days. No design, no documentation, no review, no appraisal, no client visits, no on-site trips, no adherence to quality guidelines, in short, no process to follow :D.

There was one program that pretended to be a dialer, it would print some number on screen and play a tune from the PC speaker. You’d think that it was almost real. Then there was another program which pretended to be a RADAR. Then there were a few programs based on the TV shows of the early 90’s. Most of these programs were written based on my childhood fantasies. They seem almost absurd now, but then again, it’s a kind of window to my past.

I learnt BASIC when I was in the 7th and 8th grade as it was a part of my curriculum. I was so enthusiastic about learning a new language that I bought “Programming in BASIC” by E. Balaguruswamy. This was based on the early BASIC language in general.

After I finished my 10th, I got a new PC - Pentium II 233 MHz, 32 MB RAM, 2.1 GB HDD, 3.5″ floppy drive, 24x CD-ROM, Windows 95. Top of the line back then. (And the same system where the kernel panicked). Anyway, it had Microsoft QBasic installed as well, and I wound up re-learning BASIC all over again. QBasic provided a more structured approach to programming than the old BASICA interpreter did. And then the unexpected happened.

I never thought it would happen really. After a few years of working with BASIC, then Pascal, then back to BASIC, I finally discovered the world of Windows programming with Visual Basic. After I discovered the true power of VB, QBasic took a back-seat and never resurfaced, until now.

Now, however, I prefer programming in C, and my knowledge of QBasic is almost zero. C has the power to do almost anything, something which you cannot even dream of in QBasic. However, QBasic is, and always will be, one of my pet programming environments.

QA C Source Code Analyzer

Saturday, June 4th, 2005

WARNING: This is a technical post…

I don’t know how many of you would have heard of the (in?)famous QAC software program that analyzes your C code for quality. I had the privilege of running it a couple of days ago on a few of the driver modules and among the errors thrown up were a few gems.

  1. C++ Style comments not allowed: OK, I’ll accept that. Some people say that it is preferable to use the standard block comments (/* … */) instead of the single line comments (// …) and I’m not about to counter that.
  2. Conversion between a pointer and integer is implementation defined: This particular error came up more than a few hundred times. The hardware I use contains configuration registers that are memory mapped and so I have to use a pointer to address them. QAC starts complaining… :(
  3. Conditions to be made explicit: In C (or C++), any expression evaluating to a non-zero quantity is treated as true in a condition. Similiarly, a zero value is treated as false. We had made use of this feature more than once, and once again, QAC began to complain…
  4. Every condition should have a block: (OK, this was not the actual text.) What this actually meant was that if I had a single statement to be executed if a particular condition was valid, I still had to enclose it with the curly braces. I’m actually for this kind of coding practice as it helps to trap quite a number of bugs. Where this really threw rocks at me was on a line like this: while (<condition>);. We had a few lines where the software waits for a particular condition to happen (like a register bit getting set or reset). What QAC expected was more of the following:

    while (<condition>)
    {
        ;
    }

This actually sounds crazy to me. I believe that there is no point in putting a null statement within curly braces while waiting. I also think that this kind of a statement would actually hinder the readability.

Now don’t get me wrong. I think QAC is a great tool for quality checks, but then again, some of those warnings can just be ignored…