Friday, June 25, 2010

Life before Interfaces

Way way back this is how IUnknown was defined before Delphi added the interface language feature:

IUnknown = class
public
{ IUnknown }
  function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall; abstract;
  function _AddRef: Integer; virtual; stdcall; abstract;
  function _Release: Integer; virtual; stdcall; abstract;
end;


Here's IUnknown now:
IUnknown = interface
['{00000000-0000-0000-C000-000000000046}']
  function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
  function _AddRef: Integer; stdcall;
  function _Release: Integer; stdcall;
end;

There are so many advantages it's hard to list them all and now we just take them for granted, but here are a few advantages:

  • implement multiple interfaces on the same object
  • compiler support for lifetime management
  • assign an interface to a GUID

Wednesday, June 23, 2010

Eyjafjallajökull Photograph



Lightning streaks across the sky as lava flows from a volcano in Eyjafjallajökull April 17, 2010. Copyright REUTERS/Lucas Jackson

Some amazing photographs have come from the Eyjafjallajökull volcano. The photograph above is one of my favorites so far.
Freezing the volcano’s lightning is the story behind the photograph.

Update: This photograph happens to be in this months National Geographic

Tuesday, June 22, 2010

Cleaning Touch Screens

It's really tough cleaning a touch screen monitor when the computer is on.

Monday, June 21, 2010

Green Screens and Video



This is a pretty interesting video to watch.

Friday, June 18, 2010

Canon G10 Camera

So a while back I sold my trusty Canon G10 camera and actually made money on it. It was a great little camera for what it did well, the problem was I wasn't happy with the things that it didn't do well. I have yet to replace it because I'm happier hanging on to my money with the current set of choices on the market. The Canon G11 or Canon S90 are close but just not quite there. The Panasonic GF1 is real close though. Real close.

Photos come out great with the Canon G10 in good light with subjects that aren't moving fast but I have a short list of complaints:

- Slow autofocus
- Unusable above ISO 200
- Video is terrible

Unfortunately the Canon G11 didn't really solve many of these problems.


Thursday, June 17, 2010

More GetFinalPathNameByHandle

Yesterday I posted about how GetFinalPathNameByHandle is less than ideal. It doesn't work. Well it works in some situations, but it is unusable in a real world situation. The work around is to create a file map to get the file name but that only works if the handle is to a file that is not zero bytes and is not a directory. So for those cases one must use an undesirable function: NTQueryObject. So it works, for now.

Microsoft, please fix GetFinalPathNameByHandle.

Note: I did all my testing on Windows 7. Your milage on Vista may be different.

Wednesday, June 16, 2010

GetFinalPathNameByHandle

Too bad GetFinalPathNameByHandle only works if the handle is a file that has something in it. For a directory or file with zero bytes it fails in a bad way. So you can't get the name of a directory or a zero byte file. Kind of a bummer especially since this is a new to Vista API and would be really nice to have when used in conjunction with CreateSymbolicLink. There are ways of getting around the odd failure by creating a file map, but the directory and zero byte file is a bit more difficult requiring some rather serious hoop jumping.

Tuesday, June 15, 2010

Write Unit Tests

That way, you can program like a monkey until the unit tests pass.

Monday, June 14, 2010

Unicycling Photos

Jump2

I had the fortunate chance to photograph some extreme unicycling recently. The photograph in this post is a composite of four photographs taken at high speed.

Tuesday, May 18, 2010

Unicycle

Back in February I posed about my new toy. I have now been riding it for 3 months in the parking lot, around the neighborhood, commute vehicle, and the most fun, Mountain Unicycling in the Santa Cruz mountains. I've figured out a lot and thought I'd start jotting down some notes to help others out.

Where to buy:

First off I've done most of my unicycle shopping at www.unicycle.com. They have the best selection of unicycles that I've found. I've noticed that the products they list tend to change price and available colors from day to day.

Equipment:

Every product out there has a high end, low end and something in the middle. The High end unicycle is the Kris Holm brand. Those unicycle parts are about as good as you can get. Nimbus is a pretty darn good runner up as the middle road. They are a little heavier but they are very good beginner unicycles and solid as a rock. I wouldn't use anything less than a Nimbus for Mountain Unicycling. I bought a Nimbus 26" MUni Cycle with ISIS hub. I got a 400mm seat post because I'm tall but I replaced it with a 350mm Kris Holm adjustable seat post. The adjustments are key. I got the 150mm Kris Holm cranks which are a standard length for the 24" and 26" unicycles. The 24" unicycle is considered the standard unicycle. It is a little slower than the 26" and a little easier to maneuver. I choose the 26" because it just seems to fit better and I like the ride. The Kris Holm cranks are a lot nicer than the Nimbus cranks but the Nimbus cranks work just fine for a beginner. There wasn't any other choice at unicycle.com when I ordered. A brake isn't worth it until you learn to ride and I didn't get one but I can see it would be really nice to have one when going downhill. But I figure it's a good workout so I won't be getting one any time soon. The most important part of the unicycle is the seat. Nimbus use a Kris Holm plastic seat frame but instead of using a draw string to hold the seat cover on they staple it to the plastic. This means the cover and innards are not replaceable or modifiable. The seat frame also seems to be more U shaped which I don't find very comfortable.

Safety:

The first requirement is to protect your noggin. I first tried my bike helmet but it doesn't protect against falling backwards. Not that I have fallen backwards but the possibility is there. So I bought a nice skateboard helmet. You'll also want to protect your wrists. I suggest a good pair of wrist guards. The best I've found are the Bullet Wrist Guards. I also wear a pair of fingerless gloves to protect my palms. Depending on the kind of riding you do you'll want to protect your shins and knees. At the very least you'll want a good set of shin guards. I have a pair of Kris Holm Percussion Leg Armor which are great but they get very hot and I need to make some adjustments because the XXL are perfect heigh wise but are designed for much larger around legs.

Monday, May 17, 2010

Liquid Mountaineering

I find this too funny to express in words. Just watch it and laugh.

Wednesday, April 28, 2010

May Photo of the Month



Spring is in full swing and here are the dogwoods to prove it.