Thursday, May 31, 2007

Applications Running on My Computer

Yesterday I was asked by a coworker about one of the applications that I had running so I thought I'd make a list of applications that I frequently use for programming (in no particular order):

For non-development related tasks such as communication, music and web browsing I regularly use: What applications do you use? Are there better applications out there that I'm missing out on? I hate Outlook (and I hate using the word hate) but last time I used Thunderbird, the CodeGear IMAP server left something to be desired. Update: 11-19-2010 Late last year I switched to using Take Command Console LE.

Wednesday, May 30, 2007

Software Engineer: Still the Best Job in America?



This article from Money Magazine last year suggest that Software Engineer is the best job in America! I wonder if this is still the case because it doesn't seem like much has changed in the last year.


"Software engineers are needed in virtually every part of the economy, making this one of the fastest-growing job titles in the U.S. Even so, it's not for everybody.

Designing, developing and testing computer programs requires some pretty advanced math skills and creative problem-solving ability. If you've got them, though, you can work and live where you want: Telecommuting is quickly becoming widespread.

The profession skews young -- the up-all-night-coding thing gets tired -- but consulting and management positions aren't hard to come by once you're experienced."



Salary.com has an interesting bell shapped curve (see above) that shows a variety of figures of an entry level software engineer. Visting the site you can adjust your grade and input your zip code to figure out where you fit in.

It may even get better for telecommuters. The other day I came across the recently introduced Parents' Tax Relief Act of 2007. This suggests a vastly simplified home office deduction ($2,500 or the profit from the home - based business, whichever is less) and a telecommuting tax credit for employers of up to $2,400 per telecommuter. In addition, employers that provide telecommuters with computers and broadband access equipment can write off the expense. If it passes, this bill may make telecommuting more attractive to employers.

The only thing I'd say that sucks about being a software engineer is the 'occasional' long hours and the stress that comes around release time. What do you think, is it the "best job in America?"

Friday, May 25, 2007

What do you Want to Know?



I have plenty of topics to blog about, but I thought I'd take a moment to ask the readers of this blog if there are any questions that you'd like to see answered. If you have a question please submit the questions in comments below. I'll answer as many as I can.

Thursday, May 24, 2007

Delphi Tips and Tricks

One of the most horrible features of Delphi is the fact that every class in the same unit have access to one another privates. This is similar to a friend class in C++ which should be used sparingly. As usual Delphi makes things easy which I guess is a good thing but like I said this is a horrible feature of the language. It ranks up there with "with". But like any horrible feature there are times when you can use it to your advantage. If a class is in a different unit but you need to get to the protected section just declare local class that derives from the class in question and cast your class to the local derivative and BAM! For example, take a look at CustDlg.pas:


type
THack = class(TWinControl);
THack2 = class(TControl);

procedure TCommandDockObject.EndDrag(Target: TObject; X, Y: Integer);
var
R: TRect;
begin
if Target is TToolBar then
begin
R := Control.BoundsRect;
R.Right := R.Left + TToolBar(Target).ButtonWidth;
THack2(Control).UpdateBoundsRect(R);
Control.Visible := True;
if not TToolBar(Target).AutoSize then
begin
TToolBar(Target).AutoSize := True;
TToolBar(Target).AutoSize := False;
end
else THack(Control.Parent).AdjustSize;
end;
inherited EndDrag(Target, X, Y);
end;


This feature of the language is being used to get access to TWinControl.AdjustSize and TControl.UpdateBoundsRect. Sick, isn't it?

Delphi 2007 Memory Management Documentation

New to Delphi 2007 thanks to Pierre le Riche, the author of FastMM, we have some new documentation about the memory manager. You can find these new topics under "Memory Management on the Win32 Platform" located at the following URL in the help:

ms-help://borland.bds5/devcommon/memorymanagementov_xml.html

You can find the new topics at the bottom of the page in the See Also links:

Configuring the Memory Manager
Increasing the Memory Manager Address Space Beyond 2GB
Registering Memory Leaks
Monitoring the Memory Manager
Sharing Memory

Wednesday, May 23, 2007

Ergonomics

Since we are about to release C++Builder this is the time in the cycle when sitting in front of the computer for very long hours is common place and we all forget our ergonomics training.

When ebay had a Santa Cruz office my brother-in law started working there and every developer had an Aeron chair. At the time I thought they were a gimmick, but about a year ago I started using one and I haven't looked back. Now I want one for home.

Last year my monitor at CodeGear was replaced with a Dell 21" LCD and what a difference it made. My eyes didn't get strained hardly at all looking at the new monitor. So I replaced my dated monitor at home with a Apple 30" Cinema Display and I love this monitor.

Back in February I posted about my mouse setup.

I have two stations in my office, one for sitting and one for standing. Everyone calls my standing station the "telephone booth" because it is a very narrow cube with a high desk. I use Remote Desktop so I can work on any computer from either location depending on what I feel like. I typically use my email computer at the stand-up station and do my work at the sit-down station. Using the two stations in this fashion forces me to change positions often throughout the day. This reminds me of a stand-up treadmill.

Last September Joel on Software wrote an article a titled A Field Guide to Developers. He stated that developers needed 4 things, private offices, Aeron chair, 30" LCD monitor, and access to buy books at Amazon. Of course there is more to the article, but that's what I remember off the top of my head.

Thursday, May 17, 2007

What's In My Camera Bag


Copyright © 2007 Chris Bensen. All rights reserved.


I am frequently asked about the equipment I use to produce my photography, so I created a few pages about some of it that you can read about on my website here. Oh, I'm also updating the photo of the week because I've been notified the last one has been up for a bit more than a week.

The New Google Analytics

I just got and email from Google:

“We are happy to announce the release of a new version of the
Google Analytics reporting interface. Since you are an existing
user, you will automatically be upgraded - there is no action
required on your part.”


After reading these first two sentences I went over to Google Analytics to check it out. The information Google Analytics provides has always been great, but now it looks great too. One of the reasons I moved my blog to Blogger was to give me a chance to play around with some of these nifty tools. You could say it’s research. If you are thinking about using Google Analytics on your website or blog, go check out the tour

And if you do add Google Analytics to your website and users with 520-bit depth color displays start browsing your website, apparently it's a conspiracy.

Update: I wanted to clarify that Google Analytics can be used by any website or webpage. It isn't a requirement that your site be hosted by Blogger.

Wednesday, May 16, 2007

Example To Get Referenced Type Libraries

Here is a function that given a type library it will populate a string list with all the referenced type libraries.


procedure GetTypeLibraryReferences(const FileName: string;
References: TStrings);

function IndirectionTypeDesc(TypeDesc: PTypeDesc): PTypeDesc;
begin
Result := TypeDesc;

while Result <> nil do
begin
// Follow pointer type to pointed to type.
if Result.vt <> VT_PTR then
Break;

Result := Result.ptdesc;
end;
end;

procedure GetTypeLibName(const TypeInfo: ITypeInfo; RefType:
HRefType; References: TStrings);
var
CustomTypeInfo: ITypeInfo;
CustomTypeLib: ITypeLib;
Index: Integer;
Guid: TGuid;
CustomLibAttr: PTLibAttr;
TypeLibName: WideString;
begin
OleCheck(TypeInfo.GetRefTypeInfo(RefType, CustomTypeInfo));
OleCheck(CustomTypeInfo.GetContainingTypeLib(CustomTypeLib, Index));

// Get the name and guid of the type library that contains this type.
OleCheck(CustomTypeLib.GetLibAttr(CustomLibAttr));

try
OleCheck(CustomTypeLib.GetDocumentation(MEMBERID_NIL,
@TypeLibName, nil, nil, nil));
References.Add(Format('%s - %s',
[TypeLibName, GuidToString(CustomLibAttr.guid)]));
finally
CustomTypeLib.ReleaseTLibAttr(CustomLibAttr);
end;
end;

var
TypeLib: ITypeLib;
TypeInfoIndex: Integer;
Kind: TTypeKind;
TypeInfo: ITypeInfo;
TypeAttr: PTypeAttr;
FuncDescIndex: Integer;
FuncDesc: PFuncDesc;
ParamsIndex: Integer;
ElemDesc: PElemDesc;
TypeDesc: PTypeDesc;
ImplTypesIndex: Integer;
RefType: HRefType;
begin
OleCheck(LoadTypeLibEx(PWideChar(WideString(FileName)), REGKIND_NONE, TypeLib));

// Get the CoClasses, interfaces, enums, modules dispinterfaces,
// alias', unions and records.

for TypeInfoIndex := 0 to TypeLib.GetTypeInfoCount - 1 do
begin
TypeLib.GetTypeInfoType(TypeInfoIndex, Kind);
TypeLib.GetTypeInfo(TypeInfoIndex, TypeInfo);
OleCheck(TypeInfo.GetTypeAttr(TypeAttr));

try
case Kind of
TKIND_COCLASS:
begin
// Get the implemented interfaces.
for ImplTypesIndex := 0 to TypeAttr.cImplTypes - 1 do
begin
OleCheck(TypeInfo.GetRefTypeOfImplType(ImplTypesIndex,
RefType));
GetTypeLibName(TypeInfo, RefType, References);
end;
end;

TKIND_INTERFACE, TKIND_DISPATCH:
begin
for FuncDescIndex := 0 to TypeAttr.cFuncs - 1 do
begin
OleCheck(TypeInfo.GetFuncDesc(FuncDescIndex, FuncDesc));

try
// Item 0 is the method name. Ignore it
// for the parameter list.

for ParamsIndex := 1 to FuncDesc.cParams do
begin
ElemDesc := @FuncDesc.lprgelemdescParam[ParamsIndex - 1];
TypeDesc := IndirectionTypeDesc(@ElemDesc.tdesc);

if TypeDesc.vt = VT_USERDEFINED then
begin
RefType := TypeDesc.hreftype;
GetTypeLibName(TypeInfo, RefType, References);
end;
end;

finally
TypeInfo.ReleaseFuncDesc(FuncDesc);
end;
end;
end;
end;

finally
TypeInfo.ReleaseTypeAttr(TypeAttr);
end;
end;
end;

Tuesday, May 15, 2007

C++Builder 2007

Now you know why we've been so buisy and the blogs have been quiet. You can find the press release here.

Monday, May 14, 2007

Delphi 2007 Version Compiler Directive

I've been asked a few times what compiler directive to use with Delphi 2007. Since Delphi 2007 is a non-breaking release of the compiler and VCL use VER180 But since there are differences, especially with VCL having to do with Vista, you can target Delphi 2007 specificially with VER185.

Friday, May 11, 2007

How To View And Edit The Registry Under Windows 64-bit

I've been running Windows XP 64-bit for nearly a year and there is one gotcha that I run into when debugging COM applications, dealing with the registry. In 64-bit Windows the entire 32-bit registry is located under the key HKEY_LOCAL_MACHINE\Software\WOW6432Node. 32-bit Delphi applications can only see the 32-bit keys, but a 64-bit application can see everything. I use a 32-bit 4NT which launches the 32-bit regedit so if I want the 64-bit regedit I just go to the start menu, click Run and type "regedit". You can also run the 32-bit regedit from the start menu by going to the start menu, clicking Run and typing "%systemroot%\syswow64\regedit". You can only run one at a time unless you use the -m switch. This can get confusing fast because Windows On Windows 64 (WOW64) mirrors certain registry keys and values between the 64-bit and 32-bit registry. So if you are on Windows 64-bit, open up regedit and do some twiddling and then try to run your COM app and things don't work as you expect, make sure you are twiddling with the correct registry.

Thursday, May 10, 2007

Biking to Work

I finally rode my bike in to work this morning for the first time this year. Got in before 7am, which is my best time for programming. A few years ago when I moved to Scotts Valley I biked to work all the time. I stopped last year after my wife had the supper 11lb 4oz baby and I needed every minute to help out.

The funny thing is my commute (I call it a commute but friends that actually have one laugh at me) is 8 minutes on a good day 15 on a bad day and takes about as long on a bike. Last month I picked up a Nike C8 Heart Rate Monitor which I used this morning. It's really great to have when working out and I highly recommend the Nike C8 for anyone with a large wrist.

Sanjay Banerjee one of our C++ compiler engineers just commented on my out dated 1998 Gary Fisher HooKooEKoo hard tail mountain bike currently sitting in my office with dirt all over it from my last muddy ride to Nisene Marks Sand Point. I guess it's a bit dated but it works great for me. Tis the season for summer mountain biking in Santa Cruz Mountains. I wish I had a photo from Sand Point to put right here. I'll have to take one and post it for those who have never seen the view.

Wednesday, May 9, 2007

Microsoft oPhone



This video spoof was shown at Mix '07 last week in Las Vegas for Web Developers. Very funny!

Tuesday, May 1, 2007

CodeGear Website Face-lift

The CodeGear website just got a face-lift. I know they look nothing like one another, but the new graphic across the top reminds me of the Mountain Hardwear logo.