Wednesday, April 23, 2008

Upgraded to Leopard

Everything I needed to upgrade to Leopard now supports Leopard. So I bought a new 1TB Wester Digital Caviar hard drive and installed it in minutes in my MacPro. It really was the easiest hard drive install I've ever done. Leopard was just as simple. Put the DVD in the drive, hold down the C key to boot from the optical drive and then run the install. How the heck are you supposed to know to hold down the C key unless you read the directions? Typical Apple, make the most common things easy and the slightly harder things buried. Last I ran the user migration assistant which moved everything over to the new hard drive. Easiest new install of an OS I've ever experienced. And nearly everything is migrated over. I've never had that experience with a new install of Windows.

I ran into a few oddities:

- Safari had some funniness with the bookmark bar where some of my links showed up in a couple locations.
- My Wacom tablet driver didn't have sufficient privileges to run.
- The default output for the sound was changed to the internal speaker not the line out to my desk speakers.

But that's it so far. I'm sure something else will crop up.

The first strange thing I noticed is quick viewing items on the desktop opens the quick view window on the secondary monitor. I only turn on my second monitor when I'm reviewing a large photo-shoot so this is kind of a problem.

This is the first OS upgrade I've ever had where the new OS was faster than the previous one on the same hardware. Okay, I got a new hard drive, but I don't think that is coming into play here. Things are just snappier.

I still have to test out all my applications. I'm running the first update now so I'll know more tomorrow.

Tuesday, April 22, 2008

BusySync for Mac

For a while now I've been trying to find a good way to keep the Missus' and my calendar's in sync. One of my fellow CodeGear Mac heads mentioned BusySync so I gave the trial a whirl. It just worked out of the box as easy as could be and kept our Macs iCals in sync. The only problem left was knowing my schedule when I'm not at home. Lots of people suggested getting an iPhone and that'd be great if I weren't a Verizon customer and switching over to AT&T wouldn't cost me over $50 per month more than what I pay now. Then I'd still have to carry it and I'm at work most of the time when I need to know my schedule anyway. Then BusySync just got cooler and released BusySync 2.0 that syncs with Google Calendar. Hot diggity dog, it works swimmingly! They also have a discount going on right now. If you use a Mac and need to sync your calendars on two or more Macs then give it a try.

Thursday, April 17, 2008

Delphi Tips and Tricks: Model View

I've been using the model view quite a bit lately and it's a little uh, well, ugly and difficult to navigate. There is an option, although not widely known and a bit burried, that makes the model view a whole lot more usable. Although this option isn't "preferred by modelers" it sure does help us coders use it.

To enable the simplified Model View go to Tools | Options, scroll down the tree to Together | Default | Diagram | Model View and change View type from Model-centric to Simplified.



Updated: Here are two screen captures from the Model View before and after toggling the option. This is after creating a new Delphi VCL Application. Can you figure out which one is which?



Tuesday, April 15, 2008

Delphi Tips and Tricks: Import Component Wizard



The Import Component Wizard supports copy (CTRL + C). If I press CTRL + C on the dialog above I get "Active Setup Control Library, Version 1.0, C:\WINDOWS\SysWOW64\asctrls.ocx" in my clipboard buffer. Kinda handy.

Friday, April 11, 2008

Writing a Delphi Menu Item Plugin

Trying to figure out the Delphi Open Tools API can be a daunting task. Here is a bit of code to get a menu item into the Delphi IDE's main menu. Please note that I didn't test this code and you will want to reorganize it a bit.


unit ComStdReg;

interface

uses Menus, ActnList;

type
TMyMenus = class
private
FMenuItem: TMenuItem;
FMenuAction: TAction;

procedure DoExecute(Sender: TObject);
procedure DoUpdate(Sender: TObject);
public
constructor Create;
destructor Destroy; override;
end;

implementation

uses ToolsAPI;

constructor TMyMenus.Create;
var
MenuService: INTAServices;
begin
MenuService := BorlandIDEServices as INTAServices;

if MenuService <> nil then
begin
MenuItem := TMenuItem.Create(nil);
MenuAction := TAction.Create(nil);
MenuItem.Action := MenuAction;
MenuItem.Name := 'MyMenuItem';
MenuActiond.Caption := 'My Menu Item';
MenuAction.OnExecute := DoExecute;
MenuAction.OnUpdate := DoUpdate;
MenuAction.Enabled := False;

// Only set this if you want to allow F1 when the mouse if over the menu item.
MenuAction.HelpContext := 0;

// Tell the menu service which item to place your menu item after. This will
// place your menu item after Component | Installed Packages.

MenuService.AddActionMenu('ComponentPaletteItem', MenuAction,
MenuAction);
MenuService.UpdateMenuAccelerators(MenuService.MainMenu);
end;
end;

destructor TComMenus.Destroy;
begin
FMenutItem.Free;
FMenuAction.Free;
inherited;
end;

procedure TComMenus.DoExecute(Sender: TObject);
begin
// DoExecute is called when the the menu item is clicked.
end;

procedure TMyMenus.DoUpdate(Sender: TObject);
begin
// DoUpdate is called when the menu is displayed.
// Here you will want to set FMenuAction.Enabled to True or False or
// FMenuAction.Visible to True or False. I personally don't like it when menu
// items hide so don't change visible.

end;

Wednesday, April 9, 2008

Going Green


Copyright © 2005 Chris Bensen. All rights reserved.


Green is all the rage lately, and I'm all in favor of it for many reasons. I figured a green post was worthy since Earth Day is coming up. Lately it's been hard to go a few days without hearing about someone's carbon footprint and at 6'5" I have a pretty large carbon footprint. Seriously, I eat a lot of food.

One of my favorite reasons to have an environment around is so everyone I know, including myself, can live. My second favorite reason is so I can take photos like the one at the top of this post. I figured a photo of Mono Lake would be fitting for an environmental post such as this. Also pretty. I just got done editing it from a trip my dad and I made to the Sierras in October of 2005.

One of the things that bothers me about all the green talk is people and companies can buy down their "carbon footprint" with energy credits. I hear that Al Gore does this. It seems pretty silly since circulating more money inherently means growing the economy which is causing the environmental problems in the first place. Anyway, I'm digressing and I'm sure many people will have a comment or two about that.

Some companies like Patagonia go to great lengths to determine their impact on the planet with their Footprint Chronicles. I also think every company should join 1% For the Planet. There's also Google's Solar Panel Project. And you've probably seen Blackle where it is claimed that if Google were to change the default background color from white to black they'd save people from using loads of energy.

I've reduced the number of computers I use at CodeGear from three to two and they are set to wake-on-LAN so I can remote desktop into them. Somehow it doesn't seem even close to any of the projects I listed above but every little bit counts. Of course I do other things like recycle, drive as little as I can, ride my bike when I can, turn off lights etc. I probably could save some of you energy by optimizing the amount of memory that Delphi uses or something. Delphi already has the Twilight color scheme so I can't improve that.

And if it weren't difficult enough some things that are supposedly good for the environement really aren't. Time magazine has an article about ethanol and how is disastrous for the environment. Who really knows, but I do know I was thinking similar things when bio diesel became all the rage.

http://www.time.com/time/magazine/article/0,9171,1725975,00.html

Last week I dug a big hole for a tree in the front yard and I ran across a piece of styrofoam that was put into the ground over 10 years ago when the house was built. Needless to say it was a little dirty on the outside, but it was perfect on the inside. Nice! Good thing nearly everything comes packaged up in the stuff. I guess just buying less stuff will have an impact. But my government wants me to spend my tax credit. Hmmmm...

Of course one of the problems with computers and electronics is they are by their very nature tough on the environment. I've been trying to do business with environmentally friendly companies when possible. I try and look for companies that actually use less or have solar panels or just something that is actually energy efficient and not wasteful. Maybe they recycle for instance. A perfect example is aiso.net which is a web hosting company that I've been considering switching to. Has anyone had any experience with them? I'm looking for more companies that think like the ones I've listed here so I can do business with them.

What sorts of things have you or your company done to be more green?

Tuesday, March 25, 2008

Hey Dude, Nice Function Name

I'm just as guilty as the next programmer. Going through some code I wrote a few releases back in a bit of a rush and here's a nice little function:


procedure FixStuff(const Project: IProject; const FileName, CoClassName: string);

Nice!

I think I'll at least rename it to FixComStuff. Fortunately FixStuff doesn't even compete with DoThings. Too bad there wasn't a comment:

{ Don't know why this works. Don't touch it }.

Buying a Mac

Everyone seems to be looking at buying a Mac lately. Well either that or they hate em'. Even Allen Bauer picked one up. He walked into my office about a month ago with a big grin on his face and said "I did it!"

Like many of you I'm tech support for my entire family, friends, extended friends, friends of family and friends of friends. Recently many of them have been upgrading their computers. My old hand-me-downs are starting to get pretty darn old I guess. My dad, for example, just bought the low end iMac. He went back and forth between Dell and Mac more times than I can count but once his best friend showed him his iMac my dad was almost sold. I say almost because it still took a few months, many trips to the Apple store and lots of reading before he made the plunge. Now he's up late at night video chatting with friends on the other side of the globe and his only regret is that he didn't buy it sooner.

One of my Dad's biggest problems was moving to the Mac is the lack of Quicken. Sure there is a Quicken-like piece of software sold called Quicken, but it leaves much to be desired. Even QuickBooks isn't as good as the Windows version. I've been using QuickBooks and iBank for a while now and they work but they arn't that good. I think the reason there isn't better personal finance software out there (even for Windows) is because nobody does it. They all do it online (which really isn't personal finance in most cases) or they just don't balance their checkbook. Makes me wonder.

Oh, and to answer Allen's burning question as to why Macs are so entrenched in school; they aren't. In the graphics professions the reason they have standardized on the Mac platform is because the fonts are completely different on Windows and Mac and the Mac works better, and in some cases they are just used to the Mac. I realized this when the Missus did work at home on our Windows version of Illustrator and brought it to her Mac at work and had to change out each font and adjust the location for it to look right. Mac renders the display to look as it will print. Windows renders the display as it will look on the monitor. Make a long story short, they look different.

I personally like Mac at home because I work all day with Windows and when I use a computer on my personal time I don't want it to be work. Also the color profiling is awesome on the Mac and I really like the hardware.

Friday, March 21, 2008

Easter

When I found out Easter was so early I thought "isn't this an April holiday?" Then I remembered it was some crazy full moon after the equinox thing. Here's wikipedia's description of when Easter is:

"...Easter is the first Sunday after the first fourteenth day of the moon (the Paschal Full Moon) that is on or after the ecclesiastical vernal equinox."

I'd sure hate to calculate Easter programatically but here's a link to a simple Delphi function to calculate it:

http://delphi.about.com/cs/adptips2002/a/bltip0302_2.htm

The Comment You Don't Want to See

Have you ever been looking through some code trying to figure out what it does and see something like this:


{ this is a bit of a hack }

This is (one of) the most unhelpful comments a person could write. Please don't do things like this in your code. Just describe why it's a hack and describe what should be done.

Thursday, March 20, 2008

Where's Chris?

I've received some emails asking if I was still alive on the account that I haven't blogged much over the last few months. Yes, I'm still alive thank you for your concern. With it being tax season, my daughter getting 8 teeth over the last month hence no sleep, and various other events, things have just gotten rather busy. I have written up a few posts but unfortunately they can't be published until after Tiburon is released.

As you've probably noticed I haven't updated the photo of the month in a while either and that's because I haven't been doing any wildlife or nature photography lately. But you can see one of my photos in the Spring issue of Nature Photographer which is currently in stores.


Copyright © 2007 Chris Bensen. All rights reserved.


When adding this photo to this post I was just reminded of why I post my photos so small. Many people have asked for me to post them larger and the simple reason I don't post them larger is they get stolen.

Monday, March 3, 2008

CodeGear COM Contractor Needed

There is a job opening for a COM QA contractor available at CodeGear working on Delphi and C++. If you are interested contact me and I'll forward your information to the hiring manager.