The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘Delphi XE5’ Category

Favorite Documents extension for Visual Studio 2010 and up

Posted by jpluimers on 2015/01/20

This used to be a great Delphi-only feature that I missed in Visual Studio, but I found the downloadable free extension Favorite Documents extension.

It is a by Sergey Vlasov, who has a whole bunch of free and paid Visual Studio add-ins, extensions and tools.

–jeroen

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Development, Software Development, Visual Studio 11, Visual Studio 2010, Visual Studio and tools | Leave a Comment »

Delphi: ZEROBASEDSTRINGS and maintaining cross-version Delphi libraries

Posted by jpluimers on 2015/01/14

One of the features that bites me over and over again is the ZEROBASEDSTRINGS that got introduced in Delphi XE3 and is by default ON in mobile compilers and OFF in Desktop compilers.

Back then, Mark Edington showed a small example of the effects:


procedure ZeroBasedTest;
const
S: string = '012';
begin
{$ZEROBASEDSTRINGS OFF}
Writeln(S[1]); // shows "0"
Writeln(S.Chars[1]); // shows "1"
{$ZEROBASEDSTRINGS ON}
Writeln(S[1]); // shows "1"
Writeln(S.Chars[1]); // shows "1"
end;

view raw

gistfile1.txt

hosted with ❤ by GitHub

and then explained:

The XE3 RTL source code has been refactored to be string index base agnostic. In most cases this is done by utilizing string helper functions which are always zero based.
When it is necessary to traverse a string, the Char[] property is often used to access the individual characters without concern for the current state of the compiler with respect to zero based strings.

In addition, the “Low” and “High” standard functions can now be passed a string variable to provide further flexibility as needed.
When zero based strings are enabled, Low(string) will return 0,  otherwise it will return 1. Likewise, High() returns a bounds adjusted length variation.

The problem is the non-existent forward compatibility of the other compilers (Delphi XE2 and lower).

So if you have library code that needs to work in Delphi versions, you cannot use the High and Low to make the code ZEROBASEDSTRINGS neutral.

Many Delphi developers regularly skip many Delphi versions, so these are still popular:

  • Delphi XE1 and XE2 (the last 2 compilers before Delphi really started to support mobile)
  • Delphi 2007 (the last non-Unicode Delphi compiler)
  • Delphi 7 (the last non-Galileo IDE)

The result is that library code is full of conditionan IF/IFDEF blocks like these:

Fix: this works only in XE3 or higher: “for Index := Low(input) to High(input) do // for ZEROBASEDSTRINGS”


{$ifdef GX_VER240_up}
for Index := Low(input) to High(input) do // for ZEROBASEDSTRINGS
{$else}
for Index := 1 to Length(input) do
{$endif GX_VER240_up}

view raw

gistfile1.txt

hosted with ❤ by GitHub

–jeroen

via: Mark Edington’s Delphi Blog : XE3 RTL Changes: A closer look at TStringHelper.

Posted in Ansi, Delphi, Delphi 2007, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Encoding, Software Development, Unicode | 8 Comments »

Just in case I ever need it again: jed-software.com » Blog Archive » FastMM4 Gui – Source Code.

Posted by jpluimers on 2015/01/07

Just in case I need the FastMM4 Gui – Source Code ever again.

Read the rest of this entry »

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Leave a Comment »

Nick Hodges: Man, the chapter on Multi-threading is going to be seriously hard to write.…

Posted by jpluimers on 2015/01/05

A very nice thread around multi-threading in Delphi is evolving at Google Plus: Nick Hodges: Man, the chapter on Multi-threading is going to be seriously hard to write.….

Note: you need to be member of that G+ group to read it, but Nick Hodges allows most people in…

–jeroen

(I also tagged it XE8, as by the time such a book arrives, that Delphi version has most likely come out given the past release frequency <g>)

Posted in Delphi, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 7 Comments »

Delphi memory managers – via Tommi Prami G+

Posted by jpluimers on 2014/12/30

There is a nice Delphi memory thread at G+ initiated by Tommi Prami for which I added some links to the memory managers:

  • FastMM (No signs of the Version 5)
  • ScaleMM – Interesting (two versions)
  • SynScaleMM – Fork of the previous
  • SapMM – Just found out about this, but tries to tackle multithreading issue.

More interesting comments (most people seem to favour FastMM, as they can get very good performance out of it even in multi-threaded environments) at There have not been much of the Talk of MemoryManagers lately….

Note there is also TBBMM based on TBB, but it seems unmaintained.

Barry Kelly’s memory manager is based on Boehm-Demers-Weiser GC.

–jeroen

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Development, Software Development | Leave a Comment »

Delphi Cookbook for USD 5 (or EUR 4.80); actually: get any Packt eBook or video for that price – #packt5dollar

Posted by jpluimers on 2014/12/20

Earlie this month, I wrote a review about Delphi Cookbook.

Well: as of last thursday, you can get that for USD 5 (or EUR 4.80, so better get yourself a USA account: just ensure your address is in the USA).

Heck: until januari 6th, you can get any eBook or Video on Packt for USD 5.

Note there is even an x-Mas countdown on the way (with each day a free book that is readable/downloadable for 24 hours).

There’s over 2500+ books to choose from, so I’m grabbing this chance to learn a few things on OpenCV, Scala, and PowerShell.

–jeroen

via: Book review: Delphi Cookbook by Daniele Teti, Packt publishing.

Posted in .NET, CommandLine, Delphi, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Development, Java Platform, PowerShell, Scala, Scripting, Software Development | Tagged: , | Leave a Comment »

Delphi and MVVM: the demo by Malcolm Groves

Posted by jpluimers on 2014/12/17

A small follow up on MVVM, MVP, MVC, OOD, etc: it is all about structure and using common sense:

When you want to do MVVM with Delphi, there is a great Delphi MVVM demo that Malcolm Groves gave at CodeRage 7 that is on YouTube.

A few resources you should look at after viewing that demo:

Some of it might work with Delphi XE2, but I think you need XE3 or younger for most of the demos.

–jeroen

Posted in Delphi, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | 3 Comments »

Which Delphi extensions to (not) put in version control: Delphi File Extensions – Delphi Programming (via Delphi.wikia.com)

Posted by jpluimers on 2014/12/10

Convenient list to decide what to put in your version control system: Delphi File Extensions – Delphi Programming.

–jeroen

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, Delphi XE6, Delphi XE7, Development, Software Development | Leave a Comment »

Book review: Delphi Cookbook by Daniele Teti, Packt publishing

Posted by jpluimers on 2014/12/01

After speaking on EKON 2014 and ItDevCon 2014, the last month has been extremely busy on both the work and family side of things.

So it took longer to write my review of the Delphi Cookbook by Daniele Teti, Packt publishing (ISBN 978-1783559586).

Before the review, first two ways to see for yourself if you’d like the book:

Daniele Teti has a Table of Contents on the page where he introduced his book, but that ToC is a bit poorly formatted, so I included a better formatted one below.

Some other reviews of the Delphi Cookbook also make an interesting read (I read them after writing my own):

Before the review a disclaimer. I bought the eBook version before Packt publishing asked for reviewers. They sent me a paper copy for free (which somehow took 2 weeks to arrive). I read about 25% of the book before the two European Delphi conferences, and the rest over the last two weeks.

The Review

I’ll try to keep this to the point, as too much detail would be killing. And I’m not writing a book here (:

So lets start with what I like:

  • Writing style: most of it is very pleasantly and encouraging to read.
  • Structure
    • introduction – short description of the aim
    • how to do it – step by step explanation to get an example working
    • how it works – explaining the crucial parts of the example
    • there’s more – revealing more details and providing background information
  • Explanation where recipe deviates from best practices
  • Mix of topics
  • Fresh and surprising examples
  • Building the examples on (relatively) new language and library features without distracting the examples: I was positively surprised about every other example how well Daniele did this
  • For Delphi features in the book introduced in a specific Delphi version mentioning this version
  • Keeping a variety of topics throughout the book, while still building up on previous sections during the book

I want to stress the last: Daniele Teti did an excellent job on this.

When writing a book or teaching material, it is hard to strike balances between the kinds and diversity of topics, the depth and order of the topics, and choosing between what to cover and how to cover it.

The way the chapters a built together with a variety of interesting topics per chapter, a great mix of chapters, and the various topics building (but not too much relying) on previously covered topics is really great. The whole book shows that Daniele is a great teacher. Well done.

Then a few things I dislike:

  • Chapter 1
    • The first chapter has a few VCL topics that could have been explained better. I have the feeling those were the initial writing chapters, and Daniele and the reviewers were still settling down on a routine. Shortly after that, the book gets much much better: like hearing Daniele doing a talk on a conference.
  • Code formatting
    • Especially in the eBook, the code is poorly formatted. There are enough tools to to a properly formatted example code export from Delphi, so this should have been done much better.
  •  Proofreading
    • There is still a quite a bit of non-English idiom and sentence structure in the book. This can be distracting. The reviewers and editors should have done a better job on this.
  • Security
    • Even though explaining SQL injection, the book does not talk about any other kinds of injection. Since there are many examples of clients and servers passing parameters by strings, there is virtually no error checking. This is bad, as exactly those kinds of parameter passing can make for very vulnerable applications.
  • Hard coded Delphi XE6 links
    • most of the Embarcadero web site allows you to link to topics in a non-Delphi version speficif way
  • Some “there’s more” portions are a bit thin
    • I know this is a trade off: so few pages, to much to cover. But still (: Maybe Daniele finds time to write a series of blog posts on the “there’s more” portion.
  • Cleanup without doing try..finally
    • Way too few programmers value the try..finally construct (Delphi, C#, and many other languages) so this should be the cornerstone of every resource cleanup example.

The dislikes are minor compared to the likes, so here is the…

Verdict

I didn’t buy the book by accident: knowing the presentation and teaching style of Daniele, I was expecting a nice mix of topics explained in a light and fun way. The book surpassed those expectations by far.

So any Delphi programmer should buy this book. If not for using right now, then for getting some ideas, and reading the various topics later.

Below some suggested combinations for using this book various Delphi audiences.

Audiences

Starters

Buy this book. It gets you inspired, even if only some of the topics are suited for real beginners. Then get the books below, read them and get back to the Delphi Cookbook for more inspiration:

Average Delphi users

Buy this book. Consider buying Coding in Delphi by Nick Hodges.

Advanced Delphi users

Also read Coding in Delphi by Nick Hodges.

Delphi gurus

I know few people that master all Delphi topics well (I’m not one of them: especially on the mobile side I’ve still a lot to learn). Even for gurus, I think this is a nice book, especially considering the price.

–jeroen

Table of Contents

Chapter 1: Delphi Basics

  1. Changing your application’s look and feel with VCL styles and no code
  2. Changing the style of your VCL application at runtime
  3. Customizing TDBGrid
  4. Using the owner’s draw combos and listboxes
  5. Creating a stack of embedded forms
  6. Manipulating JSON
  7. Manipulating and transforming XML documents
  8. I/O in the twenty-first century – knowing streams
  9. Putting your VCL application in the tray
  10. Creating a Windows service
  11. Associating a file extension with your application on Windows

Chapter 2: Become a Delphi Language Ninja

  1. Fun with anonymous methods – using higher-order functions
  2. Writing enumerable types
  3. RTTI to the rescue – configuring your class at runtime
  4. Duck typing using RTTI
  5. Creating helpers for your classes
  6. Checking strings with regular expressions

Chapter 3: Going Cross Platform with FireMonkey

  1. Giving a new appearance to the standard FireMonkey controls using styles
  2. Creating a styled TListBox
  3. Impressing your clients with animations
  4. Using master/details with LiveBindings
  5. Showing complex vector shapes using paths
  6. Using FireMonkey in a VCL application

Chapter 4: The Thousand Faces of Multithreading

Synchronizing shared resources with TMonitor
Talking with the main thread using a thread-safe queue
Synchronizing multiple threads using TEvent
Displaying a measure on a 2D graph like an oscilloscope

Chapter 5: Putting Delphi on the Server

  1. Web client JavaScript application with WebBroker on the server
  2. Converting a console service application to a Windows service
  3. Serializing a dataset to JSON and back
  4. Serializing objects to JSON and back using RTTI
  5. Sending a POST HTTP request encoding parameters
  6. Implementing a RESTful interface using WebBroker
  7. Controlling remote applications using UDP
  8. Using App Tethering to create a companion app
  9. Creating DataSnap Apache modules

Chapter 6: Riding the Mobile Revolution with FireMonkey

  1. Taking a photo, applying effects, and sharing it
  2. Using listview to show and search local data
  3. Do not block the main thread!
  4. Using SQLite databases to handle a to-do list
  5. Using a styled TListView to handle a long list of data
  6. Taking a photo and location and sending it to a server continuously
  7. Talking to the backend
  8. Making a phone call from your app!
  9. Tracking the application’s life cycle

Chapter 7: Using Specific Platform Features

  1. Using Android SDK Java classes
  2. Using iOS Objective-C SDK classes
  3. Displaying PDF files in your app
  4. Sending Android intents
  5. Letting your phone talk – using the Android TextToSpeech engine

–eof–

Posted in Delphi, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Development, Software Development | 5 Comments »

Reminder: rebuild my Nullable Types based on Class Operators in Delphi

Posted by jpluimers on 2014/11/27

Class Operators in Delphi have been introduced in the ARM compiler in Delphi XE4 for iOS support.

By now it has been in the ARM compiler for Android too, and hopefully it will (soon) be in the x86 compiler as well.

So it is time to look at my Nullable types again, and see if I can port them over to classes.

Some references so I won’t forget them: Read the rest of this entry »

Posted in Delphi, Delphi XE4, Delphi XE5, Development, Software Development | 4 Comments »