In hindsight, what they should have done when ZEROBASEDSTRINGS were introduced (yes, Delphi XE4):
–jeroen
via: At the MathWorks headquarters Source: http://redd.it/3bl5m1 #matlab….
Posted by jpluimers on 2016/07/28
In hindsight, what they should have done when ZEROBASEDSTRINGS were introduced (yes, Delphi XE4):
–jeroen
via: At the MathWorks headquarters Source: http://redd.it/3bl5m1 #matlab….
Posted in Delphi, Delphi 10 Seattle, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »
Posted by jpluimers on 2016/07/26
A while ago, StackOverflow user Kobus Smit did some brilliant editorial work that – due to current state of StackOverflow – sort of fired backwards: his question got marked as duplicate before he could post his excellent answer. After that answer was posted, the oh-so pride SO-demi gods never took any energy to revisit to see which answers were best.
His simple question:
How can my Delphi app easily write to the Windows Event Log?What is the difference between TEventLogger and ReportEvent? How do I use the ReportEvent function?
Which somehow should be encompassed by this Delphi 5 question (apparently that 15+ year old Delphi version is still considered current by the SO demi-gods).
The answer summarises and extends existing answers spread out over StackOverflow and adds an EventLog git repository wrapping the ReportEvent and RegisterEventSource (which somehow is always a pain: Delphi services for instance often forget that).
Lesson learned when doing editorial work:
–jeroen
via: Writing to the Windows Event Log using Delphi – Stack Overflow
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »
Posted by jpluimers on 2016/07/12
Recently I bumped into a thing that I’d long forgotten: the Delphi compiler treats searching for include files (any files used with the {$I} or {$include} directive differently:
This means that when you press
Ctrl-Enteron the filename to be included you might edit a different file than the compiler will include.
So when a product has multiple include files with the same name in different sub-directories, then you must modify them all.
I’m not sure this is a bug or feature, so Embarcadero is free to put this in either their QA system or documentation system.
–jeroen
Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »
Posted by jpluimers on 2016/06/30
I’ve seen this compiler error in Delphi XE8 and others in Delphi XE6 and XE7 using a project depending on the built-in FastReports:
F2051 Unit fs_iinterpreter was compiled with a different version of fs_isysrtti.TfsSysFunctions
This will probably fail in more recent versions as well.
The easiest workaround is this:
- Fast Report XE6 (4.15.10)
- Fast Report XE7 (Version 5.1.5)
- Fast Report XE8 (Version 5.2)
The problem could be solved with help of technical support (Paul Gursky).
The solution is to remove all pas files from:
- LibD20 (XE6)
- LibD21 (XE7)
- LibD22 (XE8)
- LibD22x64 (XE8)
The above is paraphrased from Fast Reports forum > Fatal Error F2051 when compiling under Delphi XE6 and XE7
The core of the problem is that Fast Reports stores .dcu/.hpp/.pas files in the same directory whereas Delphi itself stores the .dcu/.hpp/.o files in one directory (actually usually in debug and release directories for each supported platform like win32, win64, etc).
Note: the built-in Fast Reports limits a few features, for instance export to Excel is not supported.
–jeroen
Posted in Delphi, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/04/21
The below fragment is one of the favourite kinds of examples in the Ruby world:
5.times { |i| print i, " " }
It uses the times method on Integer and prints:
0 1 2 3 4
There are many implementations of this in other languages, for instance Ruby’s ‘times()’ function in C# | Of Code and Me (which the WordPress.com editor fucked up as it replaced Action<int> with Action which is a totally different thing, so the gist with code is below.
public static class IntExtensions
{
public static void Times(this int i, Action func)
{
for(int j = 0; j < i; j++)
{
func(j);
}
}
}
Which you use as
5.Times(i => Console.Write(i));
It’s slightly off as it prints:
01234
I know; nitpicking, but this code works (did I ever tell I love .NET fiddle?):
5.Times(i => Console.Write("{0} ", i));
Well, Mason Wheeler encouraged Asbjørn Heid for the below Ruby Mania in Delphi; just read the comments at In C# nearly everything is an object, so when writing a unit test for a string…
Since the WordPress.com editor fucks up TProc<Integer> into TProc and TProc behaves differently from TProc<Integer>, I’ve included a gist link with the actual code below.
program RubyManiaConsoleProject;
uses
System.SysUtils;
type
TRubyMania = record helper for ShortInt
procedure times(const IterBody: TProc);
end;
procedure TRubyMania.times(const IterBody: TProc);
var
i: Integer;
begin
for i := 0 to Self-1 do
IterBody(i);
end;
begin
5.times(
procedure(i: Integer)
begin
Write(i, ' ');
end
);
end.
It also shows why I hardly use anonymous methods in Delphi: they’re way too verbose.
–jeroen
Posted in Conference Topics, Conferences, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Event, Software Development | 1 Comment »
Posted by jpluimers on 2016/04/05
The “Official statement” of Embarcadero about their recent hacks are in the form of comments on public messages mentioning the hacks, some asking to take discussions offline.
They forgot to comment on Delphi: disable or change your welcome page to not use the Embarcadero site (as that site has been hacked twice this weekend) « The Wiert Corner – irregular stream of stuff, so here is their comment from the G+ thread I posted:
FYI: Future versions will no longer have the banner pulled from the website on the start page.
Source: This weekend, the Embarcadero web site was hacked by AnonCoders. once…
I hope it will be the upcoming Delphi 10.1 Berlin version, but given their speed at responding to security threats, I won’t hold my breath.
–jeroen
PS: what a coincidence that I wrote this yesterday on G+:
I know of a few companies that could benefit from more openness.
Ilya Grigorik originally shared: Edge team announced new (EdgeHTML) open issue tracker: http://bit.ly/1S3uhp5 – yay! The times, they are changing.File away!
Posted in Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/03/17
Stefan Glienke worded it perfectly: Default(typeIdentifier) is a “magic” function that is implemented into the compiler and causes it to generate the correct code – like for records with managed fields it generates a call to FinalizeRecord and some instructions to zero the remaining fields.
Source: I know I can write MyRecordVar := Default(TMyRecordType) because I asked a qu…
–jeroen
Posted in Delphi, Delphi 10 Seattle, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/03/14
This weekend, the Embarcadero web site was hacked by AnonCoders. Not once (see also [WayBack] G+ link and [WayBack] DelphiPraxis link and [WayBack] image) but at least twice (see also [WayBack] G+ link and [WayBack] image and [WayBack] Delphi Praxis link and [WayBack] image) where the initial hacked simple text “Hacked By AnonCoders ~ Cyber Caliphate” after having been reverted back to the site – hopefully by Embarcadero staff – was replaced with [WayBack] more graphical content later on.
The Welcome Page inside the Delphi IDE uses the Embarcadero web site, so the Delphi IDE Welcome Page was also affected (see also [WayBack] this G+ link).
Because the IDE uses this on-line content, potentially any code could be executed inside the IDE (apart from that page being loaded over http, so any man-in-the-middle could abuse this, but I digress). This imposes a security risk as many developers run the IDE from accounts having more rights than the average user.
Posted in Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, QC, Software Development | 13 Comments »
Posted by jpluimers on 2016/02/24
As Delphi allows to forward declare both classes and interfaces, people often wonder about records.
The short answer: you can’t forward declare record types.
The long answer: you can’t directly, but you can indirectly either reference based (through pointers or callbacks with const parameters) or operator based (through operator overloading).
I think the reason forward declaration of classes and interfaces is possible because they both are reference types, so referring does not impose copying.
Anyway, the trick is this:
You can’t have forward declarations for record types. Define both Implicit operators in the second type
–jeroen
via:
Posted in Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/02/17
A wile ago, I had a this error when trying to get the TIME portion of a DATE column:
This doesn’t work in Oracle, even though when you search for Oracle convert DATE to TIME you end up at this page listing TIME as a function: 12.7 Date and Time Functions. Alas, that page is for MySQL which is owned by Oracle for a while now.
Back to the query which was like this where date_column was of type DATE.
SELECT
id,
date_column,
TIME (date_column)
FROM some_table
That DATE type actually stores date+time, and since it was filled with Delphi TTime values, the date parts would always be “1899-12-30” (yes, I like ANSI DATE and TIMESTAMP formats). Oracle doesn’t get that, so I wanted to get the time portion.
Solutions:
Posted in Database Development, Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, OracleDB, Software Development | Leave a Comment »