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.