-
Recent Posts
Archives
- April 2024
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- August 2021
- July 2021
- June 2021
- May 2021
- April 2021
- March 2021
- February 2021
- January 2021
- December 2020
- November 2020
- October 2020
- September 2020
- August 2020
- February 2020
- May 2019
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- September 2017
- June 2017
- April 2017
- March 2017
- September 2016
- June 2016
- April 2016
- January 2016
- December 2015
- August 2015
- July 2015
- April 2015
- October 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- October 2013
- September 2013
- August 2013
- April 2013
- November 2012
- October 2012
Categories
- C++-Builder
- CSS
- Delphi
- FireMonkey
- HTML
- JavaScript
- RAD Studio 10 Seattle
- RAD Studio 10.1 Berlin
- RAD Studio 10.2 Tokyo
- RAD Studio 10.3 Rio
- RAD Studio 10.4 Sydney
- RAD Studio 11 Alexandria
- RAD Studio 12 Athens
- RAD Studio XE5
- RAD Studio XE6
- RAD Studio XE7
- RAD Studio XE8
- SourceForge
- Third Party Components
- Tips and Tricks
- TMS Software
- TMS Web Core
- TurboPack
- TurboPower
- Uncategorized
- Visual Studio Code
Meta
Monthly Archives: October 2012
ObjGuard
Sometimes it happens that I would like to convert a Delphi object to an interfaces. Interfaces offer some advantages. On the one hand you can handle different objects that are not derived from a common hierarchy but share the same … Continue reading
More About Records
Since records offer methods and properties they are often used to replace objects. This is possible if there is no need to use inheritance. But there is a significant difference between both. References to objects are like pointers to a … Continue reading
TPath.Combine
I guess that everyone already had to solve this small issue. There are two variables, one with a path, the other with the filename and they have to be combined. In the old Delphi world there is the function IncludeTrailingPathDelimiter … Continue reading
StringOfChar
This week I found a new interesting piece of code. Someone wanted to initialize a string with a special length of the same char. procedure TMyClass.Init; const cBufferLength = 100; var I: Integer; begin … FBuffer := ” for I … Continue reading
(Ab)use of Try..Except
Today I found an example of the abuse of a try.. except block. procedure TMyClass.DoSomething; var sValue: string; iValue: Integer; begin … try iValue := StrToInt(sValue); except iValue := 0; end; … end; The idea is simple. StrToInt converts a … Continue reading
Records
Because of my post about the Switches I would like to mention some things about records. Records are are nice way to do things in an object-oriented way without the overhead of real objects. In the unit System.IOUtils you can … Continue reading
Naming of Constants
Normally constants improve the readability and maintainability of your code. One example is the minimum value of a single. You can find it in the unit System.Math: … const MinSingle = 1.4012984643248170709e-45; … Instead of writing the float value it … Continue reading
Switches
During the last weeks it happened often that I had to write some command line apps. The reason for this is that more and more things are running automatically in tools like FinalBuilder (I will write an article about this … Continue reading
try…finally for multiple objects
Today I found another common mistake. Someone used more than one object and has to free them. var pObject1: TMyObject1; pObject2: TMyObject2; begin pObject1 := TMyObject1.Create; try pObject1.DoSomething; pObject2 := TMyObject2.Create; try pObject2.DoSomethingElse; finally pObject2.Free; end; finally pObject1.Free; end; end; … Continue reading
ANSIToOEM
Today I found some old source code. Someone wanted to write a file in the old OEM codepage. Therefore he wrote a small function that encapsulates the Windows API CharToOem function. class function TStrUtil.ANSIToOEM(const ANSI: string): string; var sBuffer: AnsiString; … Continue reading