Zero indexed MacBooks handed in silently.

Posted on November 15th, 2006 in General by TheMysteriousX

Coursework was completed, and handed in early. Wonders shall never cease. Wasn’t a rush job either, I shall be very disappointed if I get any less than 95%.

One great thing about computer science is, if you know how, the solution to most problems can be validated very easily. In the context of this coursework, it was just a series of queries to the database. Constructing a sample database took longer than working out what I thought the answer should be, but once it was created all I had to do was input the query, and make sure that it found the values that it was supposed to.

Another piece of work is going not quite so smoothly.

In the world of programming, one defining quality of a language, is how it numbers it’s lists (or, to use tech speak, how it indexes it’s arrays).
Normally, arrays (a list) is zero indexed, meaning that the first item is zero, the second item is one, the third item is 2, and so on.
There are a couple of languages that are one-indexed (visual basic.NET) but by and large, because we want to avoid wasting memory where possible, most languages are zero indexed.

In order to use arrays, they first have to be intiialised. For various reasons, you need to tell the computer how long the list is going to be before you can start using it.

Now, you would think, that arrays would be initialised in the same way that they are indexed, i.e. a zero indexed language would ask for a list that has 10 entries by requesting an array of length 9, and a 1 indexed language would ask for an array of length 10.

Enter C#.

Being a language created by our friend Bill, and his associates at Microsoft, they decided to do something different to everyone else. They decided that they would us zero indexed arrays, but request them in the same way that a 1 indexed language would (i.e. ask for a list of length 10, and reference it as 0-9).

Arf.

Bugs with arrays are brilliant. They can sit there unnoticed for hours and hours. You can even repeat the same bug in, say, 8 different places, and the program will still work.

Array bugs only show up, when you get to the last entry of the array, and try to look for the next one.

Thanks to Microsofts innovations, I now have to find everywhere that the array is used, and correct it’s use of it. Which wouldn’t be so bad if the project wasn’t about 2 and a half thousand lines long.

Still, it could be worse. At least I’m the only one writing the code, so I know roughly where the errors might be.

In other news, several new wireless networks seem to have appeared over the past week, and seem to be causing large amounts of interference. I try to keep the transmitter power on my router low as possible to save power, but it looks like I’ll have to increase it’s power to drown out the noise.

If anyone reading this has a MacBook, and experiences the CPU whine issue, try this: http://www.macupdate.com/info.php/id/22091
It prevents the processor entering C4 mode, which is the one that causes the whine, and actually works.

2 Responses to 'Zero indexed MacBooks handed in silently.'

Subscribe to comments with RSS or TrackBack to 'Zero indexed MacBooks handed in silently.'.

  1. Chippie said,

    on November 15th, 2006 at 2:39 am

    I know this is unoriginal - even for me, but is C4 mode when it turns itself into a bomb?


  2. on November 15th, 2006 at 2:51 am

    C4 processor mode is a power saving state where the processor drops to the lowest clock speed possible, drops the voltage right down to almost nothing, and switches off the L2 and L3 caches, rendering the processor pretty much off (draws 1.8 watts of power tops).

Post a comment