Sunday, September 27, 2009

Delphi 5 to Delphi 7 : Variants.pas

If you use functions such as VarOfArrayOf() or constants such as null, reminder to add variants to the uses clause of your *.pas and your problem will go away

Monday, September 21, 2009

Dr Dobb's - RAD Studio 2010 Still RAD - 18th Sept 2009

September 18, 2009
RAD Studio 2010: Still RAD
Mike Riley
Examining Embarcadero's RAD Studio 2010 Architect Edition
Mike Riley is a Dr. Dobb's contributing editor. Follow Mike on Twitter @mriley.

It wasn't until Delphi 1.0 arrived back in the mid '90s that I became a serious Windows application developer. I had dabbled with Microsoft C++ (which eventually became Visual C++) and Visual Basic, but neither thrilled me -- C++ required deeper Windows API knowledge and dozens of lines of code just to display a 'Hello, world' window on screen, and Visual Basic at that time was too simple and constrained to write any serious, low-level Windows applications.

I have always had a soft spot for the Pascal language because it was the first structured programming language I truly enjoyed learning (thanks entirely to Doug Cooper's Oh! Pascal! book). This appreciation was further propelled by Borland's release of Turbo Pascal in the late '80s, wonderfully accelerating the DOS application development process with compiled programs that would execute at blazing, nearly assembly language-level speeds. As Windows gained prominence and Microsoft's tools became the dominant way to develop applications for the platform, many erroneously predicted the end of Borland as a Windows programming tools vendor. However, with the release of Object Pascal-based Delphi, Borland was not only back on the map but forcefully redefining the way Windows applications could be written. (For those unfamiliar with Object Pascal, but interested in learning more about it, check out Marco Cantu's helpful free eBook, Essential Pascal).

Delphi's most celebrated personality and main architect, Anders Hejlsberg, was eventually enticed enough to move to Redmond and join Microsoft to create the .NET technology base and the C# language, extracting the best of what Delphi, Java and C++ had to offer at the time. Yet again, this key player departure prompted doomsayers to predict the end of the Borland developer tools. It was around this time that Borland attempted to swim upstream to expensive middleware solutions, changed their name to Inprise yet retain the Borland name for their tools which expanded from Delphi to also include C++ Builder and JBuilder. The Inprise strategy faltered and the company reassumed and re-emphasized its Borland developer tools legacy. However, by this time, Microsoft had captured a majority of Windows-based application and web developer mindshare with its Visual Studio for .NET toolset and Borland eventually recast its prized developer tools assets under CodeGear until the portfolio was acquired earlier this year by database tool vendor Embarcadero Technologies. As such, the RAD Studio 2010 collection is the first Delphi and C++ Builder suite sold under the Embarcadero name.

A Look at Today


So much has changed over the last 15 years, yet Delphi 2010 is still recognizable and as easy to use as Delphi 1 was upon its initial release. While the look of the IDE is certainly busier, new navigation features and smart choices in palette management still make the environment a highly productive, comfortable one to code in. Still, given the wealth of options and the number of views available, I found 1920x1600 the best resolution for my coding projects. Better still, I found adding a second monitor for running and observing the executable to be the optimal RAD Studio 2010 developer experience. And even with all the views activated, the IDE response remained lightning fast throughout my hours of testing it for this review.

Figure 1: The RAD Studio 2010 IDE user interface overflows with project details.

Given its nearly 15-year history, Delphi has kept up with the times of supporting each successive release of Windows. For example, Delphi 2010 fully supports Windows 7-specific UI nuances and new technology enhancements via Visual Component Library (VCL) controls and API headers. These also include the Windows Imaging Component for numerous image format reading and manipulation, and Windows 7's new Direct2D API.

Figure 2: More than 20 different types of C++ project types can be automatically scaffolded via the New Items dialog box.

Code Audits in the Professional, Enterprise and Architect editions provide extremely helpful code and project health monitoring via an easy to use, information-rich reporting interface. The new IDE Insight makes navigating to all the plethora of options packed into the development environment as easy as a filtered Google search. While I found this new navigation window rather helpful, I would have preferred it to have been enhanced with an optional 'What's New' filter to quickly help me identify the new features and shortcuts specifically created for this release.

Figure 3: RAD Studio 2010 brings an unprecedented granularity of code formatting to C++ Builder and Delphi developers.


Figure 4: The IDE Insight palette provides a simple interface to quickly access the plethora of functional aspects available in RAD Studio 2010.

RAD Studio 2010 database drivers have also been updated to support the latest well-known name SQL DBMS's including IBM DB2 8, Microsoft SQL Server 2008, MySQL 5.1 and Oracle 11g. Also added to this release is support for the sexy, high-performance, open-source Firebird 1.5 RDBMS, showing that Embarcadero is hip with the times by not standing idle with just supporting updates for the entrenched players. New DSHTTPService and DSHTTPServiceAuthenticationManager components have been added to the DataSnap collection that delivers user-authenticated data connections over the HTTP stateless protocol. This is pretty cool, considering the number of disparate data sources and client access mechanisms scattered throughout a large enterprise. In addition, the Architect edition includes a developer edition of Embarcadero's powerful ER/Studio 8.0 database modeling, documentation/analysis and reverse engineering tool. ER/Studio deserves its own review, though of all the features packed into the 8.0 release, the one I found most exciting was its Visual Data Lineage that allows developers to observer how data flows throughout a data warehouse without necessarily having access to the codebase driving the system. It's a feature that I'm surprised Embarcadero isn't hyping with screencasts and more screenshots on its website.

Figure 5: RAD Studio 2010's modeling features are some of the best, most intuitive round-trip UML designers available today.

While not new in RAD Studio 2010, the Delphi Prism language opens the .NET Framework to the Delphi developer. Additionally, it provides developers with the option of leveraging an Aspect Oriented Programming approach and also supports .NET 4.0's dynamic typing capabilities, making it a very powerful, flexible web application option. Perhaps the most notable aspect of Prism is its ability to run under Mono, the open source cross-platform implementation of .NET. This has a lot of potential for Linux-based VPS's like Linode by loading the Mono libraries to run Delphi Prism-based web applications. This effectively puts Delphi into an effective, economical means of executing web applications in a non-Microsoft hosted VM scenario.

Other helpful additions include search across project files, more granular thread debugging (freeze, thaw, isolate and set thread breakpoints), SOAP 1.2 (and REST and JSON via the DataSnap component) support, upgraded ANSI/ISO Boost-supported C++ compiler, a Class Explorer for C++ Builder (finally!), secure C library functions and, remarkably, the ability to import Delphi 1.0 and higher projects into Delphi 2010. I tried this with a fairly complex Delphi application I wrote in 1997 and sure enough, it just worked. Impressive! Minor improvements also abound in the release, from an updated Action property editor to Date properties displaying a Calendar control -- more than 100 new and enhanced features in all. View this feature matrix for a comprehensive list of capabilities available in each of the four RAD Studio flavors.

Of all the new features in this release, the one that captured most of my attention and fascination was the inclusion of Gesture support. This is especially awesome for those few lucky developers who have the opportunity to work with and develop on the new breed of multi-touch monitors. While the new Windows for Touch and Tablet PC features are a big deal in Windows 7, the gesture components in Delphi support Windows XP and Vista operating systems as well. Anyone developing Tablet or multi-touch display kiosk applications will want to take a serious look at how easy it is to bake in gesture support and even create custom gestures for service, support and even gaming applications.

Figure 6: One of the most exciting new additions to the 2010 release is the ability to easily create multi-touch screen-aware applications.



Figure 7: The multi-touch screen Gesture components support over 30 standard gesture motions out of the box.



Figure 8: The Custom Gesture Designer provides a surprisingly easy design palette to create and assign new gestures not already included in the standard gesture library.

Areas for Improvement


While trying out all these nifty new features, I had to discover most of them on my own due to the lack of sample projects demonstrating how these new capabilities work. Embarcadero needs to better market and support these major new releases with more code samples and screencasts, beyond the amateur marketing videos like this IDE overview and this one on Gestures made by long-time Borland-Inprise-CodeGear-Embarcadero developer evangelist David Intersimone. Even encouraging the Delphi and C++ Builder community to post screencasts on Blip.tv and YouTube would have been a boost in greater visibility and recognition for the product as well as raising awareness of how easy it is to construct such compelling applications on the Windows platform can be.

Also, why is it after all these releases that there still remains no native dbExpress support for PostgreSQL or SQLite data sources? Sure, PostgreSQL data can be accessed via its ODBC driver and both of these database technologies have community-developed VCL's that vary in quality, but they certainly are not anything I would trust running as part of an enterprise application. And while the Firebird DBMS support is welcome, it would have been a really nice surprise to see rising document database star Apache CouchDB on the official support list as well. While I realize CouchDB is not an RDBMS, having a way to access its data outside of the RESTful approach would have been a coup for a commercial IDE. Alas, perhaps some of these databases will receive their own feature bullet points in RAD Studio 2011.

Lastly, the Architect edition is one very expensive product. New Users are expected to pay $4,299.00 US while existing licensees can upgrade for $2,799.00 US. The Professional Edition is a bit more reasonable at $1,399.00 US for new users and $649.00 for the upgrade, but of course that version doesn't include many of the powerful data and modeling features or the E/R Studio developer edition. Nevertheless, such high prices will keep many new developers with constrained budgets from taking a closer look at RAD Studio 2010. That's a shame, given how much productivity potential is packed into this release. While it's a no-brainer that existing RAD Studio customers should upgrade, those Windows developers already wed to Microsoft's Visual Studio environment will be hard-pressed for a compelling reason to make the switch to RAD Studio for new project development. Embarcadero should seriously consider extending offers to long-time Delphi developers, especially those that abandoned Delphi years ago, that entice them to take another look, either via a special two hundred dollar upgrade regardless of version, or a competitive trade-in offer (i.e., show proof of legitimate Visual Studio license ownership and receive a thousand dollars off a new license) could really help to get those both old and new to Delphi reacquainted with a faster, more lightweight way of writing Windows applications.

A Look Toward the Future


While the RAD Studio 2010 release isn't perfect, it does emphasize an ongoing commitment by Embarcadero to stand by its acquired product line and carry forward the tenants of what made Delphi such an outstanding IDE. It also puts to rest the years of concern by tech industry journalists like me questioning the longevity of Delphi and C++ Builder. The financial backing is there. Now its time for Embarcadero to step up the competitive edge by leveraging Delphi across multiple platforms via Prism (Mono runs on Windows, Linux, Mac OS X, and even the iPhone and Android smartphones), compare how much faster Windows applications can be constructed in RAD Studio compared to Visual Studio and show how much smaller and tighter Delphi applications are compared to .NET applications.

That last point emphasizes a major consistency throughout Delphi's long life. With Delphi, even a Windows application neophyte can paint a form, compile it into a true executable without a bulky, separate runtime dependency. This is something that existing Delphi developers have taken for granted since its inception, but its still something to remark upon given the weighty overhead that various Java and .NET VM distributions require. The fact that Delphi can span the XP, Vista and Windows 7 family of operating systems, even supporting technologies like gesture support on operating systems that Microsoft won't formally commit to, is a testament to the enduring capabilities that Delphi has carried through all of its corporate incarnations. Anyone interested in Windows application development -- especially timely with the release of Windows 7-- should visit Embarcadero's RAD Studio 2010 website for more details.

Monday, September 7, 2009

DevExpress Components : Installing D5 & D7 (or later) on the same PC

Issue :

The DevExpress Team announced in 2007 that wef from v28, the Delphi IDE will no longer be supported.

Of course, you can continue using Build 27, however, DevExpress cannot guarantee that this will be able to apply code fixes designed for newer builds of our components to the libraries from this build. From DevExpress point of view, it is best to migrate to a newer version of Delphi if you wish to use the latest versions of their components.

The Solution

Although you can't use the latest  DevExpress setup for this purpose, you can do the following to have both versions installed:-

1. Install v27 under the required IDE. Backup all the binary (and other necessary files). It's easy, since our setup copies files only under the product's root folder.

2. Install latest version #46 as at 7th Sept 2009

3. Restore backed up file to a folder, and install the required components from v27 manually, by registering packages via the IDE.

Thursday, September 3, 2009

Delphi SpeedUp 2.78

DelphiSpeedUp is an IDE plugin for Delphi and C++Builder. It improves the IDE’s startup speed and increases the general speed of the whole IDE. This is achieved by replacing some often used RTL functions by FastCode function that are optimized for the used CPU and some other faster implementations. It also employs caches when the IDE loads.


Important information: All these optimizations do not affect the compiled projects in any way. They are made in memory keeping all the files on disk unmodified. Uninstalling DelphiSpeedUp reverts every change because the optimizations aren’t persistent. They only exist in memory and are limited to the Delphi/BCB/BDS process.

Not every access violation in DelphiSpeedUp.dll is a bug in DelphiSpeedUp. Actually many of the exceptions in the RTL package are now thrown in the DelphiSpeedUp.dll because the RTL functions are replaced by the DelphiSpeedUp functions and wrong parameters like nil-pointers, invalid pointers, … now lead to access violations in the replacement code. A wrong function call just remains a wrong function call.

Features:
  • Improves Delphi/BCB/BDS’s load times
  • Optimizes often used RTL functions by functions form the FastCode project
  • All optimizations are done in memory and do not change any file on disk
  • Adds a “Close all and kill” menu item to the “File” menu that terminates the IDE very fast
  • The fast termination is used when you close the IDE while pressing the CTRL key.
  • Shows waiting cursor while loading designtime package
  • Optimized the Delphi Compiler’s C RTL
  • CodeCompletion and HelpInsight can be aborted by ESC/mouse move
Supported IDEs:
  • C++Builder 5, 6
  • Delphi 5, 6, 7
  • Borland Developer Studio 2005, 2006
  • CodeGear RAD Studio 2007 (December Update)
How to install:
  • Download the DelphiSpeedUp zip-file
  • Extract the zip file to a directory of your choice
  • Execute the contained executable InstallDelphiSpeedUpX (where X is your Delphi/BCB version)
  • Start Delphi/BCB/BDS and work on your projects

Welcome to Delphi... Delphi... Delphi

I have been a Delphi Developer since Delphi 3 when I finally decided on Delphi in 1996 as my programming language of choice for the Windows 32 environment. So what have I created with Delphi ?

Would you believe that I had single-handedly created a full ERP2 system comprising ERP+CRM where ERP=Sales Distribution+MRP+ Procurement Management+Planning & Production +Finacial Management + Human Resources Management System.

Since 15th February 2009, we have visitors from more than 60 countries including Malaysia, United States, Brazil, Italy, Australia, India, Turkey, Russian Federation, Spain, Indonesia, Hungary, South Africa, Germany, Mexico, Argentina, Singapore, Saudi Arabia, Colombia, Czech Republic, Canada, France, Croatia,Thailand, Bulgaria, Slovenia, Hong Kong, Poland, Sri Lanka, Chile, Japan, Austria, Ukraine, Azerbaijan, Ireland, Tunisia, Greece, Taiwan, Egypt, Bolivia, Paraguay, Iran, Islamic Republic , Morocco, Angola, Belgium, Portugal, Norway, Venezuela, United Arab Emirates, Algeria, Korea, Republic Of, Slovakia, Georgia, Lebanon, Macedonia, Sweden, Philippines, Vietnam, Dominican Republic