Archive for the ‘Delphi 2010’ Category
Posted by jpluimers on 2013/01/29
If Gloegg@Bonn has posted a few nice Delphi entries over the last couple of years, so he should be added to DelphiFeeds.
His last one was a very funny post on the Delphi implementation of Sleep sort.
It uses Generics, so you need at least Delphi 2009 or better.
–jeroen
via:
Posted in Delphi, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | 4 Comments »
Posted by jpluimers on 2013/01/08
When developing in multiple languages, it sometimes is funny to see how they differ in compiler oddities.
Below are a few on const examples.
Basically, in C# you cannot go from a char const to a string const, and chars are a special kind of int.
In Delphi you cannot go from a string to a char. Read the rest of this entry »
Posted in .NET, ASCII, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Delphi, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Development, Encoding, Software Development, Unicode | Leave a Comment »
Posted by jpluimers on 2012/09/27
Cool: learned something new here:
About the path names of files being in the .dproj as well as in the .dpr:
@Jeroen – Looks like msbuild might need those entries, otherwise they’re possibly redundant, AFAICT… In any case, there is not much editing involved, just delete ‘dccreference’ entries and then a ‘save all’ in the IDE regenerates them. – Sertac Akyuz
–jeroen
via: refactoring – How to reorganize the folder structure of my units in Delphi? – Stack Overflow.
Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: computer, Delphi, folder structure, ide, path names, stack overflow, technology | 14 Comments »
Posted by jpluimers on 2012/09/11
Today I found out the hard way that you really need a build integration system for managing VersionInfo in Delphi applications: as of Delphi XE2 it is broken in the IDE.
See these links:
This is the only workable workaround so far:
–jeroen
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 | Tagged: application version, computer, Delphi, delphi applications, education, embarcadero, integration system, stack overflow, technology | 14 Comments »
Posted by jpluimers on 2012/09/10
Last week, ModelMaker Code Explorer 10.0.0 got released:
General new features
- Delphi XE3 / RAD Studio XE3 support
(as well as support from Delphi 5 and up)
- Member Search list allows filtering on member type. Todo items are also displayed.
- Pascal, new option on tab MMX | Properties | Pascal | New Entities | Methods: Empty Parameter lists. This controls how empty method, procedure and delegate parameter lists are emitted: either suppressed – pascal style, or emitted as ( ) – c-style.
- Locate Type: displays a filtered list of previously parsed class and interface types. This is used to open the containing source file and locate a class inside the file. Default key binding Alt+Shift+T.
Solved bugs
- Text containing line breaks and stored in XML (settings, snippets) could contain stray 0x0B (#11) characters. Solved.
- An access violation at shutdown could occur in older Delphi IDEs if MMX was not docked. Solved.
- If the Delphi IDE editor buffer contains a stray #0 (which is bad in itself) would cause all kinds of exception in MMX. MMX now detects stray #0’s and abort all editing operations, displaying the line:column of the bad #0 character.
- Pascal: relative paths starting with \ (relative to root in drive) would not be handled correct. Solved
–jeroen
via: ModelMaker Code Explorer 10.0.0.
Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: access violation, c style, delegate, Delphi, delphi 5, delphi ide, editor buffer, empty parameter, interface types, line breaks, member search, member type, new features, new option, pascal, relative paths, snippets, software, technology | 2 Comments »
Posted by jpluimers on 2012/08/14
Last week I posted an in depth answer on StackOverflow.com about the memory allocation difference in Delphi and Fortran, or more accurately in two different kinds of languages.
You have:
- column major order (not only used in Fortran and other science centric languages, but also in the shading languages GLSL and HLSL that can be used in FireMonkey)
- row major order (used in most other languages, for instance Delphi, C, etc)
A very important aspect is the order of for optimized loops. For column major order, the optimum is inside out (as the inner arrays/records are in consecutive memory locations), but for row major order, it is the exact inverse.
One of the consequences is that in Fortran it is a very fast operation to pass an array of inner fields as parameter to a method.
This is what I wrote: Read the rest of this entry »
Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi for PHP, Delphi x64, Delphi XE, Delphi XE2, Development, Fortran, Software Development | 4 Comments »
Posted by jpluimers on 2012/08/07
Now that the there are RadStudio XE3 demos available at SourceForge.net Repository – [radstudiodemos] Index of /branches/RadStudio_XE3, and a post on a Delphi Event in New Zeeland rumours of an eminent Delphi/RAD Studio XE3 version start to raise.
It is fun to watch the activity stats on the SourceForge project RAD Studio Demo Code and correlate them to the Delphi release and update dates.
I made PNG images of two graphs. Click on them to enlarge, or click on the links to get to the statistics pages.
Note that when the span is wide enough, activity gets summed to the start of the month (first picture).
Project statistics graphs
Correlation
The real fun is the correlation with the Delphi Release Dates – Delphi Programming and the Delphi update dates from the Delphi Registered User Downloads.:
| Year-Month |
Date |
Delphi/
RAD Studio
version |
Release/Update |
| 2009-12 |
2009-12-14 |
2010 |
Update 4/5 |
| 2010-08 |
2010-08-30 |
XE |
Release |
| 2011-07;2011-08 |
2011-09-02 |
XE2 |
Release |
| 2011-11 |
2011-11-01 |
XE2 |
Update 2 |
| 2012-04 |
2012-05-18 |
XE2 |
Update 4 + Hotfix |
| 2012-07 |
2012-??-?? |
XE3? |
Release? |
–jeroen
via: RAD Studio Demo Code | Free software downloads at SourceForge.net.
Posted in Delphi, Delphi 2010, Delphi XE, Delphi XE2, Development, Software Development | 5 Comments »
Posted by jpluimers on 2010/05/11
This Why does this code fail in D2010, but not D7 question on stackoverflow once again shows that SizeOf on character arrays usualy is evil.
My point in this posting is that you should always try to write code that is semantically correct.
By writing semantically correct code, you have a much better chance of surviving a major change like a Unicode port.
The code below is semantically wrong: it worked in Delphi 7 by accident, not by design:
Like many Windows API functions, GetTempPath expects the first parameter (called nBufferLength) number of characters, not the number of bytes. Read the rest of this entry »
Posted in 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, Encoding, ISO-8859, Software Development, Unicode | Leave a Comment »
Posted by jpluimers on 2009/12/24
With the default settings, the Delphi 2010 code formatter folds anonymous methods on one line.
Is there anyone who has found settings to circumvent this?
(You can also react on my Stackoverflow question here, I will update the blog with the relevant answers).
Original code:
procedure TUnit.AppendFinalization(const StringBuilder: TStringBuilder);
begin
AppendMemberResults(StringBuilder,
function(Member: TGeneratableInUnit): IStringListWrapper
begin
Result := Member.FinalizationText;
end
);
end;
procedure TUnit.AppendMemberResults(const StringBuilder: TStringBuilder; const GetMemberText: TFunc<TGeneratableInUnit, IStringListWrapper>);
Formatted code:
procedure TUnit.AppendFinalization(const StringBuilder: TStringBuilder);
begin
AppendMemberResults(StringBuilder, function(Member: TGeneratableInUnit): IStringListWrapper begin Result := Member.FinalizationText; end);
end;
procedure TUnit.AppendMemberResults(const StringBuilder: TStringBuilder; const GetMemberText: TFunc<TGeneratableInUnit, IStringListWrapper>);
As you can see, the anonymous method is being formatted to one line.
I feel I’m missing some kind of setting here…
–jeroen
Posted in Delphi, Delphi 2010, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2009/10/19
Operator overloading is a very nice feature of the Delphi language.
However. the Delphi documentation on Operator overloading is not completely right.
Below is my table of what I found out so far, and some notes.
It is part of my “Nullable types in Delphi” session that I gave on some conferences.
The downloads for that session contain more detailed information.
This is just an abstract to get you going and a try to answer this operator overloading question on Stackoverflow.
Download the full presentation to get more in depth information.
Let me know if you need more information.
Notes
Operator overloading
Add your own “behaviour” to operators
- Win32: Works only for records, not classes!
- An operator and the operand(s)
are being implemented worden by a “class operator”;
this is a kind of class method with name and argumen(s)
Example:
- Multiplication X : = A * B;
- Operator: *
- Name: Multiply
- Operands: 2 -> two parameters
type
TMyRecord = record
class operator Multiply(A, B: TMyRecord): TMyRecord;
end;
Documentation is not correct!
Combining the rules of operator and result types, you can do magical things like Dances with XML | Australian Delphi User Group Members.
Do not use Delphi 2006 with operator overloading
Delphi 2007 fixed a number of bugs including this one: Delphi 2006 wont allow const parameters of type record within record method? – Stack Overflow.
10+ years later: maybe assignment operator?
It might be that in 2019, a new Delphi version gets assignment operator overloading: [WayBack] Operator Overloading Explained – Code Partners
Watch the result type of comparison operators!
Tips:
- Some operators should be overloaded pair-wise
= and <>
shl and shr
< and >=
> and <=
dec and inc
+ and –
/ and *
div and mod
- Prefer Explicit over Implicit operators
- Beware of the built-in type coercion (implicit operators)
- e.g
- Byte to Integer;
- Integer to Double;
- Variants from/to anything!
Table of operators
| operator |
# |
usage |
name |
cagetory |
* |
| and |
2 |
R := A and B; |
BitwiseAnd |
bit |
|
| not |
1 |
R := not A; |
//BitwiseNot |
bit |
glitch: does not exist! |
| or |
2 |
R := A or B; |
BitwiseOr |
bit |
|
| xor |
2 |
R := A xor B; |
BitwiseXor |
bit |
|
| () cast |
1 |
R := TValue(A); |
Explicit |
conversion |
|
| := |
1 |
R := A; |
Implicit |
conversion |
|
| operator |
# |
usage |
name |
category |
* |
| round |
1 |
R := Round(A); |
Round |
function |
|
| trunc |
1 |
R := Trunc(A); |
Trunc |
function |
|
| and |
2 |
R := A and B; |
LogicalAnd |
logical |
|
| not |
1 |
R := not A; |
LogicalNot |
logical |
|
| or |
2 |
R := A or B; |
LogicalOr |
logical |
|
| xor |
2 |
R := A xor B; |
LogicalXor |
logical |
|
| operator |
# |
usage |
name |
category |
* |
| + |
2 |
R := A + B; |
Add |
binary |
|
| / |
2 |
R := A / B; |
Divide |
binary |
|
| div |
2 |
R := A div B; |
IntDivide |
binary |
|
| mod |
2 |
R := A mod B; |
Modulus |
binary |
|
| * |
2 |
R := A * B; |
Multiply |
binary |
|
| – |
2 |
R := A – B; |
Subtract |
binary |
|
| operator |
# |
usage |
name |
category |
* |
| shl |
2 |
R := A shl B; |
LeftShift |
binary |
name is confusing |
| shr |
2 |
R := A shr B; |
RightShift |
binary |
name is confusing |
| – |
1 |
R := -A; |
Negative |
binary |
|
| + |
1 |
R := +A; |
Positive |
binary |
|
| dec |
1 |
Dec(A); |
Dec |
self |
|
| inc |
1 |
Inc(A); |
Inc |
self |
|
| operator |
# |
usage |
name |
category |
* |
| = |
2 |
R := A = B; |
Equal |
comparison |
|
| > |
2 |
R := A > B; |
GreaterThan |
comparison |
|
| >= |
2 |
R := A >= B; |
GreaterThanOrEqual |
comparison |
|
| < |
2 |
R := A < B; |
LessThan |
comparison |
|
| <= |
2 |
R := A <= B; |
LessThanOrEqual |
comparison |
|
| <> |
2 |
R := A <> B; |
NotEqual |
comparison |
|
| operator |
# |
usage |
name |
category |
* |
| in |
2 |
R := A in B; |
In |
set |
|
–jeroen
Posted in Conferences, Delphi, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Event, Software Development | 6 Comments »