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'.


Wednesday, March 28, 2007

Wow! This is VCL

CodeGear released this week Delphi 4 PHP. Read the press release.
Today I found out that the documentation of the Open Source class library, which Delphi uses, VCL for PHP is available on SourceForge. You can find it here.

A quick scan shows that this is VCL as we know it!
Object, Persistent, Control they are all there!

Can not be to difficult to learn PHP this way, can it?
There is also a one day (One day?) trial available for download here.

Friday, March 23, 2007

Trouble viewing blogs.codegear.com on Vista?

Recently I discovered that I could not view the blogs.codegear.com website on my new (very fresh) Vista computer. It was not IE related because also in FireFox the website was not shown. After setting virusscanner, firewalls, parental control(?) on and off it still did not work. (Bummer :-$ )

Finally I asked in the delphi.non-tech newsgroup, and guess what? As always it was fortunately not just me, but a common encountered problem. :-)
Thanks to Roddy Pratt I finally found the solution, which also comes in play by registring Delphi 7 and Delphi 2006. You can find the solution on the Borland support site.

I don't know what the exact problem is but it looks like a TCP/IP problem between Vista and the CodeGear server. It is very strange that some Vista installs do not have this problem. More information on this issue through Google.

By the way, just found out about this new dutch Delphi for PHP forum http://www.delphiforphpforum.nl/ (in dutch)

CodeRage session replays available

Did you miss a few sessions on CodeRage? I know I did.
Well that is no problem: The CodeRage session replays are now available on the CodeGear Developer Network.

Tuesday, March 20, 2007

My 5 favorites in Delphi 2007 for Win32

OK, so I have been blog-tagged by Pawel Glowacki to tell about my 5 favorites in Delphi for Win32.

To make my life easy I could list all the things that already have been listed by several bloggers, and beta bloggers. Here is a quick list of favorites I could come up with:

1. Delphi's speed
2. Delphi's stability
3. The improved Help system
4. The new DBX4 architecture
5. The new build system
6. The Vista readiness
7. The improved memory manager
8. The improved tool palette filtering
9. The enhanced welcome page
10. The new installer

But that would be too easy, wouldn't it? Yes it would, so I go for an alternate approach:

My 5 favorites in Delphi 2007 for Win32:

1. Confidence
Delphi 2007 is one of the many signs that things has changed (and are probably still changing) at Borland/CodeGear. These guys are really listening and working hard to give us the tools we need. This only makes an upgrade worthwhile. I agree 100% with this thread A vote of confidence (started by Estaban Pacheco)

2. Quality
And I not only mean the quality of Delphi itself, but it allows me to supply my customers with first class robust, fast and high quality applications. OK, Delphi has had some 'dark' versions, they were gone with BDS2006, but will be vanished with Delphi 2007!

3. The 'built in' ability to beat my competition

Delphi always gave me a great benefit compared to my competition. Never ever have I made an application as fast, and as good (see point 1) as in Delphi. In Delphi 2007 this has (again) increased!

4. Fun
Programming in Delphi is fun, sometimes it looks like no work at all. That's been for 15 years now and it still continues with Delphi 2007!

5. The bright future
VCL, VCL.NET (the bridge to .NET), Delphi for .NET 2.0 (planned for mid 2007), Delphi for PHP. Should I continue?

Well that's it! Now I tag the following persons:

1. Bob Swart (Dr. Bob)
2. Robin (Turbo for Noobs)
3. Nick Hageman (Where are the posts?)
4. Marco Breveglieri
5. Ace Breakpoint (Hope you still use Delphi Ace!)

Sunday, March 18, 2007

Delphi 2007 Win32 is released!

Last friday, 16 march 2007, Delphi 2007 for Win 32 was released. The lucky onces who could get ESD(Electronic Software Deliverance) are now able to download and play with it. I will have to wait a little longer until it drops on my doorstep. :(

Although I found BDS2006 very acceptable in terms of speed and reliability it seems that Delphi 2007 is 'the succesor to the max'. Very positive reports can be read around the Internet. You can find a very nice overview of all the Delphi 2007 blogentries on here. (Thanks to The Delphi Geek: Primoz Gabrijelcic)

Well and now we wait (a little longer).

By the way Brian Layman announced that the Delphi for PHP betabloggers are on their way!
Love to see more of that product.

Wednesday, March 07, 2007

Will there be another Delphi? VCL for Ruby?

Will there be a VCL for Ruby? A question Mike Pence asked himself a few days ago in this blogpost.

He says:
There has been nothing like Delphi since Delphi. For an all-too-brief, shining moment in the late 90’s, nothing could touch it. Its visual design tools made it simple to build attractive user interfaces.
............
What made Delphi even more remarkable was its component model in the form of the Visual Component Library.

The answer to his question is given by Michael Swindell in his feedback of the mentioned post. Now I don't know much about Ruby but when I read Mike's answer in this post I can feel the excitement!

He says:
So, wow. How awesome is that? Borland makes tools that fill the entire application lifecycle — not just IDE’s and frameworks –but it is their top-shelf development tools that have made them famous, and they are coming to play.

So Delphi is not a language anymore? No, apparently it is not, get used to it. Delphi is a way of living (Oh well at least developing ;-) ).

Saturday, March 03, 2007

CodeRage sessions on www.thecoderage.com

CodeGear has a new website for it's virtual conference CodeRage (www.thecoderage.com) which will take place from march 12 - 16.

Here are the most interesting links:
Agenda
All the sessions
Virtual Exhibit Hall

Tuesday, February 27, 2007

Delphi Technical Seminar in the Netherlands

Just got back from the CodeGear Technical Seminar 'Delphi Technology Previews and Roadmap update' in Amstelveen (near Amsterdam).
At least 180 developers joined this seminar. This seemed to be more then prior years. It was pretty crowded.

Delphi 2007 for Win32: DBX4
After a short introduction by David I, Pawel Glowacki gave an introduction in DBX4, the new cross platform database technology formerly known as dbExpress 3 (win32) and Borland DataProvider (.NET). DBX4 bundles this two technologies into one. For more information on DBX4 you can check Steve Shaughnessy weblog.

Delphi 2007 for Win32: MSBuild
Jason Vokes showed the new built system MSBuild that is bundled with Delphi 2007.

Delphi for PHP
The most interesting part of the seminar, for me, was to  see Delphi for PHP in action. Again CodeGear has a winner here!
Pawel built an PHP application which uses a Connection component, a Query component and a DataSource component that were hooked up, just like Delphi to a grid. No code to be written yet. And all pretty understandable for a Delphi developer with no PHP experience. 
The only difference between Delphi Original and Delphi for PHP seems to be the language. Everything else has the look and feel similar to Delphi.
I found this video showing the demo including the use of a data dictionary.

Although stated in the seminar title there was no roadmap shown. Of course there is on going work in many areas of Delphi but no exact dates or shedules were mentioned. 

Monday, February 26, 2007

Free PHP 5.0 book

OK, so now that we have Delphi for PHP almost on our doorstep it is time for those who don't do PHP yet, but who want to do PHP now, to gather PHP information.

I always wanted to do PHP, but never had, or took, the time to dig in it. Now that CodeGear offers PHP 'the Delphi way' the time might have come to go for it!

During 'googling' for interesting PHP sites I found this free PHP book:

PHP 5.0 Power programming

This book must cover all PHP related stuff because it has more then 700 pages! (For sure didn't read it all yet)
You can download it here. (Like I said its a free PDF download!)

Wednesday, February 21, 2007

Delphi 2007 for Win32 and Delphi for PHP

As you probably already know CodeGear announced yesterday Delphi 2007 for Win32 and Delphi for PHP. I will not sum up all the features here again because that is done already by many bloggers, but will summarize most of the stuff.

Delphi 2007 for Win32
Delphi 2007 for Win32 is a Win32 personality only. As stated by CodeGear this is a direct result of the Delphi Survey. Delphi 2007 is a Studio member and therefor it will be integrated in the next CodeGear Developer Studio codename Highlander.

*Should I upgrade to Delphi 2007?
Good question if you are a BDS2006 user, like I am, you would probably answer this question with no. Why not wait a little longer for Highlander to arrive?
Delphi 2007 is a none dcu breaking version which means that (almost) all your code should run fine. I.o.w. upgrading from BDS2006 should be painless.
CodeGear also offers software assurance, which mean that if you buy Delphi 2007 you would get all the Studio members for the coming year including Highlander. In that case upgrading now would be a wise decision indeed.
If you use Delphi 7 or earlier then you probably are a Win32 developer only, and then this is the moment to upgrade.

*Note this is my interpretation of all the information flooding on the web. Please check the CodeGear websites and blogs for all the details.

Here are some links:
CodeGear Announcement
Delphi 2007 product page
Delphi 2007 Faq
Delphi 2007 Datasheet
Nick Hodges talking about SA (and clearing some confusion)
Answering Questions and Clarifying

Delphi for PHP
Delphi for PHP could be a real winner for CodeGear. Delphi for PHP is a Delphi implementation for PHP, so beware it is not PHP with Object Pascal, it is just PHP the Delphi way done.
Some argue that the name Delphi for PHP is cluttering the Delphi name, because Delphi is known as language (Object Pascal), or was it an IDE, or a framework (VCL). Anyway it will attract attention to Delphi as whole, which is, in my opinion, a good thing.

Delphi for PHP in fact is qstudio from quadram, which I blogged a month ago about. It looked, and looks of course, very familiar with Delphi. Some people already wondered back then......

Did you subscribe to the qadram qstudio newsletter list?
On the qadram site is announced that those people will get a special offer for Delphi for PHP! (Hmmm I think I wait a little longer...)

Here are some links:
CodeGear Announcement
Delphi for PHP product page
Delphi for PHP Faq
Delphi for PHP Datasheet
DNTV: Delphi for PHP introduction

Monday, February 19, 2007

Delphi: Still more to explore

The real fun with Delphi is that you discover functions and tools that were sitting there, probably for years, without being noticed by you at all. A good example is the possibility to search incremental using CTRL+E, which I blogged about a year ago.

Today such an event occured to me again. Suddenly I noticed at the main menuitem 'Component' the item 'Create component template...'.

Humm what would that be?

Component templates gives you the ability to create a 'snapshot' of a component(or several components) at the time of creation that you can place in a category of your toolpalette. With the purpose of using it again as it is. Man so simple but so effective!

For instance how many times did you populate a TOpenDialog to open a Word Document? (Drop the component, set the filters etc.) Now you do this one time, and then create a Component Template named 'TOpenDialogWordDocuments' (or whatever) and next time you need an Open dialog for Word documents  just use the component template and ready!

As said you can use Component Templates with more then one component so that you can 'wrapp up'  components to one component.

Great stuff! At what version of Dephi was this introduced?

Friday, February 09, 2007

CodeGear is gearing up

Well some pretty important announcements are made by CodeGear in the past few days:

1. CodeRage 2007
CodeGear announced a virtual conference called CodeRage 2007. This will be held in the second week of March.
This might be the first (Formerly known BorCon, DevCon) conference that I will be able to join. (No Transatlantic flight needed)
Curious about the session, visit the CodeRage website here.
(At this moment no sessions mentioned, but I'm sure that they will in the coming days.

2. Delphi public field test
Nick Hodges announced the Delphi Public Field test on his blog. As far as I know this is the first time that this is done and it shows the new way of doing things at CodeGear. If you want to join you can apply on his blog.

Well and then there was this 'leaked' information of new Delphi versions in the make. See this blogpost by Marco Cantu for a great summary on all the rumors around Delphi.

After a couple of weeks relative silence (except the CodeGear announcement of course) things are definitely gearing up!

Thursday, February 08, 2007

Delphi Astro, Delphi Spacely

Two names popping up in this delphi.non-technical thread for new Delphi versions. According to the thread:

Delphi Spacely - Delphi for Vista (Win32 and AJAX)
Delphi Astro - Delphi for PHP

The source of this information is a Swedish reseller. More info in Swedish through this link.

Although not yet confirmed or announced officially by CodeGear this sounds very interesting to me. (It is by far the first of April so......)

Keep an eye on CodeGear for possible announcements the coming days.

Sunday, January 28, 2007

Anders on LINQ and functional programming

Through Charlie Calvert's weblog I found this post where Charlie interviews  Anders Hejlsberg  about the forthcoming LINQ technology and functional programming.
Being old Borlanders they talk about the evolution of programming languages and IDE's, which is for a large group of programmers (including me) Turbo Pascal - Turbo Pascal OOP - Delphi - C# (for .NET) and, as they say, the next BIG thing will be LINQ.

LINQ stands for Language Integrated Query, and will be introduced in C# 3.0 (Code name Orcas). Well I could try to explain what it is here, but you better watch the video where Anders gives a very good (and simple) introduction in the use and usability of this new technology. He also talks about the use of Lambda expressions which play a great role in LINQ.

Anyway intresting stuff...

Watch the streaming version, or download it.

Thursday, January 25, 2007

Friday, December 22, 2006

Delphi: Five reasons

Nick Hodges gives five reasons for ISV's to use Delphi in his blogpost Delphi: The choice for ISVs.

I totally agree with them. Under the motto 'Spread the word'  I decided just to copy them here:

  • Delphi supports development of native code applications. For ISVs and MicroISVs, native development is really the only choice. Such developers can’t yet assume that the .Net framework is installed on a potential customers machine, and either including the .Net Framework with your install or directing potential customers to Microsoft’s website to download the framework can make trying or using such a product too difficult. Delphi builds fast, tight, native apps with no runtime dependencies. That’s the only choice for an ISV today.
  • Delphi provides rapid application development on the Win32 platform. Given that native development is the only choice, Delphi is the only RAD tool for Win32 developers that is still being advanced and developed. Other major tool vendors have dropped all support for native RAD development Delphi, however, continues to provide you with a powerful RAD IDE and the Visual Component Library. Delphi’s Win32 tools are also continuously being updated and improved. CodeGear realizes that Win32 is and will continue to be a viable and useful development platform for years to come.
  • The VCL provides you a path to Win64, .Net and Vista. The VCL has proven to be not only powerful, but adaptable as well. Originally developed for 16-bit Windows, the VCL was easily moved to the 32-bit world. More recently, VCL has been ported to the .Net 1.1 platform and will soon be moved to the .Net 2.0 Framework. Future plans also include migrating the VCL to support the new native Vista controls and APIs as well as a version for native Win64 development. With the VCL, you have a proven development framework that will go with you if and when you decide to support these new platforms. If and when managed code becomes the norm, your Delphi code will be ready to take you there.
  • The Delphi Community is large, varied, supportive, and knowledgeable. One of the strengths of the VCL is that it is a component-based architecture. Right from the very beginning, Delphi programmers were component programmers, and right from the beginning they shared their code, whether it was in the form of freeware, shareware, or commercial offerings. The Delphi community is strong and dedicated. Once the web came into the forefront, websites providing Delphi components, technical articles, and code libraries sprung from the woodwork. The Delphi newsgroups provide free, peer-to-peer support where experts of all levels and capabilities cheerfully answer your questions of any level. There are countless free and open source component and code libraries. Delphi developers are there for each other.
  • Delphi is a proven ISV development tool. Delphi is a fully powerful and capable development tool. There isn’t any doubt that it can handle anything an ISV could throw at it. FeedDemon, FinalBuilder, BeyondCompare, the Skype Windows client, and AutomatedQA tools are all popular and widely used tools built in Delphi. These companies have realized the power and advantages of a native, RAD development tool that has a strong, supportive community and been successful building their products in Delphi.
  • Go, Go, Go, Go, CodeGear!

    Saturday, December 16, 2006

    Rehook your links, CodeGear is up!

    The CodeGear website is online! Time to redirect all the links (and there are quite a few) from Borland.com to CodeGear.com.


    My first impression of the website is that it is a very 'clean' website with clear navigation.

    Good job CodeGear!

    Friday, December 01, 2006

    Free IDE's

    On Bitwise Magazine there is an interesting article 'Free, Free At last' with a list of IDE's which are all for free!

    Among them of course the Turbo's.

    Surprisingly, there is now quite a range of first rate development software that can be yours (legally) for a total outlay of Zero Dollars - which, at the current rate of conversion, coincidentally works out at precisely Zero Pounds, Euros and Yen too!

    One particular IDE of interest for me is the PHP IDE, called qstudio, from Quadram software. This is an IDE for PHP development which looks amazingly like Delphi. QStudio is to be released this december, so keep an eye on it!

    Wednesday, November 22, 2006

    Office 2007 GUI License

    Office 2007 introduces a complete new GUI interface. One of the eyecatchers is the so called Office 2007 ribbon.
    Today devexpress announced the availability of the Ribbon control for both the .NET users as the VCL users (currently in Beta). For VCL users there is also (among others) the Toolbarpager control from TMS Software.
    According to Julian Bucknall's blogpost the ribbon can only be used if you obtain a license from Microsoft. (A vendor's license does not cover a user license)

    Quote from Julian's blogpost:
    To summarize, if you want to use a ribbon in your applications (whether you decide to use either our .NET or our VCL components or, horror, someone else's :) ), you will have to sign the Office UI licensing agreement with Microsoft. This no-cost license is a royalty-free agreement between yourselves and Microsoft that enables you to take advantage of the intellectual property (IP) that they've embodied in the new Office 2007 UI (including copyrights, trademarks, and patents). Part of this license is a remarkable document: the Office UI Design Guidelines that describe, in almost excruciating detail, how the ribbon and its associated controls must work and must look in an application in order to satisfy the license.

    Microsoft has invested a lot of money in creating the ribbon, so in a way it is generous that they allow us to use it at no cost, although I personally find it a bit strange to license a GUI (Just a bunch of pixels on the screen, isn't it?) and earn nothing with it. What is the deal? What is the catch?
    Can't figure out Microsoft's intention with this except that all ribbons should work according their guidelines.
    But how will Microsoft prevent a from scratch build ribbon with little different functions and ways?

    More information can be found here:
    Jensen Harris blogpost : Licensing the Office 2007 user interface
    The announcement by Microsoft.
    The Microsoft office UI guidelines preview. (PDF 1,4 MB)

    Sunday, November 19, 2006

    Third party components

    One of the great things about Delphi is the fact that there are a lot of awesome third-party components out there. Commercial, Open sourced and freeware, you name it, there are good quality components plenty in each category. And as a tradition they (mostly) come all with sourcecode.

    The benefits of third-party components are obvious but depending on the component set. There are components that give your application a modern look, while others solve a particular programming problem like communication protocols.
    But it all comes down to the fact that using third-party components gives you the benefit of "dealing with the meat, instead of beans".
    Besides that, if your vendor adds some nice new feature to a component, you can add that feature to your application by simply upgrading your components.

    A disadvantage of third-party components is the fact that you become, sort of, dependent on the vendor.
    Upgrading to a new Delphi version means upgrading the components. In other words you can only upgrade if you have all your components upgraded. So a lazy vendor can frustrate your upgrade plans.

    What if a vendor goes out of business?
    As said most components come with sourcecode, so in the worst case you can maintain the code yourself, although that was not the deal of course.

    These are some consideration we made before using/buying third party components:

    1. Standardize your development. Use prefererd components for specific tasks. (For example try to use, as default, one componentset for all your GUI work. Don't mix them if not necessary)
    2. Use only components if they come with source code. This eliminates your dependency. (A positive side effect is that you can learn a lot from the source code)
    3. Buy 'long term licenses' like SA or subscriptions, so that you get updates for your components.

    Our 3-rd-party favorites are:

    1. Devexpress VCL Components. This set is our default for GUI work.
    2. TMS Software Components. Besides a large component set, they have a few specific components for scripting and instrumentation.
    3. ReportBuilder from Digital-Metaphors. An outstanding reporting solution with an awesome end-user solution, right out of the box.
    4. AVLock Gold, a share ware component that helps you to turn your application into a trial version with only a few lines of code.

    Conclusion:
    Third party components are great. Buy/use them only if they come with source code. And last, but not least use them wise!

    What are your favorites? 

    Wednesday, November 15, 2006

    CodeGear := Borland as DeveloperToolGroup;

    This is the moment, well last night (here in the Netherlands) was the moment. The Borland Developers Tool Group (DTG) becomes Codegear. See the original press release.

    Have not yet read all the details, but it seems it is a separate company yet owned by Borland which will be independend by the end of next year.
    For a (long) list of blogpost and comments see www.delphifeeds.com

    Go CodeGear!

    Tuesday, November 07, 2006

    Microsoft urges Delphi developers to .NET

    According to Tim Anderson's blogpost Microsoft has a special session at the Tech-Ed in Barcelona targeting Delphi developers.

    Quote from Microsoft session:
    Even if you are not considering .NET now, at some point you will have to move to .NET with new code, or to port existing code. Staying with Win32 may be viable in the short term, but not the long term.

    Well, I am not sure what to think of this. There might be some point in time (who knows?) that you will have to move to .NET, however there are no signs on the wall that Win32 is being abounded real soon.
    Delphi developers can still make awesome Win32 applications, which have plenty of opportunity to be ported to .NET at some time in the future with minimum effort. (I have blogged about the possibility's here ).

    Delphi is all about being able to choose.

    Monday, November 06, 2006

    How to persist a TPersistent?

    In a recent project the end-user should be able to do some settings of a specific control. The control, an InstrumentMeter, has a lot of properties, and only some properties, like color, scale etc. had to be customizable by the end-user.

    A very common way to let a user edit properties is to use a RTTI property inspector. The user can then edit properties in a Delphi way. I use the Devexpress RTTI inspector, but there are many alternatives outthere. The RTTI inspector object has a property to link the 'to be inspected control' called InspectedControl of type TPersistent.
    Because users may only edit some of the properties I could not set the control there, because all the published properties would become editable.

    So I decided to make a wrapper class for the control, which published only the necessary properties and 'links' them to the InstrumentMeter control.
    (You can inherit a control and publish only those properties that you want to, but this works only inside of Delphi) 

    I decided to inherit this class from TPersistent, so that I could set it in my RTTI Inspector.
    The class looks somewhat like this:

    type
    TInstrument = class(TPersistent)
    private
    public

      //the InstrumentControl  
      property InstrumentControl : TInstrumentControl;
    published
      //All enduser props
      property Kleur: TColor read FColor write SetColor(const Value : TColor);
      property ...
    end;


    Properties set by the user (for instance Kleur) must be saved to a database. I could of course extend a table with fields for all the properties, but having several types of instruments this would give a lot of extra fields.

    Why not persist the TInstrument object?
    Yeah great idea, stream the object into a blobfield of the database. This can be done easily with a TComponent class, but how do you do this with a TPersistent class?

    A TComponent class could be streamed with the TStream WriteComponent method like this:

    MyStream.WriteComponent(AComponent);

    This stream then, could be saved into a Blobfield and later on read with the TStream ReadComponent method.

    I realize that I should inherit from TComponent so that I would not have a problem streaming, but hey let's persist on the TPersistent for now.

    How to save a TPersistent to a stream?
    As far as I know now, this is not possible.
    The only way to do this, as far as I know, is to use a DummyComponent (TComponent) with a property holding the TPersistent object, and then streaming both in the database. That works fine!

    The code looks like this:

    type
      TDummyObject = class(TComponent)
      private
        FPersistent: TPersistent;
      public
        //Property for holding my Persistent object
       property Persistent: TPersistent read FPersistent write FPersistent;
    end;

    procedure SavePersistentToStream(APersistent: TPersistent; AStream: TStream);
    var
      DummyObject: TDummyObject;
    begin
      DummyObject:= TDummyObject.Create(nil);
      try
        DummyObject.Persistent := APersistent;
        //write the component into the stream
        Stream.WriteComponent(DummyObject);
      finally
        DummyObject.Free;
      end;
    end;

    procedure LoadPersistentFromStream(APersistent: TPersistent; AStream: TStream);
    var
      DummyObject: TDummyObject;
    begin
      DummyObject:= TDummyObject.Create(nil);
      try
        DummyObject.Persistent := APersistent;
        AStream.ReadComponent(DummyObject);
      finally
        DummyObject.Free;
      end;
    end;

    Writing this I decided to inherit from TComponent anyway (why not?) but the question remains, are there other ways to persist a TPersistent?

    Friday, November 03, 2006

    Two weeks of Delphi

    We have had the 24 Hours of Delphi, The Delphi Hour weekly podcast, and now we also get two weeks of Delphi!

    Two weeks long every day one hour live Delphi and C++ Webinars!
    This webinars are highly interactive, you can contact the presenters by e-mail, skype etc.

    Starting 6 nov. - 17 november.
    For details check out the Borland Developer Network.

    Thursday, November 02, 2006

    The bug by accident #2

    OK, you think you found a bug, you report it very carefully in Quality Central and write something about in a blogpost, all because of the fact that the bug was caused accidentally.

    After that you expect some confirmation of people who encounter the same problem. It happens that no one else so far, including some coworkers can reproduce this bug.
    Huh, time to investigate some more. For those who did not read the blogpost, the bug happens when you type, or paste, the string =: in a class definition. Memory is freaking out upto 1,9GB.

    Investigate
    Looking more carefully to the Windows Taskbar it appeared that 1,9GB is used by Windows, but only 15MB by BDS.exe. No other processes use even more memory then BDS, where did approx. 1GB memory go???
    As someone suggested I did stop the Error Insight feature but had no luck, the bug is still there.

    The solution
    After turning off most of the BDS features the problem still persisted, and I asked myself why to put so much effort in a bug, which only happens by accident.
    Anyway I found the part that causes the problem : Castalia 4 BE.
    After turning off the 'Enable Delphi parser'  option the bug was gone.

    Conclusion
    This bug is caused by Castalia in combination with BDS. QC Report updated. (Pooh it isn't me :-) )
    Can someone please confirm this? (After confirmation I will drop an email to Castalia about this problem)
    What is causing the huge amount of memory while no process owns it?

    Well all this trouble for a bug which was not meant to be a bug...

    The bug by accident

    Today I encounterd, by accident, a 'bug' in Borland Developer Studio using the Delphi personality. I do quote the bug here, because actually it is not a bug, but on the other hand it is a bug. (How about confusion)

    Accidently I pasted a string in de class definition of a form. The pasted string happened to be part of a query with a parameter in it.

    "WHERE somefield =: SomValue "

    After this BDS increased its memory usage upto 1,9GB!
    This is definitly a bug, but what is the chance that you encounter this bug?
    Actually almost zero. I mean who types a '=:' in a class definition? Well ahum I do.

    I assumed this bug has something to do with Error insight, so I reported it in Quality Central where you can find in under QC36020.

    Main issue here: Is a bug a bug until he (or she) is discovered?

    Go try it yourself!

    Steps to reproduce:
    1. Start BDS2006
    2. Create a new VCL application
    3. Type =: in, for example, the private section of the TForm class definition

    Thursday, September 28, 2006

    Turbo Command line compiler available

    According to Chris Pattinson (Borland/DTG) in this newsgroup thread the command line compiler for registered users of Turbo Professional is now available for download here.

    It seems that the command line compiler is needed to install third party components like Developer Express and JVCL.

    Tuesday, September 19, 2006

    It's hot out there

    Not only the weather, here in the Netherlands, is hot (at least for this time of the year) also BDS2006/Turbo hotfixes are hot. Allen Bauer posted a hotfix-roll-up containing all the hotfixes in one setup. New hotfixes are also added so the total count of hotfixes is now nine. For more information you can also explore this BDN article.

    You can only apply this hotfix-rollup to the Turbo Editions, or BDS2006 with Update 2 installed. Previously installed hotfixes (1-6) have no effect on this rollup. I installed the rollup on BDS2006 Update 2 with some hotfixes (1-6) pre-installed and found no issues.

    Hot fix 9 addresses some memory leakes of the IDE (QC 22481).  I have not seen (increased) memory usage after applying this hotfix yet, so hotfix 9 is a must have!

    You can get the hot-fix-rollup at several places:
    Codecentral
    Allen Bauers weblog
    Turbo Explorer Download page

    Monday, September 11, 2006

    Go Turbo

    Last week the Turbo Explorer editions have been launched. Nothing new here or you must have been living under a rock.
    Although I'm personal not intrested in getting the Turbos because I use BDS 2006 I can certainly feel the excitement about it and will advocate it as much as possible. Here are some intresting blogposts from the last week:

    Turbomerger is an utility by Andy which allows you to build your own Turbo Explorer Studio so that you can use all personalities (Delphi Win32, Delphi .NET, C++ and C#) on one machine. It seems that this is allowed and that it was only a technical problem to be solved. Great stuff!

    ISO Images are set online according to Daniel Wischnewski's blogpost by Delphi Praxis so that you burn your own installation CD's. Even CD labels are provided in PDF format. I think we all should burn a couple and give them away to intrested developers.

    Turbo Delphi Explorer from Square one is a document by Jeff Duntemann which might be, according to the website, the beginning of a new book. Jeff Duntemann really inspired me back in the 80's with his Complete Pascal series. His books are a good read and funny. I remember his book on Delphi 1 which included a real novell starring 'Ace Breakpoint'. Intresting to see new work from him.

    Bitwise magazine started a new serie 'Introduction into Delphi'

    www.turboexplorer.com is the official home of the Turbos. Stay tuned to this website for more information. You can download the turbos here or go to one of the available mirrors.

    More Turbo info from Borland:
    Places to buy Turbo Professional
    The Turbo Editions FAQ

    Tuesday, August 15, 2006

    Blogpost from Windows Live Writer

    This is more like a test blogpost, using the new Microsoft Windows Live Writer application.
    WLW supports many blog engines like Blogger, dasBlog and of course MSN Live spaces and many more.
    WLW is a WYSIWYG editor with all the standard editor functions and more, like spellchecking and the possibility to insert a map using Microsoft Virtual Earth. I tried to show you where I live, but it gave me an error :( 
     
    It is obvious that WLW is written in .NET, startup time is a bit slow, but when it is running it is quit snappy.

    Developers are able to extend the capabilities using the Windows Live Write SDK.

    All with all a nice tool for writing blogpost straight from the desktop. And if you can read this is, it must be working for blogger.com :-)

    Monday, August 14, 2006

    Turbo pricing

    According some webshops here in the Netherlands, the Turbo professional editions will cost EUR 399,00! (That is excl. 19% VAT so: EUR 474,80 incl. VAT ).
    The academic version costs : EUR 82,00 (incl. VAT).

    I think these are very reasonable prices for a product with no less features as the BDS professional edition.
    Note that you can only install one Turbo per PC.

    The free Explorer edition is also available on CD for a lousy EUR 25,00!

    Monday, August 07, 2006

    Delphi man returns with Turbo Man



    And how....Devco's answer on Microsoft Visual Studio Express.


    They are back...the Turbo Tools, powered by Turbo Man!
    More adventures can be found in the Borland museum.

    Devco is reintroducing the Turbo tools. According the website www.turboexplorer.com there will be four of them:
    1. Turbo Delphi Win32
    2. Turbo Delphi for .NET
    3. Turbo C#
    4. Turbo C++

    They come in two editions: Explorer, which is free! and a professional edition!

    This is really exciting news!

    Some press releases can be found here:
    The Turbotools press release
    Interview with DavidI on eweek
    And another one


    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...