Microsys Blog

Independent Software Vendor (ISV) Company



Month: May, 2007

Customize Delphi IDE and Improve Speed

29 May, 2007 (12:00) | Delphi, Developer

Borland Developer Studio (BDS), CodeGear Developer Studio (CDS), Embarcadero RAD studo:
Help tutorial guide on how to customize and improve speed of the Delphi 4, 5, 6, 7, 2005, 2006, 2007, 2010 and C++ Builder IDE


Delphi 2005 upgrades and updatesofficial and unofficial

  • Official updates
    • Delphi 2005 service pack 3 also called SP3. Released: 2005/06/10.

  • Unofficial updates
    • Remember to backup all the files you replace!
    • Only apply these patches after all official updates, and only if newer!

2005 September rollup of unofficial updates provided by Allen Bauer – also referred to as “unofficial SP4″. The file you need to download is called d2005_update.zip, and isavailable from Code Central with item id 23618.

FastMM is an open source memory manager. When you have downloaded and extracted the newest version, refer to the documention for further instructions. I installed FastMM by replacing the file “BorlandMM.dll” in the Delphi bin directory with “BorlandMM.dll” found in “FastMM\Replacement BorlndMM DLL\Precompiled\for Delphi IDE\Performance\”.

Delphi 2006 upgrades and updatesofficial and unofficial

  • Official updates
    • Delphi 2006 update #1. Includes C and C++ Builder personality. Released: 2005/12/12.
    • Delphi 2006 update #2. Released: 2006/04/17.
    • Delphi 2006 hotfix #1 to #6. Released: 2006/06/01.

3rd party toolsimprove startup speed and functionality

3rd party code librariesimprove code speed and time to market

Keyboard shortcutsquick and useful

  • “SHIFT + CTRL + K + O” enables/disables code folding.
  • “Ctrl + Alt + P” focuses tool palette.

Floating form designerdocked or undocked

  • “Tools – Options – Environment Options – Delphi Options – VCL Designer – Embedded designer”.

Miscellaneous interesting settingsimprove speed and minimize delays

  • “Tools – Options – Environment Options – Editor Options – Code Insight – Error Insight”.

IDE editor highlight color themesmissing the non-altered original twilight theme

  • In Delphi 2005 the original Delphi twilight theme with white text on black background disappeared from selectable themes.
  • However, it is possible to export the relevant parts of Delphi 6 Twilight theme settings from Windows registry.
  • After cleaning the data, the result is original-twilight-editor-highlight.reg.txt.
  • Note: This file is provided as is. Make sure to view it. Remove the .txt extension to run it.

IDE flickeringswitching between code and form designer
To minimize flicker in Delphi 2005 (and possibly later) edition use docked Structure + Tool Palette + Object Inspector + Project Manager + Data Explorer together into the same floating window. Use keyboard shortcuts to switch between. Doing so means that only one of the above tool windows are visible at any given time. This, in my experience at least, minimizes the flicker experienced when switching between form and code.

This article was first created 2005-10-05 (yyyy/mm/dd) by Thomas Schulz and continues to be updated now and then

Delphi DLL Debugging Help

29 May, 2007 (12:00) | Delphi, Developer

Borland Developer Studio (BDS), CodeGear Developer Studio (CDS), Embarcadero RAD studo:
Help tutorial guide on how to best debug bugs in DLLs using Delphi 4, 5, 6, 7, 2005, 2006, 2007, 2010 and C++ Builder


BPG filesavoid them when you want to debug DLLss
Even if you mark/select the DLL project you want to debug in the list of projects, you will still have troubles if following conditions are present:

  • Your DLL project uses relative search paths. (Set in project options.)

    • And example with relative project search paths and Delphi IDE:

      • Use the open dialog to open a file in the same directory as the project file.
      • You can open project files located in e.g. “..\shared” in the code editor using “CTRL + ENTER”.
      • Try open a file located in a different directory. You can no longer open files in “..\shared”.

    • Jean-Claude Servaye proposes following solution:

      • Go to the “Control panel – System – Advanced panel”.
      • Click on Environment variables.
      • Add the absolute path of the dll to debug in the system paths.
      • Reboot the machine.
  • Your DLL project is in another directory than the other projects (possibly just if different from last project in list).

Debug infoalways compile / build with all enabled

  • You need to enable all relevant settings in “Project – Options – Compiler”.
  • Whenever you try to debug from one project into another, the into project needs to have set “Project – Options – Linker – Include remote debug symbols”.

How to debughost application, attach to process etc.

  • If you want to debug both your DLL and executable (if just the DLL file, ignore this), you will also need to configure your executable with remote debug symbols as mentioned in above section. In he DLL project choose “Run – Parameters – Host Application” and fill in the path to the compiled .exe file. When the exe application is running, choose (from the DLL project) “Run – Attach to Process” and pick your running exe program process.
  • Set a breakpoint in the DLL project where the exe will enter your DLL. Now initiate the required actions in the exe for it to occur.
  • Refer to the help for more usage variations.

Build projectbefore running and debugging
This lessens the chance of Delphi stating (while e.g. stepping from a breakpoint): The source has changed since last build.

Blue dotsappearing wrong places on builds
Although this can be caused by other things (in my experience at least) a primary reason seems to be a CR/LF problem that exists in Delphi: The IDE and compiler disagree on end-of-line. For Windows/Linux/Max this means that text/files written in one OS can cause problems in another. So, if you use Windows, and suffer from the above problem, try use e.g. NotePad to open and save the problematic file with.

Attach to projectattach into a multi thread application
It can often be useful to attach into a running project to see what the various threads are working at. However, setting a break point at all possible places is tedious. Here is the solution:

  • Select “Run – Attach to process” and choose your application.
  • Select “Run – Program pauses”
  • Select “View – Debug windows – Call stack” and view the different thread call stacks.

COM DLL programmingpaths are important
Although this can be caused by other things (in my experience at least) a primary reason seems to be a CR/LF problem that exists in Delphi: The IDE and compiler disagree on end-of-line. For Windows/Linux/Max this means that text/files written in one OS can cause problems in another. So, if you use Windows, and suffer from the above problem, try use e.g. NotePad to open and save the problematic file with.

Remember extension“.dll” in interface declarations
Many people encounter problems with COM debugging when the file path is not in 8.3 format: No spaces or long file names in path. One such problem is setting breakpoints in code.

Jean-Claude Servaye sent the following solution:

  • Search the registry for the filepath of the COM. This is in 8.3 format.
  • Change it to the long file name format and the breakpoints are available.

Remember alignment issueswhen passing data
Even if some Windows versions can handle leaving out the extension, it is safer to include it, e.g. like this:
procedure Foo external 'example.dll'

Threadsthe less the easier to debug
If possible, create a flag that prevents multiple threads from connecting to your DLL; This makes it easier to debug the logic of the code from within the Delphi IDE.

Other reasonsfor access violations, errors, exceptions, and memory leaks
As with everything else it is still possible to make and have pointer errors etc. Here is a list of miscellaneous links and tools to solve common problems:

  • Access violations, exceptions, memory leaks: You should probably check out memory leak detection tools such as MemCheck (compiled-in source)

Last solutionsearch and ask in discussion groups
This page was never meant to be a full guide about Delphi DLL file debugging. I originally created this page because the thing that helped me, knowing how BPG files are handled, is something no-one ever mentioned in the various discussion groups (probably because my problem was quite rare to encounter). Good places to find answers include:

Epiloguewhen I experienced my “DLL hell”
The product for which I wanted a multiple DLLs / plugins and for an application was Automation Batch Tools which comes with a DLL plugin SDK for developers. While the term DLL hell usually refers to problems associated with a “visual” and “basic” development tool (not Delphi!), I dare to say that I have gone through my amount of DLL hell :)

This article was first created 2002-12-21 [approx] (yyyy/mm/dd) by Thomas Schulz and continues to be updated now and then

A1 Sitemap Generator advantages

9 May, 2007 (13:34) | A1 Sitemap Generator, HTML sitemaps, Marketing, Products, Search engine optimization, XML sitemaps

Some time ago I created my first ever video about A1 Sitemap Generator and XML sitemaps as used by Google, Yahoo and other search engines.

However, one response I got was the question:
“You should tell us why we should pay you $39.00, when so many others are free!”

My initial response was “and so many of them are IMO crap” :)

I often get emails from people who have tried them all ending up very frustrated until they tried my tool.

Some unique features and benefits:

  • For medicore sized websites, like 50.000 to 100.000 pages, my program can give much better linking and redirect information for all pages than other tools.
  • Do you have a website large than above numbers? If you can live without detailed information like how all pages link with each other, you can change some scanning options and the limit becomes ~350.000.
  • A1 Sitemap Generator can also calculate priority values for pages based on internal linking structure. Simply put, The more linked a page is, the higher its priority value.

Some website scanning options:

  • Support for website crawler to “login” and scan password protected areas.
  • Optionally obey robots.txt and nofollow/noidex attributes.
  • Can go through proxies.
  • Change useragent ID.
  • Find links in CSS and javascript.
  • Verify links to external pages still exist.
  • Cutout session IDs.

Some sitemap creation options:

  • Very rich HTML sitemap template system.
  • Can automatically GZip XML sitemaps.
  • Split sitemaps into multiple files when a limit is reached, e.g. 50.000 pages per XML sitemap.
  • Create sitemap index file of generated XML sitemap files.

And those are just the simplest options. For those who need more control about website scanning and sitemap creation, they have it. There are also some qualities that are hard to explain, but still exist. For example how many types of links are correctly understood and normalized.

If I had to mention one more thing, it would be the sitemap/ignore/output filters one can configure the website scanner with. This, together with the automation support, makes is doable to maintain sitemaps for huge websites since one can very finely split scanning into sections. I believe I also here offer more options for the webmaster compared to the competition.

If you have suggestion as to what you would like more information about in future videos, please let me by posting a comment :-)