The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘Delphi 2007’ Category

Some Delphi & C#/.NET links on XML related stuff

Posted by jpluimers on 2013/05/02

for my link archive:

–jeroen

Posted in .NET, C#, Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | 1 Comment »

Delphi static class methods are assignment compatible with plain old function pointers

Posted by jpluimers on 2013/04/24

So I won’t forget, as the  [WayBackstatic in different languages varies in meaning:

[WayBack] Static on class methods makes them assignment compatible with plain old function pointers.

Thanks Moritz Beutel for initially posting this.

–jeroen

via:

related:

  • [Archive.isFacebook – Delphi developer: static class methods
  • [WayBack] Delphi 2007: Methods; Class Methods:

    Like class methods, class static methods can be accessed without an object reference. Unlike ordinary class methods, class static methods have no Self parameter at all. They also cannot access any instance members. (They still have access to class fields, class properties, and class methods.) Also unlike class methods, class static methods cannot be declared virtual.

    Methods are made class static by appending the word static to their declaration.

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | 5 Comments »

Delphi + ADO + dBase – Stack Overflow

Posted by jpluimers on 2013/04/10

For my research queue:

I should look at the below ConnectionStrings to access dBase with ADO from Delphi, If I ever need to do that.

Thanks Cromulent for asking, Nelson for editing and Pieter for answering:

Microsoft dBase ODBC driver

Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;OLE DB Services = -1;Extended Properties=dBase IV;Dbq=c:\mypath

doing operations like ADOTable1.Open are very fast (good) but GetIndexNames returns nothing (bad).

Microsoft Jet OLEDB 4.0 driver

Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=dBASE IV;OLE DB Services=-1;Data Source=c:\mypath

doing operations like ADOTable1.Open are exceedingly slow (bad) while GetIndexNames does return index names the way it should (good).

How do I get both speed and the index info via ADO for the dBase tables?

Microsoft Paradox Driver 7.x

“We use the following connection string which works really well.”

Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=c:\mypath;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"

–jeroen

via Delphi + ADO + dBase – Stack Overflow.

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | 8 Comments »

autoscrolling memo in delphi – Stack Overflow

Posted by jpluimers on 2013/04/03

Just found this great answer by vcldeveloper to autoscroll a readonly logging memo in Delphi which works from Delphi 1 and up (:

For such a simple task, you don’t need to buy a commercial component! All you need to do is to send an EM_LINESCROLL message to that memo control, to make it scroll to the last line:

procedure ScrollToLastLine(Memo: TMemo);
begin
  SendMessage(Memo.Handle, EM_LINESCROLL, 0,Memo.Lines.Count);
end;

If your memo is read-only to users and is updated automatically by the application, you can put a call to the above procedure in its OnChange event-handler, so that whenever the text inside the memo is changed, it is automatically scrolled down to the last line.

–jeroen

via: autoscrolling memo in delphi – Stack Overflow.

Posted in Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | 9 Comments »

Delphi: you should avoid the `with` statement as it makes your code less future proof

Posted by jpluimers on 2013/03/27

As I wrote before, I’m with the [WayBack] Delphi with haters camp, and this is why:

Using the [WayBackwith statement in Delphi makes your code less future proof.

Originally, the with statement in Pascal was argumented in part of allowing compiler optimisations:

PASCAL User Manual and Report – Kathleen Jensen, Niklaus Wirth – Google Books

The with clause effectively opens the scope containing field identifiers of the specified record variable, so that the field identifiers may occur as variable identifiers. (Thereby providing an opportunity for the compiler to optimize the qualified statement.)

Screenshots of this 1975 book are below the fold.

The Delphi (actually even before that Turbo Pascal compiler) has no measurable difference between with and non-with code.

The debugger however, still does not support with, and there are other drawbacks of which one is below.

The below code example is just one of many. I show it because I recently bumped into doing some long overdue code porting to Delphi XE3.

Since I’ve been bitten by using with a couple of times before, it didn’t take me long to find the cause.

Example code where FIConData is of type NOTIFYICONDATAW that used to compile fine:

    with FIconData do
    begin
      cbSize := SizeOf(FIconData);
      Wnd := Self.Handle;
      uID := $DEDB;
      uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
      hIcon := Application.Icon.Handle;
      uCallbackMessage := WM_CAS400NTIcon;
      StrCopy(szTip, PChar(Caption));
    end;

Well, as of Compiler Version 20, it doesn’t compile any more. Read the rest of this entry »

Posted in Borland Pascal, Conference Topics, Conferences, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Event, Pascal, Software Development, Turbo Pascal, With statement | 32 Comments »

Delphi “Variant Records”, a few notes

Posted by jpluimers on 2013/03/14

Variant Records are a feature that has been in the Pascal language since Standard Pascal.

A cool page for historic perspective is R3R: Pascal Features in Popular Compilers, hopefully someone will update it to more modern versions of the mentioned compilers.

There is not much official documentation on the Delphi side on this, so below some parts of a case I used for a project that started in 1997 and is still in use to day. Read the rest of this entry »

Posted in APPC, AS/400 / iSeries / System i, ASCII, COBOL, Communications Development, Conference Topics, Conferences, CPI-C, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Development, Encoding, Event, HIS Host Integration Services, Internet protocol suite, MQ Message Queueing/Queuing, SNA, Software Development, TCP, Unicode, UTF-8, WebSphere MQ | 9 Comments »

When you automatically check “Automatically close on successful compile” and the compiler progress disappears…

Posted by jpluimers on 2013/03/13

Every once in a while I manage to check “Automatically close on successful compile” during compilation, the compiler progress disappears, and I loose my clue if compilation ended or not.

This is how to fix it:

  • find the registry portion of your Delphi version, under either of these
    – HKEY_CURRENT_USER\Software\Borland\BDS\#.0
    – HKEY_CURRENT_USER\Software\CodeGear\BDS\#.0
    – HKEY_CURRENT_USER\Software\Embarcadero\BDS\#.0
    Where #.0 is your version number from this Delphi Release Dates page.
  • Under the key “Compiling”, find the string value named “Auto Close Progress Dialog”  and change it from “True” to “False”

–jeroen

via: Embarcadero Newsgroup Archive :: embarcadero.public.delphi.ide :: Re: D2006 compiler progress.

Posted in Delphi, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | 7 Comments »

Delphi “type types”: similar types but not the same type identity, some examples.

Posted by jpluimers on 2013/03/12

Few people know about a Delphi language feature that has been present since Delphi 1: prepending the type definition with a type keyword to make the type getting a new identity.

Each time I use it, I have to do some browsing for the consequences, and this time I wrote down some notes and created a small example program (source is also below).

This time I needed it when writing class wrappers on top of the Delphi bindings for WebSphere MQ.

WebSphere MQ has Queues where you can put and get messages. It also has Queue Managers to which you connect, and that provide queuing services and manages queues.

Both Queues and Queue Managers have names that can be up to 48 (single byte) characters long.
Those names mean totally different things, so though the have similar data types, they have a different identity.

The same holds for 20 byte character arrays (they can be used as names for ChannelNameShortConnectionName and MCAName). The 264 byte character array is so far used for ConnectionName only.

Distinguishing those types: That’s what “type types” in Delphi are all about. Read the rest of this entry »

Posted in CP437/OEM 437/PC-8, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, Encoding, Shift JIS, Software Development, Unicode, UTF-8, UTF8 | 1 Comment »

Please write dates and times so that everyone understands them, not just you. xkcd: ISO 8601

Posted by jpluimers on 2013/02/28

ISO 8601 was published on 06 05 88 and most recently amended on 12 01 04

ISO 8601 was published on 06 05 88 and most recently amended on 12 01 04

Boy, am I glad with the xkcd: ISO 8601 post and image on the right.

One reason:

Please write dates and times so that everyone understands them, not just you.

The alt-text of the comic is hilarious (ISO 8601 was published on 06 05 88 and most recently amended on 12 01 04) showing the confusion of using 2 digit years not knowing which field means which (I thin XKCD author Randall Munroe and Mathematics of the ISO calendar got some of the dates, see PDF search dates below).

I found out in the mid 1980s that people I was communicating with internationally (back then the internet was forming and you already had BITNET Relay chat and email) were using different date formats than I did.

Ever since that, I’ve used the YYYY-MM-DD format of writing dates, encouraging others to use as well and as soon as I found out that was a standard, started to evangelize ISO 8601 (there is an ISO 8601 category on my blog), which – at the time of writing this – had had revisions in 1998 (on 1998-06-15), 2000 (on 2000-12-15) and 2004 (on 2004-12-01).

A lot later I found out that back in 1971, this date format was a recommendation, and in 1976 already a standard. Not nearly as old as Esperanto though (:

Speaking about languages:

At the end of last century, after Delphi 5 added year 2000 support (which made the 16-bit Delphi 1 disappear from the box as the effort to prove the product including all libraries was year 2000 proof), Delphi went cross platform.

The Delphi team working on both Kylix 1 and Delphi 6, the also added a DateUtils unit which provides a lot of cuntionality, including support for weak numbers. The first test version always assumed week 1 was the one with januari first in it. As ISO 8601 also indicates how the first week of a year should be determined, a couple of people (Jeroen W. Pluimers, Glenn Crouch, Rune Moberg and  Ray Lischner) provided code that fixed this and a few other things in the unit. We even got mentioned by Cary Jensen!

That code is now also part of the RemObjects ShineOn library. That DateUtils unit is now on GitHub.
A Delphi XE version of the code (and a Delphi 2007 one) are now at NickDemoCode (Thanks Nick Hodges!).

Delphi is not the only environment having ISO 8601 support. XML has, .NET has, etc: it is now wide spread.
So follow your tools, and start using it yourself as well (:

Too bad the ISO 8601 standard text is not available publicly:

I remember the Y2K preparation era where the ISO-8601 standard was freely available at http://www.iso.ch/markete/8601.pdf, soon after the Year 2000, the PDF got locked behind a payment engine.
ISO suffers from heavy link rot too, for instance the ISO 3166 country codes used to be at http://www.iso.org/iso/prods-services/iso3166ma, but are now at http://www.iso.org/iso/home/standards/country_codes.htm. What about HTTP 303 or 302 redirect here guys?

Luckily people keep cached copies:

  1. “ISO 8601” “First edition” “1988-06-15” filetype:pdf
  2. “ISO 8601” “Second edition” “2000-12-15” filetype:pdf
  3. “ISO 8601” “Third edition” “2004-12-01” filetype:pdf

–jeroen

via: xkcd: ISO 8601.

Posted in .NET, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, ISO 8601, Power User, Prism, Software Development | Tagged: , , , , , , , , , , , , , | 10 Comments »

Found a table with Delphi Conditional defines over the Delphi versions/compiler platforms/bitness

Posted by jpluimers on 2013/02/20

Right now, documentation on Delphi Conditional Defines is on pages like Conditional compilation (Delphi) – RAD Studio XE2, but it is limited as it is for one specific version of Delphi only.

However, over the course of Delphi versions, compiler platforms and bitness, and not forget Free Pascal and Turbo Pascal/Borland Pascal, the matrix has become huge.

There is no complete documentation on that in one place. Right now include files like Defines.inc, the DSPack.inc, the JCL include directory the JVCL common include directory and the Jedi.inc documentation contain the collective knowledge about this.

Someone should condense that in a table and – more important – keep it up to date.

At least now there is a post collecting some of the links that contain the knowledge (:

Found one that contains these columns

  • Product & Version
  • VERxxx defines
  • __BORLANDC__ value
  • RTLVersion
  • CompilerVersion
  • Package Version

via Compiler/RTL version overview « Muetze1 wich is now available on the wayback machine: http://web.archive.org/web/20131229055045/http://www.muetze1.de/?page_id=547

–jeroen

Posted in Borland Pascal, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, FreePascal, History, Pascal, Software Development, Turbo Pascal | 14 Comments »