January 2006 - Posts
After years of writing my own applications but not releasing any out into the wild, here is a brand new release for your itchy fingers.
Tekapo (named after a beautiful little lakeside town in New Zealand) is a digital photo management utility. It solves the two problems that I have with taking and storing digital photos.
Tekapo is written in C# on the .Net 2.0 framework. You will need to install the 2.0 .Net framework before installing Tekapo.

Download Tekapo 1.0 Beta 1
Tekapo 1.0 Help
If you have any issues with this version, please let me know. I will endeavor to fix any bugs to do a proper 1.0 release in the coming weeks.
I don't yet have an icon that I can use for the application. If you are a graphically talented individual and want to produce a wicked eye-candy icon for Tekapo, please contact me.
Like most things in life, if you haven't needed to do a particular task before, then you probably don't know a lot about it, let alone how to actually do the task.
Today, I felt like a novice programmer. Something very simple, but also simply misunderstood, was causing me grief. The issue was caused by multi-dimensional arrays. I simply haven't had a need for multi-dimensional arrays, probably since uni. To me, multi-dimensional arrays are about relationships between data and that normally screams databases to me, not arrays.
Each time I need to loop though an array, I will loop while the index is less than MyArray.Length. Until today, this has always been fine. Now I have a multi-dimensional array, Length is returning a much larger number than I expected. I initially thought that the Length property was returning the length of the first dimension x the number of dimensions. I thought this because I had a [24, 2] array declaration and Length was returning 48. Logical conclusion right?
No problem I thought. A little messy, but I changed my code to loop while the index was less than (MyArray.Length / MyArray.Rank). This worked a treat until I found a need to change my array declaration from [24, 2] to [24, 3]. Without thinking enough about the change I was assuming that this was now a three dimensional array (yeah, so let's just ignore that little tidbit of information).
Now the code fails again. Because I was incorrect about the number of dimensions, (MyArray.Length / MyArray.Rank) is now producing a result of 36, which errors when I reference index 24 of the first dimension because it only has a length of 24 (23 being the last index).
Knowing that I am obviously making silly beginner mistakes, I read the manual. The Length property actually returns the sum of array entries available across all dimensions. The Rank property returns the number of dimensions. Neither of these properties are what I should be looking at.
The key here is the GetLength function. I originally misunderstood this function to be related to the Length property because I missed the fact that it had a parameter. GetLength is the one to call, passing it the index of the dimension you want to know about. In this case, GetLength(0) would return 24 while GetLength(1) would return 3.
Now in future, my code will be more defensive if I code my loops using MyArray.GetLength(0) instead of MyArray.Length.
Maybe this post should be titled "Arrays 101". Perhaps "Read the manual" would be a better title.
What can I say. Oops. Live and learn...
At the beginning of last year, I came across several peices of signage that I got a good laugh out of. Here is another funny one that we came across in Haast, New Zealand.

For several months at the end of last year, Canberra has received more rain than we have probably seen for years. The whole area has been brown due to a lengthy drought for many years. While most of the surrounding state is still drought declared, Canberra has been able to make something of the rain it has been given.
Unfortunately, Canberra is all brown again. Pity, it was quite beautiful when everything was green.
The first thing I seem to have been bitten by with my adventures into C# from my VB comfort zone is accessing control events from the form designer.
Following my VB instincts, I double click a control to get its default event in the code file, or select an event in the code file that already exists for the control. I go to the top right dropdown list to change to the event I want and.... whoa. This list doesn't display all the possible events for the control. Instead, it displays a list of all the objects, methods, properties and other definitions for the class.
So here is the situation. I have a listbox that I want to wire up dragdrop events for. Is there an easy way to do this with the designer view or the code file view? Perhaps C# people are so keyboard loving that prefer to type in the method declaration and event handler manually?
Probably I am just missing the obvious but it is hard to stop thinking like a beer.
I just came across this post from Eric Gunnerson. I have to say that I haven't heard as much Tripod as I would have liked because I don't listen to Triple J enough. Make You Happy Tonight is damn funny.
I'll let you in on a little secret of mine. I quietly enjoy the VB vs. C# language flame wars.
Mostly I think it is a bit ridiculous how passionately and personally people take this 'mine is better than yours' argument. As I don't take it as a personal argument, I think most peoples behavior in this arena is a lot like a comedy sitcom. You watch it, laugh at it and then change channels.
I have enjoyed working and playing with VB since 1998 (about 1990 if you include a little dabbling in GW Basic). I find VB really easy to read and very forgiving for a typist that doesn't have 100% typing accuracy. Having been often restricted by VB5 and VB6 capabilities compared to C++, I have really enjoyed the advances made in VB.Net.
That being said, as much as I enjoy VB, I have now started to spread my wings into C#. I have been able to follow C# without a problem, but haven't really spent any solid time developing in it. I see this as a disadvantage and probably a hindrance to my career. There is really not much difference between the two, but being fluent in both is a definite advantage.
Now it's out there, all you C# junkies can enjoy this small win in your flame war.
Mitch, stop smiling.
Geoff, stop crying.
Bill, put down that hammer.
but tired after a long days flying and driving...
We have been driving and walking New Zealand for a week and a half now. Seen heaps and done just as much. I'll write about each place we have been soon and put up lots of photos.
Catch ya.