Very interesting helper function:
function TDataSetExtensions.Select<TResult>: IEnumerable<TResult>
–jeroen
Posted by jpluimers on 2014/03/12
Very interesting helper function:
function TDataSetExtensions.Select<TResult>: IEnumerable<TResult>
–jeroen
Posted in Delphi, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2014/03/12
For my own link archive: CodeRage 8 replays – Embarcadero Technologies – YouTube.
Lots of nice sessions, including these REST sessions:
About the REST support in Delphi: make sure you take a look at the REST Debugger application, as you get full source code for it and is an excellent starting point to see how the REST components work together (it is written using the FireMonkey UI framework so it runs on a Mac as well as on Windows).
David I explains more about the REST Debugger here: Sip from the Firehose : Using the REST Debugger will help you prototype your Delphi and C++ REST apps.
Jim McKeeth has a really nice video about it as well on XE5 REST Debugger Supercharged | The Podcast at Delphi.org which describes how to use Delphi the Delphi REST tools to use KimonoLabs to scrape data from web sites:
kimono : Turn websites into structured APIs from your browser in seconds.
–jeroen.
RestDemo folder with many examples that connect to many social things (Twitter, FaceBook, DropBox, etc).
Posted in Delphi, Delphi XE5, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2014/03/10
Every once in a while you have multiple threads or processes wanting to write a short message to the same log file. Append then will give you an I/O error 32 (ERROR_SHARING_VIOLATION), but the below small routine will sleep a bit while retrying a couple of times.
It uses these Delphi aspects around the $I or $IOCHECKS compiler directive:
Note there are a few tables of codes you can get back through IOResult as basically you can get many GetLastError results in IOResult as well: 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 x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | 2 Comments »
Posted by jpluimers on 2014/03/06
If you run FastMM4 in FullDebugMode, then here are two tips that new (and sometimes existing users) often overlook:
FullDebugMode directive in the IDE, build your project.The first makes sure all units are compiled with FullDebugMode (Delphi does not always do that automagically).
The second makes sure your EXE can access the DLL that writes out your *MemoryManager_EventLog.txt file containing memory leaks and other issues FastMM4 detected.
–jeroen
Posted in Conference Topics, Conferences, Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Event, FastMM, Software Development | 2 Comments »
Posted by jpluimers on 2014/03/03
Just a reminder to Self after reading Predefined Conditions in Conditional compilation (Delphi) – RAD Studio.
On iOS, these conditional symbols are defined:
For the (x86 based) iOS simulator, CPU386 and CPUX86 are defined.
For iOS physical devices, CPUARM is defined.
For OS X and the iOS Simulator, ALIGN_STACK is defined as some parameters (including Extended) require to be aligned on 16-byte boundaries. For explanation, see the Mac OS X Stack Alignment article by Eli Boling, as well as PC_MAPPED_EXCEPTIONS and UNDERSCOREIMPORTNAME (sometimes een PIC).
–jeroen
via: Predefined Conditions in Conditional compilation (Delphi) – RAD Studio.
Posted in Delphi, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development | Leave a Comment »
Posted by jpluimers on 2014/03/03
When writing the Spring4D unit tests for GetTypeSize to include as many TTypeKind values, I came across a few types that either did not compile, or were not supported by TypeInfo. I listed them below as I could not find them in the documentation.
I included a test named Test_EnsureAllTTypeKindsCoveredByCallsTo_Test_GetTypeSize_ that verifies that all TTypeKind values except tkUnknown are covered. So future extensions of TTypeKind will make the tests fail.
As a side issue, I really wanted to know if tkUnknown could be emitted by the compiler. It can sort of, for instance by defining discontiguous enumerations, but are incompatible with TypeInfo as well.
Types that do not compile at all: Read the rest of this entry »
Posted in Agile, Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, DUnit, Software Development, Unit Testing | 2 Comments »
Posted by jpluimers on 2014/02/25
As a follow up of When using Apple Hardware, be prepared for security updates. iOS already there, OS X and others will follow. #gotofail:
This is a must read: Apple’s #gotofail weekend – Ashkan Soltani, and cortesi – Exploiting CVE-2014-1266 with mitmproxy.
especially since the OS X Mavericks fix is out:
–jeroen
via Norbert Rittel and Kristian Köhntopp.
Posted in Apple, Delphi, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, OS X 10.9 Mavericks, Power User, Software Development, xCode/Mac/iPad/iPhone/iOS/cocoa | 3 Comments »
Posted by jpluimers on 2014/02/20
From long ago, but still very valid, as I recently had another question like “what design patterns does Delphi use?”.
The Delphi usage of patterns to make the VCL and your applications work is one of the reasons I like the Delphi Component Design: Danny Thorpe so much.
Do not let you scare by the book title: a lot of information in this book is much broader than designing components.
It is about why and how things are done in the RTL and VCL, and which patterns you can use yourself.
Try and git it while you can still get it. It is excellent, but rare to get as it has been out of print for a while.
Only a minority of the Delphi developers knows that every Delphi developer uses a Factory pattern (delphi.about.com has an example in “regular” Delphi), but then implemented using virtual Create constructors.
So: time to shed some light on that :-)
Virtual constructors are to classes like virtual methods are like object instances.
The whole idea of the factory pattern is that you decouple the logic that determines what kind (in this case “class”) of thing (in this case “object instance”) to create from the actual creation.
It works like this using virtual Create constructors:
TComponent has a virtual Create constructor so, which can be overridden by any descending class:
type TComponent = class(TPersistent, ...) constructor Create(AOwner: TComponent); virtual; ... end;For instance the TDirectoryListBox.Create constructor overrides it:
type TDirectoryListBox = class(...) constructor Create(AOwner: TComponent); override; ... end;You can store a class reference (the class analogy to an object instance reference) in a variable of type ‘class type’. For component classes, there is a predefined type TComponentClass in the Classes unit:
type TComponentClass = class of TComponent;When you have a variable (or parameter) of type TComponentClass, you can do polymorphic construction, which is very very similar to the factory pattern:
var ClassToCreate: TComponentClass; ... procedure SomeMethodInSomeUnit; begin ClassToCreate := TButton; end; ... procedure AnotherMethodInAnotherUnit; var CreatedComponent: TComponent; begin CreatedComponent := ClassToCreate.Create(Application); ... end;The Delphi RTL uses this for instance here:
Result := TComponentClass(FindClass(ReadStr)).Create(nil);and here:
// create another instance of this kind of grid SubGrid := TCustomDBGrid(TComponentClass(Self.ClassType).Create(Self));The first use in the Delphi RTL is how the whole creation process works of forms, datamodules, frames and components that are being read from a DFM file.
The form (datamodule/frame/…) classes actually have a (published) list of components that are on the form (datamodule/frame/…). That list includes for each component the instance name and the class reference.
When reading the DFM files, the Delphi RTL then:
- finds about the components instance name,
- uses that name to find the underlying class reference,
- then uses the class reference to dynamically create the correct object
A regular Delphi developer usually never sees that happen, but without it, the whole Delphi RAD experience would not exist.
Allen Bauer (the Chief Scientist at Embarcadero), wrote a short blog article about this topic as well.
There is also a SO question about where virtual constructors are being used.Let me know if that was enough light on the virtual Create constructor topic :-)
–jeroen via: What Design Patterns do you implement in common Delphi programming? – Stack Overflow.
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 x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Tagged: Delphi, Delphi Component Design | 4 Comments »
Posted by jpluimers on 2014/02/14
Very interesting: Install AndroVM in VMware Player/Workstation – YouTube.
The successor is Genymotion “the faster Android emulator”, and seems to have an easier installation path: Run Android on Your Desktop With Genymotion Android Emulator.
One of the drawbacks of going native: the Delphi for Android compiler currently only generates ARM Android code, otherwise this would be a great way to test your apps.
But it works fine if you use Java, Oxygene for Java or MonoDroid: much faster than the emulator (which you cannot run in a VM at all).
There seems to be a way to install ARM translation, so I need to check that out: android – How to install google play service in the genymotion (ubuntu 13.04) .Currently it doesn’t have drag and drop suport – Stack Overflow.
–jeroen
via: Koushik Dutta – Google+ – Even if Microsoft is considering supporting Android apps on….
Posted in .NET, Android, Android Devices, Delphi, Delphi XE5, Development, Mobile Development, Mono for Android, Power User, Software Development | Tagged: Android emulator, VMware | 4 Comments »