Thursday, December 27, 2007

2008: Some thoughts on going virtual

One of the goals for me in 2008 is to bring my production environment over to a virtual machine. 

That should give the following benefits:
1. Complete installations can be backed up, so if a future update fails, it is easy to step back in time. (Less downtime)
2. It is easy to make multiple backups, with multiple states of the installation.
3. It is easy to take you complete production environment with you.
4. More flexible for setting up new software without hurting your existing software. (Testing new technologies etc.)

The benefits are clear, more secure, less downtime in case of an event, and more flexible.
First question that comes to mind thinking about going virtual is:

How to set up a VM environment as efficient as possible?

The answer to this question is, of course, specific for each situation. Because I have never done this, I will share with you how I think about settings things up. If you have any tips, please step in!

I use, the two major IDE's in the market today, for my development, namely CodeGear RAD Studio and Microsoft Visual Studio. The latter is for .NET development only, and mostly ASP.NET development.
So I think about setting up two seperate VM's: (They will be based on Windows XP pro)

1. Delphi VM
- Delphi 7 (for older projects)
- BDS 2006 (.NET personality for Winforms .NET 1.1 development)
- RAD Studio 2007
- Delphi third party components
- Visual SourceSafe for version control

2. Visual Studio VM
- Visual Studio 2005 (Winforms/ASP.NET developement)
- Visual Studio 2008 (future...)
- Third party components
- Visual SourceSafe for version control

On each VM I completely install all necessary software and components. After that I will backup those VM's as the basic production environment setups. With each future update (IDE, components), I will update those basic environments also, keeping them up-to-date. If an update fails there is no problem, just use the last backed up clean environment.

The source code and SourceSafe
On the hosting machine, my laptop by default, I will install all other necessary applications, like Microsoft SQL Server, Office etcetera.
I will keep my application source codes located on the hosting machine, which I can reach in my VM through shared folders. Doing this, I can backup them as usual. With Visual SourceSafe in VM, I can check out files on my laptop, and alter them within the VM.

Well just some thoughts about setting up a development VM.

Happy new year!!

Tuesday, December 18, 2007

RAD Studio 2007 December update released!

CodeGear just released the December update for RAD Studio 2007, as well as the update for Delphi 2007 and C++ Builder 2007.

Looks like there are a lot of fixes.
284 Core bugfixes
93 Delphi 2007 fixes
46 C++ Builder fixes
157 Delphi 2007 .NET fixes

According Nick Hodges blogpost about the upgrade it should not be a too long update this time. Because of the fact that it is a binary update, all unofficial patches that were applied should be uninstalled.

Chris Pattinson looks back at 2007, from a QA stand point of view, in his blogpost CodeGear Quality Review 2007. 7006 defects are fixed since 1 january 2007!

You can download the update at the registered users download page. Or check for updates within the IDE.

Monday, December 17, 2007

Programming in Delphi sins #3

In this serie I will tell you, what we find a sin, in Delphi programming.

Using published properties of components from another class
When you place components on forms and datamodules in Delphi they are published by default. In other words you can use components in your form that belong to other forms/datamodules. If you do this, those forms will be tightly coupled and therefor this is not quite a good OOP practice.

type
TdmMain
= class(TDataModule)
//These components are published and direct
// accesable by other forms/datamodules
SomeDataSet: TADOTable;
adsAnotherDataSet: TADODataSet;
private
{ Private declarations }
public
{ Public declarations }
end;

Suppose you have a form that uses a datamodule with some dataset on it and you want to show some field value in a label on your form. You could do it like this:


procedure TForm3.SetCaption;
begin
SomeLabel.Caption :
=
dmMain.SomeDataSet.FieldByName(
'SomeField').AsString;
end;


This is bad practice. Suppose that, something simple as the name of the field changes, you would have change both your datamodule, and your form.

Solution:

Use properties and functions (getters), not properties from published components.

In the datamodule:
property SomField : string read GetSomeField;
procedure TdmMain.GetSomeField : String;
begin
Result :
=
SomeDataSet.FieldByName(
'SomeField').AsString;
end;

In your form:
procedure TForm3.SetCaption;
begin
SomeLabel.Caption :
= dmMain.SomeField;
end;

A more dramatic way to avoid use of published properties is to move all published properties into the private section of the class.

This gives you best practice, however if you use dataware controls, you then should couple them manually.

So for the sake of dataware controls we keep them published, but always write properties or getter functions to get values in code.

Tuesday, December 11, 2007

Programming in Delphi sins #2

In the first episode of this serie I talked about avoiding the default auto-create function for forms and datamodules in Delphi.
As Zarko Gajic (delphi.about.com) pointed out in the comments I made another sin ;-) in the example code. Always something to learn! Thanks for the tip Zarko!

Well here it goes #2:

Never use a owner if you create a component/form yourself and free it instantly
So don't do this: TForm3.Create(self);

procedure TForm5.Button1Click(Sender: TObject);
var
MyForm : TForm3;
begin
MyForm :
= TForm3.Create(self);
try
MyForm.ShowModal;
finally
MyForm.Free;
end;
end;

But do this: TForm3.Create(nil);


procedure TForm5.Button1Click(Sender: TObject);
var
MyForm : TForm3;
begin
MyForm :
= TForm3.Create(nil);
try
MyForm.ShowModal;
finally
MyForm.Free;
end;
end;


If you pass self (in this case Form5) as the owner you rely on Form5 to free it when form5 is destroyed. Beside maintenance confusion it also has a backdraft on performance.

Zarko has a great article on this:

A warning on dynamically instantiating components

Always great to learn something new!

Monday, December 10, 2007

Programming in Delphi sins #1

In this serie I will tell you, what we find a sin, in Delphi programming.

Using auto create forms and datamodules
Standard Delphi will create automatically all forms and datamodules for you. This gives you a headstart when you are first learning Delphi, but in the end it will give you a headache!

Sooner or later you begin to wonder where that 'Form1' object is coming from. (It is in fact a variable in the interface section of his own unit)
Other issues:

  1. Your program becomes slower, consuming more memory then needed with many forms created.
  2. Bugs will be harder to track, because you just can not know the state of all your forms and datamodules. Code could run, without you knowing about it.

Solution:
Turn off auto creation of forms
in the options Dialog-VCL Designer tab, and create your forms/datamodules when you need them, and free it when you are done with it. In existing projects remove those forms from the auto create forms list in the project options.

Create a form when you need it, using your own variable:

procedure TForm5.Button1Click(Sender: TObject);
var
MyForm : TForm3;
begin
MyForm :
= TForm3.Create(self);
try
MyForm.ShowModal;
finally
MyForm.Free;
end;
end;

Remove the 'global' var in unit of the newly created forms and datamodules, you just don't need them:


unit Unit3;

interface

uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs;

type
TForm3
= class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;

//Remove this global var, which is
//the instance that is created with
//the auto create forms option turned on
var
Form3: TForm3;
//--

implementation

{$R
*.dfm}

end.

Friday, November 30, 2007

String parameters tip

Chris Bensen has a 'small' tip, which in fact is a great tip.
He suggest to always pass strings as const or var. If you pass them by value extra (unnecessary) assembly is being generated.

Read his blogpost String parameters in delphi (Don't forget the comments)

Thursday, November 22, 2007

Some memory leak pitfalls

Just installed the professional version of Eurekalog, which is, imo, a must have tool for tracking exceptions and memory leaks in your Delphi Win32 applications.
This tool, and of course any other tool out there that does the same, really helps you to track down exceptions fast. For me, even more important, is the fact that it helps you track down memory leaks as well.

No matter how secure you program, sooner or later, you will loose some memory. Here some pitfalls:

1. Let it be clear where, and who, will free the object
It must be clear where objects are created (read memory for the object is allocated) because otherwise you are in danger for memory leaks.
Functions that create their result are dangerous in this manner. Suppose a function that creates a TStringList, and returns it as it's result:

function TForm3.GetSomeStringList : TStrings;
begin
Result :
= TStringList.Create;
Result.Add(
'one');
Result.Add(
'two');
end;

procedure TForm3.DoSomethingWithaStringlist;
var
MyStringList : TStrings;
begin
MyStringList :
= GetSomeStringList;
try
ShowMessage(MyStringList.Text);
finally
MyStringList.Free;
//Free it!
end;
end;

In this case, the calling method, and the developer must realize that it must free the stringlist, after it is ready with it. This is not always clear in this scenario. A better solution would be to pass your own created Stringlist to the function. Like this:
procedure TForm3.GetSomeStringList(
AStringList : TStrings);
begin
AStringList.Add(
'one');
AStringList.Add(
'two');
end;


procedure TForm3.DoSomethingWithaStringlist;
var
MyStringList : TStrings;
begin
MyStringList :
= TStringList.Create;
try
GetSomeStringList(MyStringList);
ShowMessage(MyStringList.Text);
finally
MyStringList.Free;
//Free it!
end;
end;


It is better to have both, the Create and Free in the same try finally block if possible. Can't go wrong if you code it like this.


2. Always free your own objects nobody else does it for you 
Sometimes it is easy to add to, for example a listbox, also an extra object with more information of the selected item. When filling the items (a TStringlist) you pass on a reference to the listbox item. Later you can use that information to do, whatever you want to do.


Your code could look like this:

procedure TForm3.Button1Click(Sender: TObject);
var
obj : TSomeObject;
begin
obj :
= TSomeObject.Create;
obj.SomeInfo :
= 'This is number one';
ListBox1.Items.AddObject(
'one', obj);
obj :
= TSomeObject.Create;
obj.SomeInfo :
= 'This is number two';
ListBox1.Items.AddObject(
'Two', obj);
end;

To read the data on the selection you can then read the extra info like this (just an example here):
ShowMessage(
(ListBox1.Items.Objects[ListBox1.ItemIndex]
as TSomeObject).SomeInfo);

What you must not forget in this situation is to free all the objects when the application or form is destroyed! The Listbox does not do that for you!

So in the destroy of your form, free all the objects in the listbox like this:
for i := 0 to ListBox1.Items.Count - 1 do begin
Listbox1.Items.Objects[i].Free;
end;

Conclusion is that a good coding style helps you to avoid memory leaks. Tools like Eurekalog helps you to trace them easily and are a great learning resource for where you enter memory pitfalls

Wednesday, November 14, 2007

Time to shift to second gear

CodeGear exists one year!

I could sum up everything that happened this year, but Marco Cantu did a great job in his blogpost One year for CodeGear. (Very nice read!)

CodeGear congrats! And let's shift to second Gear shall we?

Wednesday, November 07, 2007

BugNET review, download, install and track your issues!

Bug tracking is a very important part of software development. We do projects for a lot of different company's which almost all have their own way of bugtracking, if they have it all.
Basically bugtracking is maintaining a list of issues, administering some dates, like report date to solved dates.
When you work in small teams (<3 person) a simple Excel list will do it, but in greater teams, on different locations it just becomes a mess.

Time to investigate a better solution, a bugtracking system.

We had a few requirements:
- The tool should be web based (Running on IIS)
- Projects with team members and roles
- Projects/Users only available for assigned persons
- Possibility to add fields for a specific project on the fly
- E-mail notifications for status changes etc.
- Not only suitable for bugtracking, but issue tracking in general
- If open source then ASP.NET C# as first choice
- Fast and nice looking

BugNET
The first open source project we tried was BugNET

BugNET is an issue tracking and project issue management solution built using the ASP.NET web application framework. Email notifications, reporting and per project configuration of fields and values allows efficient management of bugs, feature requests, and other issues for projects of any scale.

We downloaded it, installed it and loved it! Within 10 minutes we had an Issue tracking solution that met all of our requirements!

In BugNET you can create projects, assign team members to it giving them a standard role from Project Manager to Reader. You can also create own roles per project. A project can have categories (for instance the modules of an application) and versions that can be used as milestones for the issues. Those milestones easily translates themselves into a roadmap.
The project summary page gives a good overview with, from left to right, open issues per milestone, per category, per assignee, per status, per priority and type.
Issues can have:
- Comments
- Attachments
- Related issues
- and even time tracking

Issue changes can be notified by e-mail, and even RSS.
BugNET also supports a report solution which allows you to report to screen, PDF and Excel.
The user interface is looking nice, clean and to the point.

BugNET has the following requirements:
- IIS 5 or later
- Microsoft .NET Framework v2.0 Redistributable
- Microsoft Report Viewer Redistributable 2005
- Microsoft ASP.NET AJAX 1.0
- Microsoft SQL Server

More on the installation can be found on the BugNET documentation page.

If you are looking for a issue(bug) tracking management solution you really should give BugNET a try!

Monday, October 22, 2007

Watch your memory

Delphi has a nice feature (since version ??) to check whether you leak some memory in your project. All you have to do is set the ReportMemoryLeaksOnShutDown property to true in your project file.

begin
  ReportMemoryLeaksOnShutdown := true;
  Application.Initialize;

If you forget to free an object you will get an unexpected memory leak exception when you close your application.

memleak

This is nice, however we always release allocated memory, don't we?;-)

Although it is nice to know that you leak some memory the messagebox does not help us to find out where it happens. It only reports the type of object, and the spilled memory in bytes.
In the marketplace there are several tools that can be used to signal memory leaks. One in particular, which I am evaluating right now, is Eurekalog.
You can use this tool to catch exceptions and memory leaks in your application. A detailed log file, with call stack, will tell you exactly the location (unit and linenumber) in the source of the unfreed object. Double clicking a line in the call stack opens the unit at that line in the IDE.
Another nice feature of Eurekalog is that you can activate it within your application, so that whenever your user hits an unexpected exception, or memory leak he/she can send the report to you by e-mail or even sent it to your bug tracking system.

The Eurekalog log file for the above memory leak looks like this:
eureka

Although we always free memory, use the try...finally construct, you will leak memory sooner or later. Tools like Eurekalog can help you tracking them down easily. Do you know more sophisticated tools, like Eurekalog, to track down memory leaks?

Friday, October 19, 2007

.NET Enumerator basics

I hereby declare this week as the week of the enumerator. ;-)
Hallvard Vassbotn started this week with an excellent post on using enumerators patterns on your own collections. You should really give this high School enumeration stuff, a read!

The .NET Framework it self offers a lot of basic functionality for enumerators. It is friday so let's take a look on some basics here:

Sometimes it is necessary to let a user pick a value from a enumerator type. For example you want the user to pick some property value of a component, which is enumerator. You could, of course, fill a combox with string values by hand (keeping the order), but in future releases the list could extended, having you to alter your code.

Looping an enumerator
It is easier then to simply loop through the enumerator type. Update! In Delphi win32 this is not possible. This is false! Uli commented that it can in Delphi Win32!, using the Typinfo unit. (See the code in the comments)

In .NET however this is possible using the Enum.GetNames method.
 
In C# you code looks like this:

foreach ( string s in Enum.GetNames(typeof(SeriesChartType)) )
{
   Messagbox.Show(s);
}

the equivalent code in Delphi .NET is:

for s in Enum.GetNames(TypeOf(SeriesChartType)) do begin
   MessageBox.Show(s);
end;

Exists a value?
Check if a enumerator value exists in a enumerator type with the IsDefined method.
Delphi .NET code:


s := 'Point';
if Enum.IsDefined(TypeOf(SeriesChartType), s) then
  MessageBox.Show('Yes')
else
  MessageBox.Show('No');

Conclusion, the .NET framework Enum class, which is the base class for all the enumerator types, adds valueable methods to the basic enumerator types.
More information can be found on MSDN here.

Friday, October 05, 2007

Fooling around with TWebbrowser #4

TWebbrowser and the Enter key
For some reason the Enter key in TWebbrowser does not work. This is very annoying, because users can't use the enter key to submit a form or, even worse, can not go to the next line in a textarea.

Searching the Internet I found two solutions to this problem:

Solution1: Use your applications MessageHandler;
The best solution,imo, is this one provided by SwissDelphiCenter. This solution 'listens' through the application's messagehandler to handle the keystrokes of your webbrowser. (Webbrowser1 in this case).
In my multitab browser I had to tweak this a little bit to give the handler the active webbrowser. (Don't forget to nil the FOleInPlaceObject when you switch TWebbrowser objects).

if AWebbrowser <> ActiveWebbrowser then begin   
FOleInPlaceActiveObject := nil;
Webbrowser1:= ActiveWebbrowser;
end;

This works just fine! Kind of magic to me, but it works.

How to handle popup browsers?
As told in a previous episode of this serie, it is sometimes necessary to invoke the NewWindow2 event to handle popup-browsers. This is typicaly necessary when you need to retain a browser session.

In the NewWindow2 event a new form of you application is popped up modeless to hold the webbrowsers popup. To get the active webbrowser for your messagehandler in this scenario gets a little complicated, because there could be more popups open at the same time, and a popup could have one or more popups. The next solution seems to be more appropiate for that.


Solution 2: Use the Keybd_Event message
Well the Enter key might not work in textarea's, CONTROL + M seems to be doing just what we need, inserting a new line in the textarea.

So we must send a CTRL + M to our webbrowser. Here a solution, as found on Delphi3000, using the Keybd_event function. This function can be used to synthesize keystrokes. So send the CONTROL + M when an enter key is hit and we are done. (Supposing there is only a webbrowser on your popup form).

However there is one side effect with this solution, if you have a textarea and a submit button on your popup webpage, the page will also be submitted if you enter a new line in the textarea. Simple solution for this is to send the CANCEL event after the handling, so this is the code with the extra line (looks a bit messy):



procedure TfrmPopUpBrowser.FormKeyPress(Sender: TObject; 
var Key: Char);
begin
//Don't forget ot set the Keypreview property
//of the form to true!
if (Key=#13) then begin
Key := #0;
Keybd_Event(VK_LCONTROL, 0, 0, 0); //Ctrl key down
Keybd_Event(Ord('M'), MapVirtualKey(Ord('M'), 0),
0, 0); // 'M' key down
Keybd_Event(Ord('M'), MapVirtualKey(Ord('M'), 0),
KEYEVENTF_KEYUP, 0); // 'M' Key up
Keybd_Event(VK_LCONTROL, 0, KEYEVENTF_KEYUP,
0); // Ctrl key up
Keybd_Event(VK_CANCEL, 0, 0, 0);
end;
end;

More info on how use Keybd_event function take a look at the msdn article.

Well in my case it was a little harder to tackle this problem, but it works now just fine. Hope this usefull for others as well.

Thursday, October 04, 2007

.NET Framework sourcecode will be free

According to this blogpost, by ex Borlander Charlie Calvert, Microsoft will ship the source code of the .NET framework with the next Visual Studio release 2008.

He says:
Here is a piece of wonderful news: Scott Guthrie has announced today that we will be releasing the source code to the .NET framework when we ship Visual Studio 2008 later this year!

An option will be made available to allow you to step directly into the source from your own code, so you can see exactly what is happening in the .NET framework. This is exactly what developers need, and it will greatly improve the experience of developing on the .NET Framework .

Scott's announcement.

This is really great news. As Delphi Developers we always had the sourcecode of the VCL (since 1995). Having the sourcecode of any framework is indeed a great learning resource!

Tuesday, September 25, 2007

Blog searching

Blogger offers the posibility to search a specific blog with a query, which will return all the blogposts that meets the criteria.

For instance http://beensoft.blogspot.com/search?q=TWebbrowser will return all my blogposts about TWebbrowser including the Fooling around with series. Did not know that, thought I let you know!

Thursday, September 20, 2007

On with RAD Studio 2007 with mixed feelings

Yesterday I installed the RAD Studio 2007, over my existing Delphi 2007 for Win32 (Update 3) installation.
Installation gave no problem, except for a few packages that needed to be recompiled. Although I don't need RAD Studio 2007 anymore (since it does not have a winform designer), I was curious about the new ECO IV for VCL.NET.
Well it looks that ECO is only available in the Architect edition, which it was in the BDS2005 erra, as I recall. In BDS2006 it was introduced in all the SKU's at different levels.

Anyway I have mixed feelings for this release, at one hand it fast, stable (iow it rocks!), but on the other hand it misses important features compared to BDS2006.

Go Delphi for Win32!

Friday, September 14, 2007

Fooling around with TWebbrowser #3

Some more tips to make a webbrowser application that rocks!

Get the right popupwindow size
In episode #2 we managed to retain the ASP.NET Session for popup windows in our TWebbrowser application.
Initially we don't know what the size of our popup form must be. Fortunately TWebbrowser has two events for that, so that we can size our window accordingly.
Use the OnWindowSetHeight and OnWindowSetWidth event to do this.

procedure TfrmPopUpBrowser.WebBrowser1WindowSetHeight(
ASender: TObject; Height: Integer);
begin
Self.Height := WebBrowser1.Height + 20;
end;

procedure TfrmPopUpBrowser.WebBrowser1WindowSetWidth(
ASender: TObject; Width: Integer);
begin
Self.Width := WebBrowser1.Width + 20;
end;

The additional distance of 20, is to avoid scrollbars.

Filling up a combobox with the visited websites
If you use a combobox to harvest the visited websites, just like Internet Explorer then you could use the OnDocumentComplete event to get the complete URL and then add it to your combobox. I use this event for three reasons:

1. It gives you a complete URL (not www.codegear.com not http://www.codegear.com but http://www.codegear.com/)
2. If the typed address is not available (a non existing website) the OnNavigateError event will trigger, so you could then decide not to add the URL to the webbrowser.
3. Having a good URL gives the ability to locate the URL in combobox again if the user navigates back to the page.

You don't have this advantages if you add the URL into the combobox directly after input.

procedure TfrmPopUpBrowser.WebBrowser1DocumentComplete(
ASender: TObject;
const pDisp: IDispatch;
var URL: OleVariant);
begin
AddAddressToCombobox(URL);
end;

procedure TfrmPopUpBrowser.AddAddressToCombobox(
Adres : string);
begin
Adres := LowerCase(Adres);
If (Adres <> '')
and (cboAddress.Items.IndexOf(Adres) = -1) then begin
cboApplication.Items.Add(Adres);
end;
end;
end;

Enable/Disable navigatebuttons (back/forward) automatically
If you put two buttons on your form to navigate back and forward in the webbrowser you will get an error if there is no page to go back to. (Webbrowser1.GoBack and Webbrowser1.GoForward methods)
You can use the OnCommandChange event to make this buttons 'case sensitive':

procedure TfrmPopUpBrowser.WebBrowser1CommandStateChange(
ASender: TObject; Command: Integer; Enable: WordBool);
begin
case Command of
CSC_NAVIGATEBACK: tbApplicationBack.Enabled := Enable;
CSC_NAVIGATEFORWARD: tbApplicationNext.Enabled := Enable;
end;
end;

Add a progress bar to your application
If you want to see the load progress of a page then use the OnProgressChange event.

procedure TfrmPopUpBrowser.WebBrowser1ProgressChange(
ASender: TObject; Progress, ProgressMax: Integer);
begin
ProgressBar.Max := ProgressMax;
ProgressBar.Min := 0;
ProgressBar.Position := Progress;
end;

Have the url in your statusbar or label
Use the OnStatusChange event to show the navigated address in a label or statusbar.

procedure TfrmPopUpBrowser.WebBrowser1StatusTextChange(
ASender: TObject; const Text: WideString);
begin
StatusBar.SimpleText := Text;
end;

Thursday, September 13, 2007

SA or not SA

Is SA worth while?
This is what Bruce McGee asks himself (and us) in this blogpost.
From a financial point of view it is a good deal. Personally I am very disappointed with my first SA experience.

Together with the Delphi 2007 for Win32 edition I bought software assurance because I tend to use the Delphi .NET personality for my winforms development (What was I thinking?). At that time nothing indicated that the winforms designer was not in the RAD Studio later that year.
Now that RAD Studio is out, it is kind of funny (ahum sad) that there is no reason, for me, to even install it. The Update 3 is all I need.

Is SA worth while?

Wednesday, September 12, 2007

Fooling around with TWebbrowser #2

In the last episode of this serie (9 january 2006) we talked about the fact that we could use the TWebbrowser component to display simple webpages within our Delphi application.
Recently this project extended and was used to hold a complex ASP.NET webapplication, which gave some additional problems with the ASP.NET Session object. The problem is that this webapplication popups several windows (Internet Explorer windows) which looses the session of the webapplication.
As a result the user must login on every browser, which is a showstopper of course.

The cause of this is that the webserver sees our application as a different process compared to Internet Explorer. (ASP.NET sessions are process dependent) Different process, different session. The solution of this was rather simple, although a little hard to find.

How to retain the browser session within your application
The trick is to get the popup to run into the same process as our application, so basically to run it in our application.
TWebbrowser has a NewWindow2 event for this. In this event you can specify the application to be used throught the ppDisp (IDispatch) parameter. (our application, in this event)

Suppose you have a second form, Form2, containing another TWebbrowser, you could 'redirect' the new window like this:

procedure TForm1.WebBrowser1NewWindow2(ASender: TObject;
var ppDisp: IDispatch; var Cancel: WordBool);
begin
ppDisp := Form2.WebBrowser1.Application;
Form2.Show;
end;



Quite simple, isn't it?
To let our form act in the window-name resolution it is wise to set the RegisterAsBrowser property to true.

More information can be found on knAlertz:
How to maintain the ASP.NET session state
How to use the WebBrowser control NewWindow2 event in Visual Basic .NET

Monday, September 10, 2007

VB developers, now is the time to shift to Delphi

Every now and then the discussion on how do we get 'the abandoned VB6 developer' into Delphi community pops up.

If you are VB developer, who wants to get into Delphi, now is the time to move to Delphi! If you do, and you should, you might find one of the following links usefull:

Delphi versus VB
- Delphi for Visual Basic developers by Delphi About
- VB to Delphi at Cyber Matrix.
- Migrating from VB to Delphi Whitepaper (PDF) by CodeGear.

Delphi the IDE, and the language
- Marco Cantu's essential Pascal all about the basics of Object Pascal, the language used in Delphi.
- Marco Cantu's all about Delphi Essential Delphi the IDE combined with the language.
- Zarko Gajic's delphi.about.com, with lot's of tutorials and sources.
- Delphiland offers online lessons for beginners and intermediate users
- Delphi basics provides help and reference for the fundamentals of the Delphi language.

Delphi the community
- CodeGear Delphi product page
- CodeGear Developer Network Delphi
- Delphi Newswhat Newsgroups and Blog aggregator
- Also via newsgroups.codegear.com.
Tip! Don't miss the Delphi non-technical newsgroup!

Books on Lulu
All Delphi books on Lulu
Marco Cantu's Delphi books on Lulu
Bob Swart's books on Lulu

Delphi wikis
Delphi Video's
Delphi Useful sites

Delphi blogs
Delphifeeds blog aggregator

More resources?

Wednesday, September 05, 2007

CodeGear RAD Studio 2007 announced

CodeGear announced in this press release the upcoming new version of BDS 2006 / Delphi 2007 for Win32, now called CodeGear RAD Studio 2007, to be available this month.

More information can be found on the RAD Studio product page.

Update! Technical datasheet is available here.
Much more links (product pdf's etcetera) can be found on David I's blog here.

Friday, August 31, 2007

Delphi for PHP Update #2

Delphi for PHP Update 2 is available!
Download it here.

Go get it! It contains fixes, improved documentation! and an updated VCL for PHP.

Wednesday, August 29, 2007

ADODB Promptdatasource in .NET

In Delphi Win32 it is very easy to use the standard Windows OleDB datalink connection dialog to build Connectionstrings at runtime.


It is as simple as this, use ADODB and you have the PromptDataSource function:

ConnString := PromptDataSource(Handle, ConnString);

In .NET however it is a little more complex. To make a function that can do this, you must first add references to both the Microsoft ActiveX Data Objects 2.8 Library (=ADODB namespace) and the Microsoft OLE DB Service Component 1.0 Type Library (=MSDASC namespace). In C# the code looks something like this:

private string PromptDataSource()
{
MSDASC.DataLinks dataLinks = new MSDASC.DataLinksClass();
ADODB.Connection connection = new ADODB.ConnectionClass();
object oConnection = (object)connection;
if (dataLinks.PromptEdit(ref oConnection))
return connection.ConnectionString;
else
return "";
}


In Delphi .NET the code looks like this:

uses ADODB, MSDASC; (Add to your uses clause).

function TForm1.PromptDatasource : string;
var
Datalinks : DataLinksClass;
ADOConnection : Connection;
oConnection : TObject;
begin
Result := '';
Datalinks := DataLinksClass.Create;
ADOConnection := ADODB.ConnectionClass.Create;
oConnection := TObject(ADOConnection);
if Datalinks.PromptEdit(oConnection) then begin
Result := ADOConnection.ConnectionString;
end;
end;



In Delphi .NET it is wise to remove the namespace prefixing.
Default there is a prefix Borland.VCL. If you don't remove that the compiler will use the Borland.VCL.ADODB namespace instead of the ADODB namespace from the COM import.
You can do this in the options dialog under Tools.
(Or alter your project specific namespace prefixes in the project options)

Highlander, can't take that long, can it?

It just can not be taking that much longer (in time) that Highlander (Rad Studio 2007) will hit the doorsteps. There is a lot going on, like the beta blogging, and sheduled RAD 2007 Chats and sheduled RAD Studio 2007 Developer Days.
(Taking place 5, 12, 13 september)

There are some nice beta blogging entry about the new kid on the blog.

Generics:
Bob Swart shows some generics
Hallvard Vassbotn has a very detailed overview of generics and other new language features.

ECO IV:
Peter Morris has a detailed overview of ECO IV
Dave Clegg shows, in this CDN video, ECO IV with VCL.NET
Olaf Monien shows XAML coding using .NET 3.0/WPF.

Blackfish:
John MosHakis has some information about Blackfish SQL

Intresting CodeGear blogposts
Dee Elling talks about the improved help

No, no doubt RAD Studio 2007 is coming! (Real soon now?)

Friday, August 17, 2007

Monday, August 06, 2007

Back online, catching up and the human compiler

After spending three weeks in Italy (Adriano-Ravenna) on the Adriatico coast, touching no computer at all (except my PDA) it is now time to start things up again.

Catching up the Delphi scene

It looks like Delphi update 2 is coming real soon now. (It seems someone slipped some readme file)

Nick Hodges reveals the things that are not on the roadmap, with, of course, the stopped .NET 2.0 Winform designer which I blogged about sometime ago. He talks about why development was stopped, which is understandable from their standpoint of view. Developers who does not use Delphi .NET winforms are, of course, happy about it. However for those that used Delphi .NET for Winforms since Delphi 8 they will have to move away from Delphi for that type of applications. But you know: Sh*t happens, step over it

There is a nice (new?) site called codegearguru.com with a lot of video tutorials. Have not dived into it, but it looks good.

Marco Cantu is working on a Delphi 2007 handbook.

Steve Peacocke has some nice blogposts about the history of Delphi/Pascal.

The human brain is a cool compiler
I tend to read some, not computer related books, on holidays. This year I had some book about the human brain and how it works.
Did you know that the human brain does not have to read all the letters in a word to understand the meaning of the word? Only the first and last character of a word must be in the right place. Let see if this is true, can you read this?

So Ceagoder is cionmg rael soon now wtih udptae 2 of Dlehpi. Is tihs not amnzaig? If tihs cuold be ileemepnmtd in teh coepimlr it wuold gvie lses erorrs on tpoys!

Well OK, back to work!

Thursday, July 05, 2007

Some IDE Experts

Triggered by some comments in my previous post I have digged a little into some available Delphi IDE Experts.
So far I found and used (not completed tested) the following:

1. Castalia
Castalia has two comboboxes on top of the Delphi editor, with the classes and methods of the current unit, which are great for navigating your source. Another nice feature is structural highlighting, where lines are placed between the begin and end blocks of your source. A free Castalia version is available for registered BDS 2006 users.

2. GExperts
GExperts offers lots of extra functions in the editor. To name a few: Find procedure, reverse statement, replace and rename component functions. The rename component function helps you to use your component naming convention wisely.
GExperts is open source.

3. DDevExtensions
DDevExtensions offers some nice, more technical, functions. If you don't like the BDS 2005-2006 and Delphi 2007 tool palette, DDevextensions allows you to use the old style tabbed tool palette. DDevExtensions is freeware.

4. cnPack
I have not yet used it very much, but it offers lot's of functions to help you to be more productive. cnPack is freeware.

Anyhow IDE experts can help you be even more productive in the Delphi environment.

I am sure there will be more out there, so if you have/know another one please leave a comment! (I will add it to this list)

Btw if you want to make your own expert, these links are a good start point:
Experts and Wizards in Delphi (delphi.about)
Delphi Open Tools API Nice overview and tutorial by Mustangpeak.

Friday, June 29, 2007

Some IDE enhancements to consider...

The Tool Palette has this great option of filtering its content. Give it the focus (or click the filter button) and start typing. For example you will find all the type of buttons when you type 'butt'.


This is just great!

Today I had to search a unit for specific functions, and you can search the code structure with the structure pane which is a list of all the components and methods of a unit in alphabetic order.


Would it not be nice to have a filtering option on the stucture panel too? Just type 'Formc' and you have your FormCreate event.

Taking this idea a step further, also the Object Inspector and Project Mangager could benefit from such an option.

I am not sure if anybody already came up with this, but if it is in Quality Central I sure would like to vote for it. (Did not find it yet)

Wednesday, June 27, 2007

The day after...more options?

Ok, CodeGear drops Winforms. It is now clear that I belong to an exclusive group of Delphi .NET Winforms developers out there. That sounds cool, but they now have a little problem, driving their applications into the future. I am not happy about this affaire, but live goes on. Time to sort out my options.

What was I thinking, doing Winforms development in Delphi .NET?
As I told you before I use(d) Delphi .NET Winforms for only few applications belonging to the same project.
This project is a VCL Win32 project, built up in a couple of modules (read seperate applications) which I started two years ago. Why VCL Win32? Simple Delphi is VCL
The last two modules needed Gauges and Charts. At first I builded this in VCL Win32 with TMS Software's Instrumentation workshop, however my client came up with the Dundas Gauges and Charts. And he was right, these are a class on their own.
Of course this were .NET components, which I could not use in Delphi Win32. So a decision had to be made. Basically there were two options Delphi for .NET Winforms, or VS C#. (I tried to wrap them into VCL.NET, but that did not work)
Although the controls were built for VS.NET (and supported), I choose for Delphi .NET for the simple fact that I could reuse my coreclasses by sharing them between my Win32 and .NET projects.

Bringing my Delphi for .NET Winforms apps into the future
No panic, however at some point in time I probably have to upgrade my applications to 'something else' (Or I will have to install BDS2006, and .NET 1.1 framework, for the rest of my life ;-))

At this point I think that my only option is to bring the projects over into VS C#.

More options?

Saturday, June 23, 2007

CodeGear to drop winforms designer in Highlander

Early june the roadmap for Delphi and C++ Builder was published. At first sight I found it a good roadmap.
It became even better with the updated one, where the nice codename Commodore for a 64 bit Delphi was introduced.
I first became a bit worried by a blogpost of Devexpress CTO Julian Bucknall who somehow managed to read between the lines. What he read was that C# Builder and Winforms support was dropped (Kaput as he says). His exact words:

There's no mention of the WinForms designer. Indeed, as I understand it, it's kaput. You should be using the forms designer that targets VCL.NET.

Huh? Let's take a further look at the roadmap, it says:

"Highlander" is a planned release that is both a major upgrade to Delphi .NET and a roll up of Delphi 2007 for Win32 and C++Builder 2007 into the complete 2007 RAD Studio. Highlander is planned to enhance Delphi's .NET support up to .Net v2.0 including both framework, design, and language enhancements.

Delphi developers will be able to develop rich, full-featured websites using RAD techniques and ASP.NET 2.0. VCL developers will be able to easily migrate code to managed code using VCL.NET. Delphi developers will also be able to use model-driven development to drastically improve their productivity.

Specific areas of focus under consideration for Highlander are: ... etc


OK search the roadmap for Winforms and, yes, it is not mentioned. But highlights in the above quote: major upgrade to Delphi .NET, enhance Delphi's .NET support up to .Net v2.0 including both framework, design, and language enhancements

Oh well Julian must be wrong, it will all have to do with C# Builder. Dropping C# Builder, hmmm I can imagine such a decision. Because C# Builder is in fact the Microsoft C# compiler and C# syntax = C# syntax.

Well he was not wrong, in fact he had it right. After reading this non.tech thread it was all clear to me, someone asks:

Will there continue to be a Winforms designer for Delphi for .Net? Because,
that's what our ECO applications are using and we are using DevExpress .Net Winforms components. Especially, after reading Julian's blog entry of
yesterday.


and Nick Hodges from CodeGear replies:

> Will there continue to be a Winforms designer for Delphi for .Net?
No -- we aren't going to be supporting Winforms going forward.


Shock, WTF, no more winforms support???
How can a roadmap talk about design enhancements, but in fact drop it?

Delphi .NET, the history
Before I continue it is good to take a brief look at the history of Delphi in the .NET world.
Delphi entered the .NET world, announced as a first class .NET citizen read about it here. First class with everything on it. It was a evolution, instead of the revolution, so Delphi developers could embrace .NET the easy way. Well it turned out that Borland/CodeGear had to play catch up with Microsoft. .NET 2.0 support is still not here.
I remember once at a Delphi launch, here in the Netherlands, that someone asked when will Delphi support .NET 2.0? The anwser: Within a few months after its release. OK we know that a few month became a few month more, but what the hack we can wait, we want to do Delphi, also in .NET!

Finally its there, but it is crippled without the winforms designer support.

What does this mean for Delphi.NET Winform developers?
This one is not hard to answer. Delphi .NET and C# programmers will have no form designer if they move forward to .NET 2.0 and beyond. Be assured you can manually code your design (Yeah, yeah I am looking forward to that...) and compile your code. So basically they are forced to move to either VCL.NET or VS. The first option, VCL.NET, is, imo, not a real option because the lack of thirdparty components. So the only valid option looks to be, to move on to VS. This will drive those developers away from Delphi, is that the goal? I doubt that.

What does this all mean for Delphi as a product?
Well I can only write down my own opinion here, but I think it is a bad mistake. Whether we like it or not .NET will become more and more the synoniem for Windows Development. Win32 will be supported for a long, long time but from a business point of view as well from a personal point of view (jobs) you can't deny .NET when you development has a focus on Windows. You just can't.

What for appeal has a .NET IDE with only ASP.NET support?
Personally I think it is more logic to have an IDE that support both.

Is VCL.NET a true alternative for Winforms?
I don't think so. I don't know if it is used often, but it seriously lacks thirdparty support.

I think that Delphi will continue to be strong on native Win32/64, but its .NET participation will decline.

What does this mean for me?
I always tried to pick the right tools for the right job. At this moment I do projects in Delphi 2007 Win32(60%), Delphi .NET(10%) and Visual Studio 2005 C# ASP.NET(30%).
In the long term I will probably move my Delphi .NET applications to VS C#. Fortunately they are not that big, but it will cost me some time. I think it is a pitty, because VS2005 has also it's quirks. Even now I find that Delphi .NET (the IDE) has some advantages compared to VS. (Still can't get used to the endless list of tabs in VS)
Delphi will stay to be my number one tool in the Win32/64 native development world, but on .NET it will be another story.

The roadmap
Nevertheless the roadmap has some great things for the near future (Unicode, Win64). However I find it a bad sign that the roadmap is not clear on the Winforms departure, which has great impact on the developers using it.
It seems that messages from CodeGear now, and Borland in the past, are still driving confusion, and that will affect its customers, and eventually CodeGear self.

Sunday, June 10, 2007

Trouble installing update #1, frozen Collecting Information page?

Installing Delphi update #1 on my desktop machine was smooth and rather fast ( less than a hour). On my laptop however it was a different story. :-(
The installation was "frozen" on the Collection Information page. Something that took only 5 seconds or so on my desktop PC.
After waiting for 3 hours I killed the process and downloaded the 700 Mb installation from CodeGear here.
Again all "hanged" on the Collecting information page. Having not that much patient anymore I killed the setup process within a hour.

Fortunately Robert M. Lincoln had just posted a thread in the non-tech that he had the same problem and solved it by disabling all the startup apps using the MSConfig.

(3) This time, I ran MSCONFIG, and disabled allstartup programs (using "Selective Startup", uncheck"Load startup items", leave checked "Load SystemServices", "Use original boot configuration" is checkedand greyed out). After rebooting, I ran as in (2) aboveusing the DVD from the ISO file.This time, success!

Installation was just as fast as on my desktop PC! :-)
Now wondering what app blocked the installation?

Saturday, June 09, 2007

Delphi / C++ Builder roadmap

The Delphi and C++Builder roadmap is available on the Developer Network.

Basically it drills down to this:

Second half 2007: Delphi "Highlander"
Containing support for .NET 2.0 en .NET 3.0 compatibility. All personalities will be in the Rad Studio 2007.

First half 2008: Delphi "Tiburón"
This version is about Unicode and Generics

Somewhere in 2009: Delphi "Tiburón +"
Native 64 bit support (VCL for Win64)
Support for multi-core/multi-threaded development

The direction of this roadmap seems to be OK. But that all depends strongly on what technologies you use. Overall I think it is a good roadmap.

All the details in the roadmap.

Thursday, June 07, 2007

Delphi 2007 update #1 is available

Delphi 2007 Update #1 is available for registered Delphi 2007 users. It will come through the automatic update function, or in the traditional way as a download here.

As you can see the update will uninstall you current Delphi 2007 installation, and then reinstall the one with the update. First question that raises is:

Now I will have to reinstall all components again?

The answer is No, you don't have to reinstall all components, as stated by Nick Hodges in this non-tech newsgroup thread. His exact words: "Nope -- all your settings will be retained. " .

Another tip, have your serialnumber available, because it is required for the install. (In case you are at home and the serials are in your office ;-) )
Updated: Argg I did not read the Installation notes properly, as Dave Keighan says in the comments it is not necessary to have your serials. (Only for new installation I guess) I could install update 1 immediately after all. ;0

More info in the Installation Notes for Delphi® 2007 for Win32® Update 1 document.

Monday, June 04, 2007

Delphi 2007 update #1, coming soon

Chris Pattinson posted the QC list for the Delphi 2007 Update #1.
More then 300! fixes is this update.

Read the complete list at this CDN article.

The update should come automatically for registered users through the new installer function, "Check for updates"

Thursday, May 24, 2007

So what are generics anyway?

A lot Delphi developers 'demand' generics to be added to the Delphi language, or should I say Object Pascal. Question that pops up is, What are generics anyway?

Generics where introduced in .NET framework 2.0 in the C# language. Simply said they are collections(lists) which are type safe, i.o.w. you can detect type mismatches at compile time. With other structures (arrays etc) you must check the type in runtime and then type cast to the appropiate type. So generics will make your apps more robust in a way.

Lately I have used the C# language a lot so I learned the power of generics.
Let's take a look at it!

A generic list is declared like this:
System.Collections.Generic.List<MyItem> MyItems;

Between the brackets you specify the name of the class which will be hold by the list. The compiler expects objects of this type. If you add a different type you will get a compiler error.

An example:
Suppose you have a class MyItem which looks like this:

public class MyItem
{
string FName;
public MyItem()
{
}

public string Name
{
get
{
return FName;
}
set
{
FName = value;
}
}
}
You can now fill the collection(or should I say List?) FItems like this:

MyItem Item = new MyItem();
Item.Name = "First";
FItems.Add(Item);
MyItem Item = new MyItem();
Item.Name = "Second";
FItems.Add(Item);
We now have a list with two MyItem objects.

You can search within the list using the Find and Findall methods.
Suppose you want the second object you could find it like this:

MyItem SearchedItem = MyItems.Find(delegate(MyItem SItem)
{
return SItem.Name == "Second";
});
Through a anonymous delegate it returns the object which matches the criteria. The Findall method returns a list with objects, for example all objects where a specific attribute matches.
There is a lot more to explore, for more information look at the MSDN website.

Generics and Delphi
Generics are planned for the Delphi Highlander release, later this year (Roadmaps coming in june!). In september 2006 Nick Hodges showed at the EKon 10 / BorCon Europe conference a preview of the syntax. Bob Swart has published a few notes about it here.

Wednesday, May 09, 2007

Delphi for PHP Update 1 is out there

Delphi for PHP update 1 is out!

According to the CDN article fixes in this update are:

-Fix to the IDE to ensure correct storage of UTF-8 strings in the .xml.php
-Fix to VCL for PHP to parse .xml.php in UTF-8 mode
-Save Project As... fixed (QC 43580)
-Updated sourcecode documentation for the VCL
-Fixed problem with PHP 5.2.1. The Input Filter extension is out of beta and function for filter data was changed to a new name, so Input object now takes that into account (QC 43607)
Fixed problem with vcl-bin folder. The alias is set to be a root alias, making it easier to configure on deployment
-Added global var to specify if properties are html_decoded when read from the .xml.php
-Corrected support phone list .txt file

Go get it here.

Tuesday, May 08, 2007

A hyperdrive factory, or how to get a cat out of a tree

Steven Trefethen has very good blogpost about the endless stream of new technologies coming from Redmond.

He says:
Will there ever be some sort of stabilization period where apps can mature and the technology settles into a known state where developers are comfortable about the foundation from which their working?

It definitly is very difficult to keep up with all the new stuff, before knowing the 'old' stuff entirely.
(.NET 1.1 stuff is suddenly 'deprecated' in .NET 2.0, oh well move on...)

He asks:
What about you, how are you dealing with all of this? Or are you dealing with it?

Well not really. Although I keep an eye on the new technology and occasionaly play with it. But mostly, I think, it is better to watch the cat out of the tree. (That is a dutch saying "De kat uit de boom kijken") It basically means you can do a lot to get the cat out of the tree, but if you wait a little longer the cat may decide to come out of tree itself.

And you know what?
The more things change, the more they stay the same!'

Wednesday, May 02, 2007

It must be spring...

It must be spring, it looks like everyone (not an understatement here ;- ) ) is cleaning/pimping up their website.
CodeGear launched yesterday their new website, with their new logo. Content looks the same, but I think it looks great!

Also Delphifeeds.com changed the look of their website, providing more functionality like a new Delphi forum.

Great work guys!

Wednesday, April 25, 2007

On with Delphi 2007, BDS2006 Win32 personality retires from the scene

Well I finally converted all my projects from BDS 2006 to Delphi 2007. As promissed by CodeGear there were no fatal issues involved because of the so called 'binary compatability', Besides the usual stuff like installing updated third-party libraries and adding search pathes etcetera everything worked fine.
It is a good thing to make an installation protocol, because installations of the package (sometimes) need to be installed in the proper order. A protocol makes the process even smoother. (It is scary how fast you forget the installation order)

One issue I have had was a problem with the Help after installing my devexpress components. After installing these components there is an issue regarding the Filtering in the Help which then shows only the devexpress help, which is a pitty because the Delphi Help is so much improved. Fortunately Devexpress has an temporary solution which you can find here. (Issue AB12388)

All with all a smooth transition with no fatal ('Oh oh......') moments. ;-)

Now I only use BDS2006 for my .NET related projects. It is a bit strange to have two seperated Delphi's again just as with Delphi 7 and 8, but BDS2007 is on its way so that should be temporary.

Update: I noticed that BDS2006 is not shown in the taskbar. I am not sure that this has to do with the installation of Delphi 2007. Easy to solve anyway, minimize once and it is back.

Friday, April 13, 2007

Back to Delphi 5

Well I am back to Delphi 5. I have had it.......;-) No, no, just kidding :-).
I am very happy with Delphi 2007, but for a new project, I should say, a new, exsisting project, I will have to use Delphi 5. This project has some librarys in Delphi for which the source code is not available so there is no choice for the short term.
Delphi 5 was released around 2000 as I recall, so that was somewhat in the Windows 98 erra. I installed it on a rather old machine with XP (PIV 2,4 GHz, 512Mb)
First thing I noticed was its speed. Wow this runs fast on a clean installed machine. With no libraries installed it runs like Formule 1 car!
And yes component templates already exists in Delphi 5 just as incremental searching.

Well it is fun to step back in time, but I instantly miss the most of recent added features like Tool palette filtering (there are a lot tabs in the old style tool palette), code templates, refactoring etcetera. Will plan for upgrading the project soon :-)

Monday, April 02, 2007

D4PHP database connections with ADOdb

In my quest to setup a DSN less connection to an Access database I found ADOdb on sourceforge which apparently is used by Delphi for PHP.
Here you will find lots of information on getting connected to *any* database.
See this nice overview with all possible database connections.

Update 3-4-2007:
You can setup a DSN less connection to an Access database:

Database.DriverName = "access";
Database.Host = "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\\phptest\phptest.mdb;"

This should also work, using the jet OLDB provider, but somehow it did not work for me:

Database.DriverName = "ado_access";
Database.Host = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=c:\\phptest\phptest.mdb;USER ID=;PASSWORD=;";

Saturday, March 31, 2007

D4PHP a first impressions review

As a non PHP programmer, let's say a PHP rookie, I was excited that Delphi for PHP hit the doorstep this week. I always wanted to use/learn PHP but for several reasons that had not happen, until now. Delphi for PHP seems to be a very good start point for learning PHP as a Delphi programmer.

Installation
Installation gave, as expected, no problems. The installation is a little different to Delphi 2007 for Win32 which we now might consider the sister or brother of Delphi for PHP.

Using Delphi for PHP
After starting Delphi for PHP you will feel right at home because the IDE is almost similar to Delphi 2007. It is all there, the Code Explorer, the Object Inspector, the Project Manager and the Toolpalette. Also the welcome page is present.
The look and feel is the same, however the working of some elements are slightly different compared to Delphi 2007. (For example Code Insight and debugging 'feel' different)
Delphi for PHP comes with a lot of samples. The sample projects are located on a, not that, obvious location namely "C:\Program Files\CodeGear\Delphi for PHP\1.0\VCL\Samples". After some searching I found this link via the "Sample and Demos" link on the Welcome page.

The componentset, offered on the Tool Palette, is amazingly similar to the Delphi 2007 standard set. You will recognize lots of components, from Button and Edit, to Actionlist and PageControl. Also the Database control, like DataSource, Table and Query are available.
This really gives Delphi programmers a headstart!

My first PHP webapplication
OK, time to build my first PHP application.
Armed with my free PHP 5.0 power programming book I started some basic coding. PHP syntax is similar to C syntax, but that is another story. Using the VCL and its controls is a known experience:
Drop a Listbox, drop an Edit and a Button, double click the button and the ButtonClick event appears in the code just as in Delphi. The IDE is a little slow on drawing the controls on the design interface, but it is not disturbing me.
Debugging the code is easy although it does not show parameter values in a hint when placing your mouse on it. I suppose this will be improved in later versions.

Where is the HTML?
Using ASP.NET HTML is immediately generated on the design page. In Delphi for PHP you will not find any HTML (at least I did not find it yet, is it there?).
At first it is a bit strange and scary that there is no HTML (we are building a website, aren't we?) and gives you the feeling that D4PHP is mainly for pure application type websites instead of fancy HTML websites.
But D4PHP offers a template model for HTML files which can be used to "inject" your PHP components and code into HTML.
Big difference to ASP.NET, but I think I may like this. It seems to divide code and layout even more then ASP.NET. (First impression, have to investigate this much more)
Nice side effect here is that the IDE can't mess around with the HTML which happens a lot when you use ASP.NET IDE's like Delphi or Visual Studio.

There is a nice template demo in the sample projects which shows this technology.
A HTML page with D4PHP injected PHP looks like this:

{$lbMessage} is a label on your PHP page, just as {$RichEdit1} and {$btnSendContens}. On your page you code the button click, in this case the text of the RichEdit control is placed into the label lbMessage.

When the application runs the PHP controls are injected into the template and code runs just normal.

Looks pretty flexible to me.

Using databases
D4PHP offers a, almost endless, list of possible database connections. Two of them, MySQL and Interbase, are supported by the Data Explorer, and can be used to drag-and-drop database connections, tables and fields.
I tried to setup a connection to an Access database which I happen to use for my website, but I have not yet been able to get it to work.
HELP (F1)?
Press F1 and help is executed immediately. The Help however is a bit dissapointing. It is context sensitive and finds the right property, but gives information like this:

This is getConnected, a member of class Database

Well we knew that, didn't we? We would like to have information on how to use it!
A good alternative is the sourceforge help which seems to give more information.

Conclusion
Delphi for PHP is a real member of the Delphi family. The IDE and VCL will be very familiar to Delphi programmers. Coding in D4PHP is like coding in Delphi, quick, clean and easy.
Its alternate approach (I compare this to ASP.NET) is refreshing and the more I think about it the more I like it! Using Templates with PHP injection seems to be a very flexible and clean solution.
The help and documentation is not good and needs huge improvement.
Considering that it is a 1.0 product I think it is a great piece of work. It inspires me to dive into PHP 'the Delphi way'.


Use an image as your UIBarButtonItem

Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...