Sunday, January 30, 2005


I took this picture of a "pirate ship" while holidaying in Cape Town, South Africa. We went on a sailboat ride and I saw this ship in the distance. Booking a ride on this "pirate ship" costs about $40. Posted by Hello

Saturday, January 29, 2005


But the way of the upright is like the light of early morning, getting brighter and brighter till the full day.
Proverbs 4:18 Posted by Hello

Some invaluable utilities every .Net programmer should have

During my time as a C# programmer I have come across the following useful .Net utilities:
(I am a C# programmer so most of the tools would be geared towards programming in C#)

The first thing you need as a .Net programmer is the .Net Framework 1.1 SDK, which you can download for free from Microsoft. This includes the free .Net compiler and other useful tools.
Have a look at: http://msdn.microsoft.com/netframework/
You can download the SDK at
.NET Framework SDK Version 1.1

Probably the most often used tool during programming is the IDE and compiler you use.

IDEs + Compilers:
- I prefer using the Microsoft Development Environment 2003 / Microsoft Visual C# .Net. It has excellent features for development.

- You can also use the COMPLETELY FREE SharpDevelop IDE at www.icsharpcode.net. It can import Microsoft IDE projects.

-Also have a look at CodeSmith, in which you can create code templates to quickly create code for you.
Find it at http://www.ericjsmith.net/codesmith/

Class browsers + decompilers:
- You just HAVE to get the free class browser and .Net decompiler Reflector written by Lutz Roeder at http://www.aisto.com/roeder/dotnet. It can decompile any .Net Assembly to IL (Intermediate language), C#, Visual Basic .Net or Delphi .Net. You can browse the assembly class methods and follow the calls through the call hierarchy as a call or callee graph. This is helpful if you for instance want to know where a certain assembly's class method is used in other assemblies.
He also has a free resource browser and a HTML WYSIWYG editor called WRITER.

- In order to decompile Java .class files (for possible migration to .Net) you can use Atanas Neshkov's DJ Java Decompiler. When I want to migrate an app from Java to .Net I usually decompile the class files using this tool and then use the Java code either directly as C# (since there is much similarity between C# and Java) or you can first compile it using Visual J# and then decompile it to C# using Reflector. Get is at http://members.fortunecity.com/neshkov/dj.html


File comparison Utilities:
- You definitely need Windiff.exe. It is part of the Microsoft Platform SDK available from Microsoft. or look for Windiff.exe on the net

- Another cool source code comparison program is Winmerge.exe. It allows you to selectively choose which part of the code in 2 files you want to merge. Get it at: http://winmerge.sourceforge.net

Both of the above can also compare entire directory paths.


Debugging tools:
- You just have to get the "Debugging tools for Windows" from Microsoft at http://www.microsoft.com/ddk/debugging/. It comes with a debugging extension called SOS (Son of Strike) which can be used to get the method call stack trace from any running .Net assembly (even Release built) and find out exactly in what class method your program is stuck. You attack to any .Net process and you can see all the system threads, .Net managed threads and class and method names. You can also get a heap dump and browse through all the objects on the heap. Run WinDbg.exe. Simply attach to the process. Type .load sos. And then !clrstack : to obtain the common language runtime stack of the thread you picked. (You must have sos.dll in the same directory as WinDbg.exe) . You can also get another version of sos.dll called psscor.dll, which also provide CLR debugging support.
Here is a list of URLs where you can get help on CLR runtime debugging:
A word for WinDbg
Bugslayer SOS It's Not Just an ABBA Song Anymore -- MSDN Magazine, June 2003
Getting proper Stack information from memory dump
More on debugging with SOS.DLL - enter Visual Studio
SOS - Now with 20% More Commands!
SOS Debugging with the CLR
SOS Debugging of the CLR, Part 1
Traversing the gc heap (and introducing PSSCOR.DLL)
You can even set up a symbol path and point it to Microsoft and this app will automatically download all the non-.Net debugging symbols
Simply set:
_NT_SYMBOL_PATH=
SRV*C:\Home\Tools\Development\Debugging Tools for Windows\LocalSymbolCache*http://msdl.microsoft.com/download/symbols
Speed and Memory allocation profilers:
- When you simply have to find that resource leak have a look at this freeware memory profiler:ALLOCATIONPROFILER.EXE which can be found at - http://www.gotdotnet.com
- If your program is stuck in a loop or if you want to find out which method in your app consumes the most of your process time, have a look at NPROF at http://nprof.sourceforge.net/. It launches your app and monitors all method calls allowing you to see exactly what % of time is spent in each class' method.

Windows System tools:
When your apps are misbehaving you must definitely get some of these apps from www.sysinternals.com:
PROCEXP.EXE Process explorer - can show you exactly which processes are running, what thread is taking all your CPU time and then you can match the thread ID up to the threads in WinDbg to see in which method it is looping. You can also see exactly how much memory is in the GC1, GC2 and GC3 garbage collector heaps if you are suspecting a memory leak...Yes a memory leak in .Net
TCPVIEW.EXE Shows you what tcp connections are connected and what processes are listening on ports on your PC
FILEMON.EXE Lets you monitor all file accesses and filter according to process - showing you where apps are trying to hide files on your computer
REGMON.EXE Lets you monitor all registry reads and writes and you can also filter on processes

SPYXX.exe is an app which is part of the Microsoft Platform SDK and it allows you to determine all the windows and windows handles and you can intercept all the windows messages sent to each and every window....very handy in debugging custom controls.
DEPENDS.EXE (Microsoft Dependency walker) is an app which is part of the Microsoft Platform SDK and shows you all the DLL dependencies of an application. You can even see which functions/procs are called in the DLL from the app in question.


Get yourself the above tools. It will open up your knowledge of .Net programming.

Friday, January 28, 2005

My humble beginnings as a programmer

I am a programmer at heart. Been doing it for 21 years now. Programming has really become exciting with the emergence of object oriented languages such as C++, C# and Java.

Let me try and remember the encounters I had with computers and programming languages... A long time ago in a galaxy not far away, a small boy of about 8 years or so got introduced to gaming consoles such as the ATARI with its ping pong paddles. There was also a PHILLIPS console on which we played things such as breakout. You connected it to the TV to the irritation of everyone else in the house.
It was also about the same time when I had the first glimpse of the APPLE II computer. I remember how I liked the way it had a built in screen. Any cursor movement on those ancient CRT screens caused a trail where the characters used to be a few seconds before. It was on the APPLE II where I played my very first game of space invaders. We did not own a computer then, but it was at a family friend's house where I got the opportunity to venture into this strange unknown world of computers. I was intrigued by the possibility of being able to tell a machine (in its own language) what I wanted it to do for me. As a captain would order his subjects to turn the sails on a vast ocean of possibilities...
A little bit later my cousin got a Commodore VIC20. You could at that stage slot in different game cartridges at the back and I remember we played a cat and mouse game for hours, enchanted by the ability to control something in another world. A little bit later, when I was in 5th grade my father bought me a Commodore C64, which probably changed my life and altered the course of my life forever. I studied its handbook intently and started to write my first computer programs. I remember coming home from school and wondering how I could write a program to do stuff for me. Programming ont the Commodore 64 was done in BASIC and any program had to be less than about 48 or 40 kilobytes in size (can't remember). Back then I used the GOTO statement a lot and any program I wrote quickly became spagetty code when it passed a certain line number limit. I remember my very first program: it asked you a number of questions concerning some animal or insect and then tried to classify it according to the answers given...does the animal have an endoskeleton or exoskeleton? How many legs does it have? Does it have wings? And eventually it would classify the animal as Crustacea/Mammal/Arachnida etc. That was my first program in 5'th grade...a feat I no doubt know would be easy for any 2'nd grader now a days.

The notion that I could teach a computer to think for me, facinated me. I learned about sprites (movable 4 colour GIFs) which I entered as bytes from sheets and sheets of paper where I plotted the bits/pixels on. Later when I figured out how to used speech synthesis, I wrote a program I called COMPUBANK, to which I could give any one of hundreds (and later thousands) of text phrases or commands and the computer would give me a verbal answer....my first attempt at artificial intelligence. I had a school friend which shared my interest and together we ventured into the area of ASSEMBLY LANGUAGE programming. We learned about INTERRUPTS and wrote ourselves assembly language routines to to smooth scrolling by shifting one of 2 screens down 7 pixels by POKING values into a certain memory location. The data on the second screen would then be copied a full line (consisting of 8 pixels high characters) and we would obtain smooth scrolling by quickly swapping the 2 screens. In so doing we could get smooth downward scrolling using this screen buffering technique. I wrote some games for the fun and challenge of it all...Text Adventure games,Poleconomy, Battle Tanks, my own space invaders. We explored the SID (Sound Interface Device) chip on the C64, we also programmed in Simon's Basic, which was mapped into the address space of the computer by inserting a cartridge at the back. I remember learning about graphics from "Computer Graphics on the C64" and drew spirals on the screen which took an entire night to complete.

As time went on, my Commodore 64 gave up the smoke (ghost) and my father bought us an IBM Compatible XT computer on which we installed MS DOS. It had a 20 Meg hard disk and a 360 K floppy disk and it could only display 4 colours (cyan,magenta, black and white) in 320 x 200 resolution and 2 colours in "high resolution" (640x400). To me it was slower than my Commodore 64, and I missed it a bit. But, I got used to working on this new machine and eventually programmed in GWBASIC. I wrote a PC version of Poleconomy. You only had 640K RAM to play with even though your computer had 4096K RAM on it, a limitation forced on it by DOS. Later when I got Windows 3.1, the computer got even slower!! But at least I could access more that 640K of RAM using Win32S. I started learning Borland Turbo Pascal in 9'th grade and was venturing into the area of object oriented programming.

I suppose you could classify my as a NERD back then, but it did not really bother me. I got something I was really good at and it gave me a deep sense of accomplishment...I became to believe that nothing is impossible...I believed I could write a program to do anything for me. It gave me courage. I have always LOVED mathematics, a novel solution looked beautiful to me. I think ALGEBRA in particular is the language of computers. And that it probably why I loved programming so much.

After school I studied electronic engineering, since it provided me with the best opportunity to satisfy my curiosity into new things. I started to learn the C programming language. The syntax was a bit cryptic at first, but after a while it became second nature. We used Borland Turbo C. We had to write programs for Physics, Dynamics, Electromagnetism, Digital Signal processing, Mobile communication, Telecommunications, you name it. I also used Watcom C++ and Borland Turbo C++. I still enjoyed programming.

After my studies I started on Windows 95 and NT 4. We programmed in Visual Basic 5 then 6. Later also Visual C++. One day I decided it was time for a challenge and taught myself Java. I love the language....it has the syntax of C++, but were much more logical, much easier to work with....and then came C#. What a nice language. As in Java it had a lot of pre-written Collection classes such as Arrays, Hashtables, Lists (not that C++ did not have, but the standard template library does not have the same ease of use as Java and C#). Well that's where I am today....an avid .Net Programmer.

Wednesday, January 26, 2005

We, like mussels tend to clump together


A still life of a bunch of blue mussels clumped together on a rock at Scarborough near Cape Point, South Africa Posted by Hello

It is difficult for a human to exist alone. All of us has that empty space we want to fill with the love and acceptance from people around us. From childhood we have that yearning for someone special, someone who can share our life's greatest moments with us. Someone to make everything seem worthwhile. When we find that person, or a person sufficiently like that one, and if we are blessed someone who feels the same about us. Then we start the journey with them. They grow on us like moss. Like mussels they attach themselves to us until any separation causes pieces of us to be ripped off in trying to remove them. We try to share our deepest thoughts and wonderings with them. We are not so sure about life and ourselves as we pretend to the world outside. Only to our closest family and friends do we reveal our true self, our true fears. And yet...sometimes we can still feel alone. Does anybody really understand us? Do they really know the effect life has on us? Maybe not, but we stick together. We stand up for each other, we clump together...

Tuesday, January 25, 2005


I love sunsets. Here is one we took out of the car as we were driving towards Cape Town. You can see Table mountain far off in the distance. Posted by Hello

Monday, January 24, 2005

The focal distance of the Kodak DX6490

I like to measure things in order to provde me with more info which the casual observer normally do not find out. I recently wondered about how close I have to be with my camera to photographic subjects to render these subjects a certain size in the photo.

I started off by sticking a ruler onto a poster onto which I glued pages from a magazine. The purpose of this was to provide the Kodak DX6490 digital camera something to focus on. I was going to determine what the closest and farthest distances were where the camera's autofocus would still work, (resulting in a green indicator in the LCD).

I wanted to measure the range of distances where I could get sharply focused images, and also determine what subject height would fill the vertical frame in the photo. When you know your camera, it makes it easier to decide how far to stand from a subject to get a specific subject height in the photo.

I put the DX6490 on its highest megapixel value, which is 4MP resulting in images of
2304 x 1728 pixels.

Accoring to the user manual the camera has the following focal distances for the 2 different modes:

Normal:
------
Wide angle : Focus Range S = 60 cm - Infinity
Telephoto : Focus Range S = 2 m - Infinity

Macro:
-----
Wide angle : Focus Range S = 12 cm - 70 cm
Telephoto : Focus Range S = 1.2 m - 2.1 m

Where
Wide angle = 38 mm (35mm equivalent focal length)
Telephoto = 380 mm

This means that by switching the camera first in Macro mode and then in Normal mode, you would be able to focus on subjects anything from 12 cm up to Infinity.
You can then display the range as follows:

Range:

12cm-----70cm (Macro,wide angle)

60cm-------------------------> Inf (Normal,wide angle)

1.2m-----2.1m (Macro,telephoto)

2m
--------> Inf (Normal,telephoto)

The problem is that you cannot easily determine the opposite: In order to render a subject with a specific height a certain size on the photo, what the zoom/focal length must be.

In my measurments I would start off with the Wide Angle setting of 38mm of the DX6490 and then increase it to about 1/3, 1/5, 2/3 and 3/3 the distance to the Telephoto setting of 380 mm. Unfortunately the DX6490 does not show you the 35mm effective focal length in the LCD. Im sure that I am not alone in wishing they had put it in.

At each of these focal lengths I would then determine for the Normal and Macro setting what the approximate closest and farthest distances are where the Auto Focus would focus on the subject, which was in this case the poster.

I would make a not of all the pictures I take and also use the EXIF info to match up the image with the distance I measured to the front of the camera's lens. From the image I could then determine the real world vertical distance/height of the 1728 pixel photo.

Here follows my measurements:


At 1728 pixels vertical image size we get:



Normal:

------

Wide Angle:
f = 38 mm effective/6.32 mm
Closest distance: (which camera can focus)
d = 23.6 cm (from front of camera)
h = 180 mm (96 pixels/cm)
Farthest distance:
d = Infinite

1/3 from Wide Angle (approx):
f = 139 mm eff
Closest distance:
d = 44 cm
h = 102 mm (169 pixels/cm)
Farthest distance:
d = Infinite

2/3 from Wide Angle(approx):
f = 268 mm eff
Closest distance:
d = 103 cm
h = 118 mm (146 pixels/cm)
Farthest distance:
d = Infinite


Telephoto:
f = 380 mm effective
Closest distance:
d = 121 cm
h = 112 mm (154 pixels/cm)
Farthest distance:
d = Infinite


Macro:
------
Wide Angle:
f = 38 mm effective/6.32 mm
Closest distance: (which camera can focus)
d = 4.5 cm
h = 51 mm (339 pixels/cm)
Not Farthest distance:
d = 151cm
h = 1047 mm (17 pixels/cm)
Farthest distance: ??
d = 8.3 m
h = 5.6 m (3 pixels/cm)

1/3 from Wide Angle(approx):
f = 139 mm eff
Closest distance:
d = 38 cm
h = 89 mm (194 pixels/cm)
Not Farthest distance:
d = 155 cm
h = 306 mm (57 pixels/cm)

1/2 from Wide Angle(approx):
f = 209 mm eff
Closest distance:
d = 65 cm
h = 99 mm (175 pixels/cm)
Not Farthest distance:
d = 155 cm
h = 216 mm (80 pixels/cm)

2/3 from Wide Angle(approx):
f = 268 mm eff
Closest distance:
d = 78 cm
h = 91 mm (190 pixels/cm)
Not Farthest distance:
d = 167 cm
h = 177 mm (98 pixels/cm)

Telephoto:
f = 380 mm effective
Closest distance:
d = 79 cm
h = 78 mm (222 pixels/cm)
Not Farthest distance:
d = 167 cm
h = 148 mm (117 pixels/cm)
Farthest distance:
d = 175 cm
h = 109 mm (159 pixels/cm)

Here follows a summary of the above info:
----------------------------------------
where d=distance to subject from front of lens

Normal:
------
f = 38 mm eff
Closest distance: d = 23.6 cm (96 pixels/cm) 18 cm subject
Farthest distance:d = Infinite (<0 pixels/cm)


f = 139 mm eff
Closest distance: d = 44 cm (169 pixels/cm) 10.2 cm subject
Farthest distance:d = Infinite (<0 pixels/cm)


f = 268 mm eff
Closest distance: d = 103 cm (146 pixels/cm) 11.8 cm subject
Farthest distance:d = Infinite (<0 pixels/cm)


f = 380 mm eff
Closest distance: d = 121 cm (154 pixels/cm) 11.2 cm subject
Farthest distance:d = Infinite (<0 pixels/cm)


Macro:
------
f = 38 mm eff
Closest distance: d = 4.5 cm (339 pixels/cm) 5.1 cm subject
Not Farthest : d = 151 cm (17 pixels/cm) 104.7cm subject
Farthest : d = 8.3 m (3 pixels/cm) 560 cm subject

f = 139 mm eff
Closest distance: d = 38 cm (194 pixels/cm) 8.9 cm subject
Not Farthest : d = 155 cm (57 pixels/cm) 30.6 cm subject

f = 209 mm eff
Closest distance: d = 65 cm (175 pixels/cm) 9.9 cm subject
Not Farthest : d = 155 cm (80 pixels/cm) 21.6 cm subject

f = 268 mm eff
Closest distance: d = 78 cm (190 pixels/cm) 9.1 cm subject
Not Farthest : d = 167 cm (98 pixels/cm) 17.7 cm subject

f = 380 mm eff
Closest distance: d = 79 cm (222 pixels/cm) 7.8 cm subject
Not Farthest : d = 167 cm (117 pixels/cm) 14.8 cm subject
Farthest distance:d = 175 cm (159 pixels/cm) 10.9 cm subject

Reverse info:
s = Subject size to fill height of photo
d = distance from front of lens
f = focal length (effective)

s d f Macro
--- --- --- -----
5.1cm 4.5cm 38 mm yes wide
7.8cm 79cm 380mm yes tele
8.9cm 38cm 139mm yes 1/3
9.1cm 78cm 268mm yes 2/3
9.9cm 65cm 209mm yes 1/2
10.2cm 44cm 139mm no 1/3
10.9cm 175cm 380mm yes tele
11.2cm 121cm 380mm no tele
11.8cm 103cm 268mm no 2/3
14.8cm 167cm 380mm yes tele
17.7cm 167cm 268mm yes 2/3
18 cm 23.6cm 38mm no wide
21.6cm 155cm 209mm yes 1/2
30.6cm 155cm 139mm yes 1/3
104.7cm 151cm 38mm yes wide
560 cm 8.3m 38mm yes wide

It is supposed to be governed by the formula:
(but this approximation does not hold for multiple lens elements)

f = v * d / h

where v is the vertical size of the image on the CCD
h is the vertical field of view in the subject plane
d is the distance from the (thin lens approximation) lens element
f is the (thin lens aproximation) 35mm effctive focal length


I have been able to figure out that the DX6490 has the following:

Focal Length Multiplier = FLM = 380/63.2 = 38/6.32 = 6.01266...
and
FLM = 43.3mm (diagonal) / sensor diag = 6.01266
where 43.3 mm is the size of 35mm film

This means that the DX6490 must have a
Sensor diag = 7.201471 mm
this means that:
x^2 + y^2 = 7.201471^2

with an aspect ratio of: 4/3
x = (4/3)y

Solving the equations gives:
y = 4.32088 mm
x = 5.761177 mm
for the sensor.

This will result in a physical resoltion for the CCD sensor of:
x res = 2304/5.761177 = 400 pixels/mm
y res = 1728/4.32088 = 400 pixels/mm

The Kodak DX6490 therefore has a CCD image resolution of 400 pixels per millimeter or
400 x 400 = 160 000 pixels per square millimeter.

I have also determined that if the 2.2 inch LCD (which is actually 2.165 inch) has 153000 pixels, then 153000/(4/3) = y^2
y=338 pixels
x=451 pixels
451 x 338 pixels

I hope this helps someone out there. Please give me some comments.
























A beautiful panoramic view of the mountains above Stellenbosch in the Western Cape of South Africa. I created the picture by stitching together a bunch of pictures I took with my DX6490. Posted by Hello

I recently visited Cape Town, South Africa. Described by Sir Francis Drake in 1580 as "The most stately thing and the fairest Cape we saw in the whole circumference of the earth." It is a beautiful place to visit. You have everything: beautiful beaches, majestic mountains, scenic drives high above the cliffs next to the sea, nature hikes and the list goes on and on.

We even went for a hike up Table Mountain. The views are breathtaking. Even the winelands in the "Boland" near Stellenbosch has very much to offer. Needless to say we enjoyed it very much.

Have a look at http://www.tourismcapetown.co.za/

Saturday, January 22, 2005


I took this beautiful picture of a waterfall while hiking at the 'Slagthoek' hiking trail near Middleburg in the Mpumalanga province of South Africa. Nature hiking gives me all those unique opportunities to see and photograph places which I would have never seen had I not ventured out of the city. Posted by Hello

Gone iceskating

GONE ICESKATING TODAY..ENJOYED IT VERY MUCH

Friday, January 21, 2005


Believe it or not, this is a picture of a moonrise over the sea which I took after sunset by keeping the shutter open for a few seconds. The picture was taken facing east after the sun had already set in the west. It is one of my most beautiful pictures. Posted by Hello

Nothing like a cosy campfire to warm the winter nights Posted by Hello

I love nature hiking since it gives me the opportunity to do the thing I love ant that is taking pictures of beautiful landscapes. We normally do this with friends on weekends. Mostly 2 day hikes where we stay over at a base camp. We go hiking in the day and in the evenings we make a big campfire and bathe in the heat and ever changing form of the fire.

Then I get time to think. I think about life, my life destiny and the way I'm living my life. Who in my life is most important to me. A time of quietness after the busy hustle and bustle of everyday life. I sometimes wonder why life can get so monotonous. So routine, so void of excitement. As a child you would grow up with the wonder of anticipation, not knowing what will await you later in life. Almost like waiting to open presents at Chistmas. Then when you get there (grow up, get a job etc), you suddenly get very disillusioned...Is this all there is to life? What has happened to all my childhood dreams of accomplishing something great in my life? You also do not find a complete fulfilling for the loneliness, the hunger...

You live for the people around you. When I come home in the late afternoons 17h00 and my daughter comes running to the gate, VERY excited to see me after a long day of work...I find a reason for living. I love my family. My wife, my boy and my daughter. They provide me with endless pleasure. Times of laughter, times of happiness and the knowing that I am here for them...

Wednesday, January 19, 2005


During a recent hike we came across this 'Bloukop-koggelmander' (blue head agama lizard). I could catch it sitting still for a few seconds allowing me to capture this beautiful picture with my DX6490. Posted by Hello

Here is another one taken with the Pentax Spotmatic using a very small depth of field
 Posted by Hello

In the future I will be sharing a lot of the pictures I have taken of flowers. Here is a picture of a Barberton Daisy taken with my DX6490  Posted by Hello

This is a photo which I took of the moon one evening using a Pentax Spotmatic camera fitted with a 400mm yashika telephoto lens and a 3x teleconverter (resulting in an effective focal length of 1200mm). I then cropped the image so that the moon fills the frame. Posted by Hello

My Kodak DX6490 digital camera

I recently bought myself a new digital camera. This is not the first tie I've ventured into the digital domain. I had an old 1 Megapixel camera. But it was time for a proper one. So I shopper around and eventually decided on the Kodak DX6490. This is a very nice camera to have. I used to take all my pictures with my Pentax Spotmatic (which I loaned from my father).

I always liked having complete control over the exposure and this digital camera gives it. I have taken over 2500 photos in the 4 months I have had this camera. I am not a bit disappointed in the results. It is a 4MP camera, which is quite adequate for my purposes (it gives 300 dpi prints of A4 size).

The lens is awesome, giving me a zoom from 38mm to 380mm equivalent, which will be hard to find with a conventional SLR.

I love taking photos of flowers. In my garden and on hiking trips.

Where my interest in photography started

I have been photographing things for a long time. It started at an early age. I share this interest with my father. He used to experiment with slides, B&W photos, 8mm and 16mm movies etc. I love to use photos as visual memory aids. It helps me to remember my past. Who I am. What has happened to me. My history defines me.