Cool stuff: DelphiSpec library, inspired by Cucumber. It runs on top of DUnit.
via DelphiSpec Library Announce « Роман.Янковский.me.
A similar one in the .NET realm: SpecFlow – Pragmatic BDD for .NET.
–jeroen
Posted by jpluimers on 2013/12/22
Cool stuff: DelphiSpec library, inspired by Cucumber. It runs on top of DUnit.
via DelphiSpec Library Announce « Роман.Янковский.me.
A similar one in the .NET realm: SpecFlow – Pragmatic BDD for .NET.
–jeroen
Posted in .NET, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 3.0, C# 4.0, C# 5.0, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2013/12/19
Almost a year ago, a thread on “premature Delphi optimization” came by on G+ about this code:
procedure ExchangeInteger(var AValue1, AValue2: Integer); begin AValue1 := AValue1 xor AValue2; AValue2 := AValue1 xor AValue2; AValue1 := AValue1 xor AValue2; end;
I don’t think that was premature optimization, just some code from an old fart that had already been programming in the era where processors had reasons to use it:
Back then, the only efficient way to exchange two variables of the same data type was using the XOR swap algorithm.
Nowadays you have more options, and this is where the fun in that thread began, which I will show in a minute.
The XOR swap algorithm was widely known in the 80s of last century and before, especially because the 6502 processor (oh the days of LISA Assembler) was vastly popular, as was the Z80. Together, they powered the majority of the home computers in the 70s and 80s.
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, History, Pascal, Software Development, Turbo Pascal, UCSD Pascal | 7 Comments »
Posted by jpluimers on 2013/10/31
The question datetime – Delphi Now() function returns a wrong value – Stack Overflow is similar to my article Delphi – Michael Justin had strange floating point results when his 8087 FPU Control Word got hosed.
Good that stackoverflow user Anton Zhuchkov found out the cause himself: his answer indicates the Precision Control (and rounding) part of the FPU state got hosed by wrongly initializing the Direct3D device.
I edited his answer with some extra links to documentation.
Finally I’ve found the solution. I needed to specify the
D3DCREATE_FPU_PRESERVEflag when creating a D3D device byD3D.CreateDevice.Otherwise, without that flag, all floating point operations are performed with single precision. As the
TDateTimeis a simpleDouble, andNow()functions is consist of simple addition of date value to time value, it all get messed up by DirectX “smart” override.Problem solved. It was a tricky one indeed. :)
–jeroen
via: datetime – Delphi Now() function returns a wrong value – Stack Overflow.
Posted in 8087, Algorithms, Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Floating point handling, Software Development | 2 Comments »
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/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:
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/05/29
In pre-Galileo versions of Delphi it was easy to run a .BAT or .CMD file as a main project file: just press F9.
Thanks to iManBiglary for posting how to do this in modern Delphi versions. Paraphrased:
Add the file path to
cmd.exe(easieist is to add$(ComSpec)which expands the %ComSpec% environment variable) in the tools menu, with/c$EDNAMEas the parameter.
In addition, you can tell the IDE to save your file before running the external tool with the$SAVEmacro
One of the things you can do with this is add a project containing a batch file that starts to assemble your build results to create a deployment set.
–jeroen
Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Leave a Comment »
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
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/24
So I won’t forget, as the [WayBack] static 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:
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 »