Archive for the ‘Delphi 5’ Category
Posted by jpluimers on 2013/10/10
Still a C# 4.0 / .NET 4 feature that I need to investigate more deeply: ExpandoObject, partially because I had very bad memories of Variant support in Delphi.
So here are a few links.
First of all: since VB.NET already does late binding with the Object keyword, you cannot use ExpandoObject with Strict On in VB.NET 10.0 and up:
Now the C# links:
–jeroen
Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 4.0, C# 5.0, Delphi, 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, Software Development | 5 Comments »
Posted by jpluimers on 2013/08/06
I was called by a client that didn’t want to do maintenance on an old Delphi application, but wanted to get dir of an I/O Error 131:
I/O Error 131: ERROR_NEGATIVE_SEEK
MessageText: An attempt was made to move the file pointer before the beginning of the file.
Tough luck: psychic powers told me someone is using an unsigned 32-bit integer to access a file using traditional style Assign/Reset/Seek/Read/Close patterns that Delphi kept as intrinsic routines for Turbo Pascal backward compatibility, and that file has grown over 2 gigabyte in size.
I quickly found an import file had grown over the 2 gigabyte, so this was indeed the case.
The original developers didn’t do the file access using the 64-bit Seek/Position of the TStream descendant TFileStream.
Too bad, as now someone has to dig through the mothballs to find the sources (if they survived 3 different version control system switches), create a working development environment, and fix the bug.
Another instance where technical debt in IT raises its ugly head and the compound interest is really expensive.
–jeroen
via: erikmartin.com – IO Errors in Delphi.
Posted in Conference Topics, Conferences, Delphi, Delphi 5, Development, Event, Software Development, Technical Debt | 14 Comments »
Posted by jpluimers on 2013/07/18
I bumped into the below answer that I gave a while (what is 4 years in a developer’s life ) on StackOverflow.
It is about Delphi Design Patterns. Sepcifically the Factory Pattern, and explains how virtual constructors implement it.
They are one of the 3 corner stones on which the component based Delphi form designer and object inspector are built:
- Virtual constructors
- Properties (events are just a special form of property)
- Run-Time Type Information.
So here it goes: Read the rest of this entry »
Posted in Delphi, Delphi 1, Delphi 2, 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, Delphi XE4, Development, Software Development | 6 Comments »
Posted by jpluimers on 2013/07/09
Sometimes a generic answer to a specific answer gives people a lot more insight into what they actually want to accomplish than a specific answer.
Plus that the knowledge does not only apply to VCL in any Delphi version: it works in any development environment where you can draw.
That’s why I like this 2D transformation answer so much: Read the rest of this entry »
Posted in Delphi, Delphi 1, Delphi 2, 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, Delphi XE4, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2013/06/12
I was involved in a big project migrating a complex stack from Windows XP to Windows 7 x86, and got scared this !@#$ out of me.
The stack communicated to WebSphere MQ on AS/400 from Windows, and on the Windows side of things consisted of a UI developed in in Cool:Gen, a C interface to a Delphi DLL, which takes care of the communication to WebSphere MQ.
Digression:
This all was histerically grown. In the beginning (early to mid 90s last century) it was a big Borland Pascal/Turbo Pascal application – running on DOS, Windows 3.1x, Windows 95 and OS/2 2.x/3.0 – that talked over a propriatary layer over SNA to AS/400.
The vendor of that layer didn’t respond to a request for Windows NT 4.x compatibility, and meanwhile some client applications were about to be developed in Delphi.
So in 1997/1998 – together with a great AS/400 software developer – I wrote a SNA based APPC/CPI-C communication layer in Delphi 3 that could be accessed from both Turbo Pascal (using a file based interface) and Delphi (using an object interface).
The DOS interface was an executable around the Delphi interface, which was a set of classes.
Delphi part
The Delphi part of the DOS interface was centered around FindFirstChangeNotification/CreateProcess combined with MsgWaitForMultipleObjects/WaitForSingleObject to make the waiting as efficient as possible.
DOS part
DOS part
The DOS part of the Delphi interface was centered around this piece to make waiting efficient:
asm
int $28
mov ax, $1000
int $15 { DESQview/TopView give up time slice }
mov ax, $1680
int $2F
end;
Thanks to the RBIL: Ralf Brown’s Interrupt List (there are now multiple HTML versions of it), it makes use of these tricks so DOS applications can efficiently wait : Read the rest of this entry »
Posted in C, CVS, Delphi, Delphi 2006, Delphi 3, Delphi 5, Delphi XE2, Development, Dimensions CM by Serena, MKS Integrity, Software Development, Source Code Management | 3 Comments »
Posted by jpluimers on 2013/05/15
It is unwise to pass objects allocated in one framework over a DLL boundary to a different framework.
In the case of Using C dll in delphi return nothing, someone tries to pass an Interface to some memory in the C side over to Delphi.
Unless that interface is COM based, don’t do that!
In a more general way: don’t pass memory allocated on the DLL side over to the client side, no matter what kind of client you have.
From the DLL, either pass simple types, or fill buffers allocated at the client side.
Edit:
There was a nice Delphi DLL return string from C# … .NET 4.5 Heap Corruption but .NET 4.0 works? Explain please? – Stack Overflow question explaining in detail what to do for strings in a specific case: use the COM heap on the Delphi side using CoTaskMemAlloc (actually it uses the OLE task memory allocator as the Old New Thing explains).
–jeroen
via: Using C dll in delphi return nothing – Stack Overflow.
Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, 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, Software Development | 5 Comments »
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:
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).
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?
“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 »
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 »
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 [WayBack] with 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 »
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 »