Friday, November 30, 2007

Upgrading Delphi

Yesterday in the CodeRage II public chat for the vendor reception there were some comments about upgrading from Delphi 6 to Delphi 2007 by Cass McNutt. I think these comments are great because we need to make sure Delphi is as easy as possible to upgrade. I love constructive feedback like this.

First you have to understand how I use Delphi on a daily basis is completely different than how you use it. We develop Delphi in Delphi. Our version control system contains nearly every line of code that goes into the product. So for me upgrading between versions isn't as much of an issue. Plus there is an entire team of Delphi developers to help out. So I'm trying to put myself in your shoes here.

The main piece of the puzzle you depend on is the IDE, compiler, RTL and VCL. If these change you need to change your code. That's why backwards compatibility of the compiler, RTL and VCL are so important. If something breaks your code you may choose to stick with the current version.

My perception is that 3rd party components and IDE plugins are your biggest concern. If a 3rd party component doesn't support the latest version and the source isn't available you might choose to continue using the current version. This is the same problem when upgrading any complex system such as an OS. This is the same reason I'm not upgrading my Mac at home to Leopard.

My understanding is that there are a lot of developers still on Delphi 7 or earlier. There are many reasons such as the help, IDE performance, IDE requiring .NET, component palette changes, installer, and SDI IDE.

A smaller but equally important upgrading issue seems to be user preferences such editor colors. I think the installer should be able to detect a previous install and migrate appropriate settings to the new install if desired.

So am I missing any other concerns or pitfalls about upgrading Delphi?

Update: I find it interesting and worthy of a note that today in borland.public.delphi.non-technical there is a post titled "Upgrading a program from Delphi 6 to 2007 - What's nessicary". Obviously this is a common problem.

Update: I changed some of the wording above. It was pointed out that I was insinuating that you shouldn't upgrade Delphi. This is not the case and if anyone reads this into my comment above you are reading a sentence out of context. I am simply trying to put myself in the Delphi customer's shoes. So, some rewording has been done to be more neutral.

Thursday, November 29, 2007

Epson Printer Compatibility with Leopard

A while back I talked about why I'm not upgrading to Leopard just yet and one of the big road blocks for me is the lack of printer support. Epson announced today via a FAQ that can be read here that they will be releasing a driver for most of the Epson professional printers including my Epson 4800. You can download a beta of the driver here. That's great news but I have a few friends that have the very expensive Epson 7600 that will not get an updated driver. I'm surprised at Epson considering how much one of these printers cost. I'll think twice the next time I recommend an Epson printer to anyone. Considering the fact that I've had two Epson 2200 printers die and my 4800 has firewire problems I'll think twice about buying another Epson myself. I continue hear great things about the latest generation of HP and Canon printers.

Anyone know of a good NAS Drive?

I'm looking for a NAS Drive for use at home that has some sort of redundant RAID. I'd like a box that I just plug into the network so the Missus and I can just share gigs and gigs of large photos. I figured I'd ask here since at least one of you has probably discovered something. RAID 1 would be good. Raid 5 could work as well. I've looked at a lot of different produces but nothing seems to stand out. I need it to work with a Mac and some don't which is surprising. It also needs to support Gigabit Ethernet. I will be only be turning it on when it's needed to be as green as possible.

I did come across Drobo which is close but only supports USB2. I'd really like a Drobo with Firewire 800 and/or Gigabit Ethernet. I could get a something to make the Robo be a NAS such as the Apple Airport Extreme. I guess I can build a server, but that's more work than I want to put into it.

Any suggestions?

String Parameters in Delphi

Strings are a special managed type in Delphi and should be handled correctly. When comparing a simple procedure with the parameters

procedure Foo(const S: string)
which results in no extra code vs by value
procedure Foo(S: string)
which results in the following assembly being generated:


push ebp
mov ebp,esp
xor eax,eax
push ebp
push $004094c7
push dword ptr fs:[eax]
mov fs:[eax],esp
xor eax,eax
pop edx
pop ecx
pop ecx
mov fs:[eax],edx
push $004094ce
ret
jmp @HandleFinally
jmp $004094c6
pop ebp
ret


So nearly always pass your strings as const or var.

Update: Allen has some good points which I neglected to mention and I'll bring up into the post from the comments so everyone can see it. "This is good advice for nearly all cases. However there are a few cases where you should pass a string "by value." If the function you're calling manipulates a global string variable and there is a chance that the same global string can be passed in as a parameter, there is a chance that the global string variable is deallocated which would indirectly render parameter invalid as well. The same thing can happen with any of the managed types such as interfaces, dynamic arrays or variants."

Update: Rob Kennedy has more good points which I also neglected to mention so I'm bringing them into the post from the comments. What's happening in that assembler code is a try-finally block generated by the compiler. It's there to ensure that the reference count of the string parameter gets reduced before the function returns.

Monday, November 26, 2007

Unicode

At some point more details will come out on how Delphi and C++Builder are going to handle unicode in the next release codenamed Tiburón. I started posting some heads up posts about problems I've encountered that have nothing to do with how the Tiburón implementation will be, but rather general guidelines and advice in this post. I will continue to do that, but I wanted to let everyone know my current experience.

We do have an implementation of unicode and we have been going through our code to take advantage of the new unicode support. I just completed the tlibxxx.bpl package which is one of the nastiest packages in the product due to interfacing with RTTI and it really wasn't bad. In fact it was easy. We'll get more information out to everyone as we can but I just wanted to let everyone know this really isn't scary. Sure depending on your code you could be doing some things that make it more difficult but in general I think it'll be very straight forward.

Wednesday, November 21, 2007

Delphi OpenGL Game

David Lock, our resident game guru, just posted his latest creation he calls Delphi Cannon. It's a fun little two player game I've play tested many afternoons to get the balance just right.

More than being a fully functional game that totally rocks, this shows off what can be done with Delphi. There are no limits. It's always nice to add a little bit of bling to your applications. Do any of you have any examples of bling you've added to your Delphi applications?

I hope everyone enjoys the Thanksgiving weekend.

Monday, November 19, 2007

Canon G9 Deal on Amazon

A while back I posted about my point and shoot camera research here. I still maintain that the Canon SD1000 is the best value point and shoot camera for the money. Especially after using it for a few months. But, recently Canon released the Canon G9 upgrading the G7 with some great features making it one heck of a little camera. I noticed that Amazon has it for a really great price of $443 and it comes with a 2 gig SD card if you buy it before Dec 3rd. If you take the plunge, use the coupon code "7ACBUY5F" at checkout, and have the card linked on the G9 page already in your shopping cart.

Friday, November 16, 2007

Change your Background Image and Get More Sleep

Earlier in the month this article was published. The thing I want to point out from the article is "stop staring at your 'Microsoft Blue' computer screen late at night, he said. Blue light appears to suppress the hormone melatonin, Avery said, which is released by the body to induce sleep." Our daughter is just over a year old so I'm always looking for more ways to get some extra sleep. So I changed my background image from a blue photo to a nice warm photo of maple leaves. Maybe it's just the change, because I don't change my background very often, but it seems more refreshing somehow. I say give it a try.

Help Update

Be sure to grab the latest help update. Nick explains more about the help update Help Update.

Thursday, November 15, 2007

Unicode: SizeOf is Different than Length Part II

One thing I forgot to mention in my last unicode post about SizeOf and Length. You can specify the size in bytes of a buffer two ways correctly:


var
ByteCount: Integer;
Buffer: array[0..255] of Char;
begin
ByteCount := SizeOf(Buffer); // Version 1
ByteCount := Length(Buffer) * SizeOf(Char); // Version 2
ByteCount := Length(Buffer) * SizeOf(Buffer[1]); // Version 2 with more clarity
end;


I suggest just going with the first version.

Wednesday, November 14, 2007



As usual Apple, and in this case FileMaker which is owned by Apple, have struck a home run in my opinion. Bento is an easy to use database application for normal people. It hooks up to all the services Leopard has to offer such as iCal and Address Book and can sync with the iPhone and iPod Touch. I wonder if they are working on a version of Bento for the iPhone and iPod Touch? If you are running Leopard, which I'm not unfortunately, go give it a try with the free preview and post here your experience. The trial bombs out in two months.

CodeGear Anniversary



One year ago today the creation of CodeGear was announced.