Friday, January 30, 2009

Delphi Object Inspector Tip of the Day

Did you know you can incremental search in the Object Inspector? Focus any item in the object inspector with your mouse or F11, press Tab the cursor will be brought to the name side of the object inspector, start typing, then press Tab again and the cursor will be back on the value side of the Object Inspector. Yeah, it probably should be more obvious.

Working with IStream in Delphi

At some point you might have to work with IStream. They are never fun to work with. Especially since you can't insert into a stream without overwriting. But that's streams.

I like to use the VCL wrappers, TOleStream and TStreamAdapter, and then use TMemoryStream. Use TOleStream to wrapping up an IStream making it look like a TStream and then use TIMemoryStream to make the TMemoryStream look like an IStream again.

Let's say for some reason we get a UTF-8 stream that needs to be saved as a file but it has no BOM. Here's a small example of how to add a BOM to the stream using Delphi:

uses ActiveX, AxCtrls, Classes;

function AddBomToStream(const Stream: IStream): IStream;
Bom: TBytes;
OleStream: TOleStream;
MemoryStream: TMemoryStream;
Temp: Largeint;
if Stream <> nil then
MemoryStream := TMemoryStream.Create;
Bom := TEncoding.UTF8.GetPreamble;
MemoryStream.Write(Bom[0], Length(Bom));
Stream.Seek(0, STREAM_SEEK_SET, Temp);
OleStream := TOleStream.Create(Stream);

MemoryStream.CopyFrom(OleStream, OleStream.Size);
Result := TStreamAdapter.Create(MemoryStream, soOwned) as IStream;

Monday, January 26, 2009

1,474 Megapixel Photo

If the caption of this post interest you then click on to see how David Bergman How Made a 1,474-Megapixel Photo During President Obama's Inaugural Address. It's almost like being there.

Friday, January 23, 2009

Windows 7 Taskbar

The Taskbar in Windows 7 is as revolutionary as the original Taskbar was in Windows 95. Rather than reiterating how it works, ars technica has a good article describing it in detail and in comparing it to the Mac Dock. Although ars claims they are nothing alike, I have to disagree, Microsoft definitely got some ideas from the Dock. Although they may have arrived at the same UI all by themselves if the Mac Dock hadn't existed, the influence is undeniable.

Thursday, January 15, 2009

Silly Windows 7 Mouse Shortcut

I just found out you can shake a window with the mouse and all other windows are minimized. If you shake it again all the other windows come back.

Nice Windows 7 Keyboard Shortcut

Yesterday I discovered on Windows 7 that holding down the windows key and any of the 4 arrow keys will resize the active window between full screen, windowed, minimized and aligned to the left or right of the monitor.

Monday, January 12, 2009

A Quick Look Back at 2008

Last year about this time I posted A Quick Look Back at 2007. I thought it would be fun to look over the Google Analytics data again this year. Here's what we have.

This blog has increased unique readers from over 18,000 to over 36,000. This is amazing!

The traffic sources changed quite a bit:

Referring Sites 61.33%
Direct Traffic 21.72%
Search Engines 16.95%

Referring Sites 45.08%
Direct Traffic 39.40%
Search Engines 15.52%

Clearly the most popular posts were about Delphi 2009 and C++Builder 2009. But,
The Coolest Pull-up Bar has moved up to be my number one post which amazes me.

The top 5 locations are still the same but Russia has moved into the 6th position very close to Canada:

United States
United Kingdom

This year 62 iPhones, 14 iPods, and 4 Sun workstations. No Wii or Playstations. 50% more Macs have visited the site too.

Next year should be even more interesting with an economy fully of ponzi schemes.

Friday, January 9, 2009

The Yellow Line

This is a pretty cool video describing how they get that yellow line for the 1st down on the American football video broadcast.

Does anyone know if the application they are using was written in Delphi?

Windows 7 Beta

Update: At some point after I posted this link Microsoft took down the page and replaced it with "coming soon".

Update: The page to download Windows 7 is up again.

Microsoft just released the public beta of Windows 7 which you can download here. I highly recommend it but remember the beta expires on August 1, 2009.

The download will be an ISO file. If you don't have an ISO burner I have been using Active ISO Burner with good success.

Thursday, January 8, 2009

SubVersion - Keep svn.exe and Tortoise in sync

On the Delphi team we use Subversion. I use svn.exe and Tortoise SVN. Today I found that it's important to keep svn.exe and Tortoise SVN in sync. If they get too far out of sync then the older one will no longer function on the repository due to changes in the local .svn directories . It's easy to keep Tortoise SVN up to date because it tells you there is a later version, but svn.exe just keeps truckin' along until it breaks.

The best place I found to get svn.exe is CollabNet.

Wednesday, January 7, 2009

Windows 7

Figures, I posted this bright and early this morning and before I posted it tweaked the date and set it to 2008. It takes a few weeks every year to get used to that. Now it's 7pm and I just went to balance the checkbook and noticed all January transactions have an 08.

I just installed Windows 7 beta on a fairly fast laptop and wow, I'm impressed with how fast it installed and how much faster it runs than Windows Vista. You can find many of the new features . You can also find out more about Windows 7 by watching the PDC videos here. Warning, the videos skip at times. When it feels like deja vu don't worry, you aren't in the Matrix.