Tuesday, August 4, 2020

Unicode migration is harder as everybody told you - if you are old.

Harder? Why harder? Everybody is telling you - it's easier as you think.

With every new Delphi Version there is this kind of movement:

Do your Unicode conversion today and use our new Rad-Studio-Version to do your work even better as before. ( Combined often with a special offer )

I fully understand this and, to be honest, this is true and it's also a good idea. Using old Delphi-Versions is horrible. Yes, the old versions are a little bit faster and perhaps the IDE is a little bit more stable. But this is a bad tradeoff because you miss all the new stuff that makes your life so much easier.

Ok, if everything is so fine and easy, why this blog post?

If you have old source code in your legacy application and the oldest unit is created after the year 20xx, you probably have no problems. Because you've used the Rad approach and have clicked DB Components on your form direct bound to your database. Perhaps you used the BDE, but converting this to Firedac is not so hard.

So far so good... Buy the latest Delphi Version to go ahead...

But if you're old and you really learned how to code in the old days with Turbo-Pascal, you are not using DB-Components at all. 

You are using a Record to hold your data. The records had to be aligned by byte or had to be marked as Packed Record.

You store a date in 3 bytes and of course, you had to use typed string to match your needs. 

In these days you had this kind of declaration because every byte counts:

   Str6  = String[ 6];
   Str26 = String[26];
   Str40 = String[40];
   Str80 = String[80];

   TAddress = Packed Record
     FirstName : Str26;
     LastName  : Str26;
     Street    : Str80;
     Zip       : Str6
     Town      : Str80;

  Address : TAddress;

With this definition, you just wrote an address to disk by using blockwrite.

This kind of code works with TP 1 up to Sydney. So what is the problem?

Changing these (short)Strings to a Unicode-String or even to an AnsiString, You are unable to write them to disk anymore because a long string is only a reference, not the actual data. No Problem you just have to serialize the data for read- and write to stream. Each dataset in this stream then has a different length and you have to create a jump table to find the record starting pos. This is the best point to store your data not in a flat-file anymore.

Let's assume you have managed this in your whole app...I still haven't yet.

Long before I had converted my source code to able to compile with XE, I thought it is a good idea to convert every String to an AnsiString, every Char to an AnsiChar and every PChar to an AnsiPChar. 

(At this point I was not aware, that the VCL is not working like the Windows API where nearly every function has an A and W version for Ansi and WideStrings.)

So each

Label1.Caption := Address.Firstnames;

produces a warning while compiling. The Compiler is doing the trick here to convert a short string to the Unicode-Caption-String - so it works. btw. this is called a possible solution in most whiter papers. It is not - Yes it compiles and yes it runs, but the warnings are the problem, we will see later.

Again where is the problem? I call it the "Var Param Problem". 

Imagine you have the record from above. Then you probably have some methods to deal with this data structure, like:

Function MakeName(var Firstname, LastName : Str26) : Str80;

Using var was a good idea and not to copy 54 bytes on the stack.

Perhaps the MakeName function calls another method inside:

Function Crunch(var S : Str26) : Str26;
  While (S[0] > #0) and (S[byte(S[0]) = ' ') do
    S[0] := Chr(Byte(S[0]) - );

  Crunch := S;

Function EmptyName(var S : Str26) : boolean;
  Emptyname := (Crunch(s) = '');  

Function MakeName(var Firstname, LastName : Str26) : Str80;
  if EmptyName(Firstname) 
    then MakeName := crunch(LastName)
    else MakeName := crunch(LastName) +', '+crunch(Firstname);

Yes, if you did not know this - before RESULT was the way to go, assigning the value to the function name was the way you had to write functions!

There where more stupid things we had done in the old days.


Kills the reference and produces a memory leak if you have a long string in the record.

Move(Address, OldAddress, sizeof(Address));

Moves the reference and doesn't create a copy of it.

With hundreds of Methods, using short or special short string types as var params all over your source code, there are no easy ways to convert all of this step by step to a different string type. Once you have changed one function that is called by nearly everybody you get this snowball effect of compiler errors.

Yes, most of the conversion beside the "Var Param Problem" is done by the compiler. The problem is: You will get thousands of warnings and you can not ignore them, because some of them you have to deal with. 

The hard task is: Find the 500 or more problems out of 60.000 warnings. I've started with XE2 and by ignoring most of the "probably lost" warnings because you assign a string to a short string, I'm down to ~7500 warnings.

But here are some good news. With 10.4 we get new managed records that can have an assign and copy method. This is the first time there is a possibility to handle long strings in records the right way by creating a new instance on copy.

It would be so perfect if we had a compiler switch to turn of Unicode in XEx - sorry just dreaming.

While refactoring the code to XE - of course, everything has to be binary matching 1:1, so every not converted data-structure still written to disk is still the same data. By using any sourcecode repository you are able to maintain both trees (Unicode and none Unicode) for a small-time until the conflicts are too much. So the only way to go is to be able to make changes to your non-unicode source, which produces the same results with fewer warnings if you take the XEx compiler. By going this way, you want as little as possible IFDEF's in your source, because you've already a big pile of code to refactor and IFDEF's in the long term makes it more unreadable.

So, how to find a way to go?

It would be perfect if I could keep the short strings in my records as long as possible. Outside of these records, everything could be "normal" string.

- impossible

Everything is calling everybody and nearly every unit is linked to every unit - not always in a direct way, but over some unit in most cases.

Side note: Don't watch Uncle Bob's Clean Code stuff, because after that you will hate your work of the past 35 years much more you already do. (were young we needed the money)

No this is wrong: EVERY Developer should watch this Session 1-6 from Uncle Bob.

Stop reading here and click on this link and after that - if you still think, you do not need to write unit-tests. Sorry, in this case, I can't help you at all. (The only possibility is: You have skipped some parts of the videos).

If I had a trustable coverage of unit tests already in place in my legacy app, EVERYTHING would be so much easier and no fear of changing some of the old methods and dependencies.

And now? I've started a different approach - by using my source-code-tokenizer from my sourcecode formatted project, I was able to find all dependencies in all my Unit-Uses and removed ~400 Units that are not needed anymore in "this" unit. Not bad, but not enough.

I plan to restructure my dependencies with a brute force or NN network - we will see if this could work. The next thing would be a "path through the source" finder, to convert all Var-params from short to string where possible.

So a long way to go and in the end, we are on VCL 32Bit. 64Bit would be the next step. If everybody is going the ARM-Ways perhaps we have to convert to FMX some time in the future.

To get something done, I'm going to ways, first decoupling and writing unit tests, and second try to get rid of the short string or at least the none critical warnings.

And of course everything just in my spare time. I wish I had...

If you have any good ideas - I like to read them in the comments.

So long... Happy coding and watch Uncle Bob!

Friday, July 24, 2020

My Fight for FMX!

If you know me or if you read my blog, you probably know, that I stand 100% behind FMX.
Well and I'm "into FMX" since XE2, but let's say with XE6 or better XE8 it was really useable for every kind of development, desktop, and mobile.

For many years I felt a little bit lonely in this field of development, but since XE10 the club of FMXer is growing faster and faster.

Finally one of the VCL Component developers is using the FMX road, too!

So please clap your hands and welcome DevExpress to the club.

Fun fact: The blogpost about the new DevExpress FMX Grid CTP is posted at/from the VCL Team with - still the VCL logo.

They also promise to include "every single VCL product" in their FMX offering... I think this is a term for: "We will provide an FMX Version of all our components".

So to all haters who haven't taken FMX seriously and/or my love for it for years, I would like to answer with a quote from the blogpost of DevExpress: 

"If everyone moves to FireMonkey, we’ll be sure to follow."

Have a nice weekend!

PS.: If you want to start with FMX, don't forget to buy my Firemonkey Development Kit.

Saturday, June 13, 2020

CodeRage 2020 - Quickinfo...

Oh boy... Why has it been always so hard to do the easy stuff?

My Idea was - just make to sessions, do some advertising on a sublevel and I'm done...

But for session one, I had to explain so many things and create "some" screen-shots. 
Normally a 45 min. video takes ~12h to create. Sometimes a little more, if I have to develop the examples first.

I'm getting faster on "the creating video task", but this time...

The first 10 minutes cost me 4 days. Perhaps I'm doing something wrong.

And session 2?

My estimates where "double the time" from session one... I did not even start the creation. 

It's time to speed up.

I'm also getting faster for the "two audio tracks" thing. Synchronizing the English and German audio is not a big deal anymore. (OK, it still cost 2,5x the time comparing to a single audio track, but faster than doing the disturbing subtitles)

I hope you will like the two sessions and the work was not in vain or different than you expected from the title.

So don't miss it on the 2nd of July! (English versions of my videos are online while streaming the German Versions).

PS.: Of course if you're are a user of my FDK - all the stuff that is shown in the video doesn't need to interest you, because many more sophisticated routines are included in my framework. Perhaps take a look anyway, perhaps just for fun.

Monday, May 25, 2020

German CodeRage 2020

The German CodeRage will be live on the 2nd of Juli. I will present two sessions.

  1. 09:00 UTC Threads and Queues (11:00 MEST)
    How can I accelerate my application by using Queues and Threads to execute some workloads in the background? My session will show some examples of how to include this kind of asynchronous data processing in your app.
  2. 16:00 UTC SQLite in Threads (18:00 MEST)
    How can I use threads to access an SQLite-Database? Spoiler: you can use the technics from session one.
If you want to see my session live at the CodeRage event, you should register and you can also be part of the Q&A session.

If you prefer to watch the session in the English language, it will be online on my Youtube Channel at the same time!

So stay tuned and please subscribe to my channel perhaps you will find some teaser ;-)!

Monday, May 11, 2020

Delphi 10.4 Sydney - #Delphi104 - #ComingSoon

Hello, my friends!

Yes, I've got permission to blog about the upcoming new version of Delphi 10.4 Sydney!.

First I want to answer the most urgent question for all FMX-Mobile developers:

What about ARC?

It's gone, it's history, I hope I will never see any kind of ARC again!

Next on my list is Metal... No more OpenGL-(ES) on iOS.

It has a nice new feature: You can set your framerate, e.g. fix to 60FPS or only refresh the screen if something has changed. I haven't done any longterm tests with this setting, but I assume that this will expand your battery life.

With both - NO ARC and Metal my iOS app is flying! Not only by numbers, you really feel the new performance. 

The other thing: The new Managed Records - as Marco Cantu has already blogged about it. Please follow the link!

Why are these records so interesting? Well, I have a 34 years old huge app grown from TP to Delphi. In these App, we're using mostly records for everything. At the moment we can only use short-string. 


Imagine a record with an ansi- or unicode-string like:

TFoo = Record
  Name : Ansistring;

Every procedure that want's to use a TFoo instance doing:

Procedure Bar(Var aFoo : TFoo);
  Buff : TFoo;
  Buff := aFoo;
  aFoo.Name := 'Othername';
  aFoo := Buff;

Because you only copy the reference of Name, changing aFoo.Name also changes Buff.Name. So the Buffer is not working at all!

With the new Records you have a copy method, where you can explicitly call Setlength to create a copy of the string.

The first time in history the migration from D2007 to 10.4 will saves a lot of work. We will see - still a long way.

BTW: Now it's a good time to renew your subscription. Please click on the banner below.

Happy coding with this #ComingSoon new Version of  #Delphi104!

Saturday, May 9, 2020

The database on network file problem!

Perhaps you're lucky and you're using a database server for your application. So any user is able to have full access to the server anytime. Or your application will not run on a network and you can easily use a simple file-based database like SQLite.

If not, welcome to the club of developers using no databases or any hacking tricks around the shared access problem.

There are some implementations out there in the wild with different approaches to overcome the problem.

You may ask: Why you don't just install a local database server?

Of course I could install a firebird server or the free MS-SQL Express server, but in these cases the PC must always be switched on, so that he is accessible in the network to play the server role. As always the easy solution is not possible.

Many of my clients have a really simple network using the "Fritzbox" as the router and up to tree PC connected to it. To be able to run our software on any of these PCs, without having to switch on the "Server-PC" each time, there is a NAS connected to the Fritzbox with all the data.

Shared access is handled by the file system. Yes, this is a working solution, no question! But as every application and also the stored data is always growing, there is a point where a real database would solve many problems.

Googleing for SQLite and Network you will find some implementation. uSQLiteServer, SQL4Sockets, SQLite ODBC Driver, or SQLiteDBMS. And you also find an easy protocol for handling these calls (TechFell).

Without going too deep into the research, everybody is using some kind of TCP/IP / Socket handler to restrict the access to the "database".

So why restrict to some cheap interface that can only handle the easy stuff?

Let's collect our needs: We want:
  • locking
  • an easy to use interface
  • threadsafe would be perfect
  • perhaps asynchrony access
  • some kind of remote procedure calls
  • perhaps some kind of caching? 

This should all be possible to write in a reasonable amount of time. The caching could be a challenge, but I would love to see a 64-Bit implementation of this, that is useable from a 32-Bit application, so the always empty 14 GB of spare memory could finally be filled with something useful.

I think I will start with a nice slim socket implementation, using UDP Broadcast to find other clients or "Server". Then connect over TCP, implement a simple low lever protocol for the handshake, ping, and version checking. Perhaps a plugin system that is able to auto-reload new versions from a server.

Yes this is all doable...

Why reinvent the wheel? My answer is as always: Because my wheels are running better. Or at least I think so... 

One big problem is still in my way: Find the time for doing this.

Perhaps you would like to see me live on YouTube trying this? Or my break down, because I have underestimated the problem... In any case, please leave a comment and subscribe to my channel.

I have to travel to a planet with a lower rotation speed!


Tuesday, May 5, 2020

Is a database just a data storage?

In the old days, and remember the main title of my blog: "from old school...", data would be saved in files. For the new kids on the block: A file is a storage on your hard disk, a hard disk was a device with spinning disks inside. A read/write head could store and read bytes to and from it.

So in these days we just write a block of bytes to these files, we used the "BlockWrite" command to do this! Why, because it is and was the fastest way to write a record binary to disk.

And NO, streams are not faster. Because down to the RTL, a Filestream is using the same functions, but need more calls to get there. Maybe you call "BlockRead" and "BlockWrite" the old style, but I don't care.

Before we got hard disks, we hat floppies. You got the best performance out of a floppy if you could provide a buffer to read the whole track in one rotation. If your CPU or your floppy controller was not fast enough, the sectors on the track had to be interlaced, and in this case you needed more than one rotation - too bad.

What was the title of this post?

Oh yes. We stored data, mainly records, in binary files. Sometimes we had an index. The index was a string and a seek-number. We load the index file, found the matching string, and used the seek-number to find the record in the binary file. If we had this index, we called it a database.

What about the performance? Besides the algorithm of indexing, the database should also load the data from disk and uses the same OS-functions to do this. I assume, a "normal" database that is using a file to store the data needs more than one block read, and on the client-side? For a dataset with 100 fields you have to write 100 times: FieldValue := Query.FieldByName('FieldName').AsString. This is so awful slow... With one "BlockRead" I get 10kb in a record with 1000 Fields in a blink of a nano-second. (or less). Just one call!

Perhaps knowing all this I use a database nearly the same way as in the old days. The CRUD-Way. Just do Create, Read, Update, and Delete!

That's why I could migrate all my applications to a REST-Server in minutes.

Yes I've used "Join" once or twice, and also a trigger or stored procedure, but just because somebody told me: "Let this do the database-server, the database server could do this better". In some cases this is absolutely right. Especially if you're dealing with really big datasets or/and your database is on a remote computer. That's for sure! Sending an update to a table with constraints is much easier as doing this with "Blockwrite" no question!

To have a session-based I/O while updating the customer-, the invoice- and the stock table in one call and if anything goes wrong just use rollback and not commit. Oh man that helps a lot.

In a few cases, I only read some fields of a row, but most of the time I need all fields. So, "Select *.." is the call. After I got all the data I need the mentioned field by field assignment.

That why I've programmed my JSONStore Client-Server Databasehandler in my Firemonkey Development Kit. I know the name is bad - you can uses this unit also in your VCL application!
Just select on which fields you want to have database access, all other fields are store in a blob field. Of course, I compressed the JSON before storing it. After loading the data set from the server (over REST) or from a local database you have to read your database fields the normal way and after that just let the RTTI do their JSONToObject thing. Done...

Hey compare this to the old style! A database with some keys and a blob field that could be read and write all the data in just one call to our Record/Class. We are back in the '80s well done!

One thing is different: In these days we have 5GHz, a 64Bit bit CPU, and most of the time 8 cores or more, and not 3 MHz, an 8 bit CPU, one core and only 64KB (not MB, not GB) of RAM.

But we are lucky, because with all that memory, cores, and CPU clock speed we can read our data from the database at the same time/speed as in the '80s...

I love DB's...

Thursday, April 23, 2020

Live event : The Apocalypse Coding Group.

Don't miss Part 7 & 8 of the Apocalypse Coding Group on 25. & 26.04. 14:00 UTC.

Andrea Magni
Craig Chapman
Glenn Dufke
Ian Barker
Jim McKeeth
an me...

Where MVP's are trying to convince the viewers that they are worthy of this title, although it did not look like this in the Live-Stream 1-6 with 4 hours each.
It's fun and you can annoy us in the live chat!

Part-7 : https://youtu.be/eJL_kp92N1Q
Part-8 : https://youtu.be/oh48IoNi9OI

The Live-Stream is on Craig Chapman channel! Please don't forget to subscribe to his and my channel so you don't miss the upcoming events, we are currently planning together!

Legacy Applications

OK - here is the problem:

Old Application started with TP 3, grown to many Mio. LOC.
Full of Moves, Records, and other stuff that is not ready to move from pre Unicode to Unicode.

That means no real RTTI, Generics, FireDac, native HTTP, ITask, and other stuff you love if you are using 10.x. 

With a look at the roadmap ;-) the new records would help, but anyway it's a huge task to get it running with XE.

The first idea was to use a DLL - of course -  this works, but not really, because of no real working share mem and an FMX-DLL has also problems. 

So you have to serialize everything over to and back from the DLL. If you have to serialize everything you could do this also over TCP. 

The multi-user network sharing is working but should have some improvements.

A local Database would also be a good idea and take out the old Enz-ISAM that I've ported to windows a long time ago.

Installing a real DB-Server is not possible. Any options?

I could install a Service on each workstation in the network.

What can a Service do for you?
First of all - no problems with admin rights anymore. Installation of anything else is a piece of cake.
The Service Apps of each workstation could talk over a TCP connection to each other. So without a dedicated Server, the Service-Apps could name one as "The Server" if the workstation is going to do a shutdown, another workstation could be named as "The Server" from now on.
Every running App could ask the local server on - "Hey give me the IP of the Server". No need for configs. instead of 4GB the Server could use all the memory and load DLL for different tasks. 

And the client-side?
The client can use a simple interface for the Service, like OpenDB, LockTable, WriteData, UnlockTable, and CloseDB (CRUD with locking) - Every command must (again) be serialized over TCP. The Server could maintain the locking for each table. Vola - a dedicated SQLite Server, or any other DB. (And of course many more).
Internet-Updates, DBCache, and any other service that is much easier to write in XE than in D2007.

This is the Idea...

Do you want to see me struggling to implement this? Perhaps on a live Youtube-Session?
Or are your more into FMX and MVVM?

Anyway - please subscribe to my YouTube Channel and leave a comment on what you want to see next?

Have a nice separation...

Friday, April 17, 2020

Apocalypse Coding Group Part V


After the little Easter break, we will continue on the weekend (18.04 & 19.04) with our live-coding project of a simple card game. (14:00 UTC)

We are happy that MVP Andrea Magni will be part of the project this time and will surely be able to help us with his experience with his MARS server.

The live event will be hosted by Chapman World again. The whole thing is of course interactive - so if you have any questions, feel free to ask them via the chat.


PS.: Thanks to all subscribers of my Youtube channel. I would like to remind you again that I need feedback on what topics you want to see in the live coding.

Monday, April 13, 2020

CodeRage 2020

Hello, my friends!

The german CodeRage2020 is in preparation. Of Course, I want to be part of it. This time it looks like my session has something to do with threads and queues, how to speed up your application.
This topic was the chosen one from three of my Ideas. The other where:

Easy Database: How to create and work with a database without clicking components on a form


3D in 14 days: Ho to create a 3D engine for simple tasks.

I would like to create the same session also with English audio - so here is my question:

What would be your favorite topic besides my normal sessions on YouTube?

My session is live at 02 Juli 2020 in german on the EMBT Channel and in English on my channel!

Please leave a comment.

Monday, April 6, 2020

Blog Posts in deutscher Sprache.

Ich wurde von Embarcadero Deutschland gebeten auch mal Blogpost auf deutsch zu machen. Da ich normalerweise "hier" alles auf englisch schreibe...

Daher findet Ihr meine deutschen Blogposts ab sofort auf der Embarcadero Seite unter:


Auch nur für Euch deutschen Delphi Entwickler: Mein neustes Video auf meinem YouTube Kanal ist online ist.

Edit: LOL - Ich hatte den Titel geändert, aber der RSS-Feed war schneller...

Tuesday, March 31, 2020

The Apocalypse Coding Group.

I called it weekly roundtable, but Craig hat this nice idea...

So last weekend I woke up and saw, I've been invited to a new skype group called "Apocalypse Coding Group" and there were already more than 99 messages waiting. (I'm 8h behind the US or as we call it UTC+1). 

Members of the group are:

- Craig Chapman
- Glenn Dufke
- Ian Barker
- Jim McKeeth
- Frank Lauter

To keep all the #Stay@Home Developers happy and entertained, Craig would like to build a simple web application cardgame. With a nice TMS-Webcore frontend.

So with this idea in mind, he started a YouTube stream.

If you have 4h (or 8:45h for both parts) spare time and want to see 5 "pro" developers make a fool of themselves: Here is the link for Part I (4:12h) and Part II (4:26h). (so far)

Of course, if any of us had done this project alone and not streamed, everybody could have a finished, working project online, but that is not the point. The idea is to get the people entertained with this kind of interactive show.

With only a few people found the live stream - the announcement was a little bit too short - we are happy to see, that the replay is watched from all over the world. 

To answers some questions:

- The source is also online to the public at GitHub.
- We are doing this not for sale or money, just for your joy.
- There is no Patreon page.

Don't miss the next session - next weekend. We hope that more developers find the time to join the live session so it could be more interactive. 

btw.: The next D.MVVM video is nearly ready and will be uploaded to my channel shortly.

My plan was to upload a new session of my FDK and D.MVVM series every week, but I had some trouble to stay focused on my work in these days.

However, coffee is always gladly accepted, if you like our/my stuff...So stay tuned for upcoming new videos and live streams on Craigs and my channel, please subscribe and don't forget to hit the bell icon to get the notifications.

Sunday, March 15, 2020

Delphi monthly round table!

Meetings and shows are canceled all over. The next Apple presentation will also be online-only.

Let us take this as an opportunity to put a new format in place. Yes, of course, we could do webinars. But this is not so interactive besides the Q&A session at the end.

I would like to try it differently. We could use TeamViewer Meeting or just audio-only. One way to go is with a TeamSpeak Server. I have installed this kind of Server many years ago.

At the moment I'm collecting topic.

I've already talked to Jim about this and perhaps we will join with other MVPs to a monthly round table.

If you are interested please leave a comment and stay tuned for the timetable of events. This will be online in a few days.

[EDIT 16.03.20]
This is open to everyone - It would be nice if some MVP's are also online, perhaps to answer your questions. If YOU can answer a question - you are welcome to answer any question, too!

[EDIT 17.03.20]
I forgot: TeamSpeak-Server is up and running.

IP: ts.delphiprofi.de
Password: EMBT

Thursday, March 12, 2020

ProjectH - Your solution for Project Management.

8 Weeks ago I did a survey about project management software. // Still open

The answers were as expected. "Nothing on the market works for me" was the common answer.

I've googled, I've tested some of "them" and this is my result:

a.) it is too simple and didn't fulfill my needs
b.) it is to complex and overkill for a single person or a small team
c.) perhaps it fits, but it has a monthly fee that is too high - I'm looking for a one-time purchase.
d.) it's only a website

And of course a combination of a-d most of the systems are b,c, and d. Perhaps some big companies would pay the "Enterprise" Solution for $1500 US/month, but that is not my goal.

Should it be open source or paid source... The survey ration was 50/50. 80% are not using any tool at the moment. There are 6 developers at the moment with interest in helping me build this kind of software. But 50% only wants to help if it is an open-source project.

Perhaps an idea would be to try to finance the development over Kickstarter or an equal portal, but I never tried this and I have no clue if it will work. It would be perfect if we had some kind of software, that is able to calculate the costs of development or can show how long it will take to develop this kind of software. ;-)

Let's forget about the costs or the time it will take. I think I could do my development much better with an App that can give me a good selection of items based on some rules. hmm... Here are some examples.

  • I have just one hour until the next skype-meeting. "Hey H, give me a small topic that could be completed in less than one hour"
  • I want to develop a topic today that is needed for more than one project and/or more than one project depending on this (like a PayPal interface). "Hey H, give me the most needed topic for all of my projects"
  • I'm not creative today. The best thing to do is not programming. "Hey H, give me a topic without programming" - "You could write some documentation for the MVVM Framework" - oh crap, I hate writing docs... But whatever.
  • I could get a new assignment developing an app. By predicting the time I get a sum of 240 Points. "Hey H, give me a release date if I add 240 points to my workload while suspending private projects". "You are able to start the new project in 3 weeks and it will be ready in 8 months, not harming any other work-related projects"

I know I'm dreaming... But at the moment EVERYTHING is a guessing game and I'm sure I could work better with some kind of project management tool.

So, I've got a few things I would like to see in this app. It has to be standalone Windows/Mac/Linux Version able to use a REST-Service for data storage and data exchange. A mobile app would also be useful. Perhaps some kind of time-tracking device, like this cube thing you can rotate on your desk. Or just use your phone with the app and some buttons. (Working, on the phone, taking a break)
There have to be points associated with items. Of course some graphs like Gantt or Waterfall. perhaps like in mind maps. Milestones or release/update prediction. An Interface to a bug tracker and perhaps some hooks to git or mercurial. 

I'm still collecting. What do you have in mind, please leave a comment.

Wednesday, March 11, 2020

Development environment and the ASUS support.

I spend "some" money on my PC to get a reasonable speed for my work. I didn't had the time to build my last PC so I ordered it over the Internet. Overclocked 4,5 GHz water cooling Raid 5 disk array for storage and Raid 0 for the boot drive... 32 GB RAM.

Top on the list at this time.

I upgraded my system with a new RAID controller and 4 SSDs in Raid 10. Wow this was an improvement boost. With this upgrade, I've started to work only in a VM. This was the best decision I've ever made. A little later I got the first 1080TI, which was available here in Germany.

I saw some videos about M.2 SSDs and one from Linus tech tips that trigger me. The ASUS Hyper  Card 16x. With four M.2 that has to buy my next upgrade. ~ 10.000 MB/s

I ordered this card, 4x 2TB M.2 and... Total disappointment. Only one M.2 showed up, the other three aren't working. I called the ASUS hotline and they told me: You must have a Z390 Board to get all 4 chips running. 

Since my Rampage IV Extreme-Board and CPU was running fine - I didn't want to buy anything new again, but over time, I finally ordered all upgrade parts.

- ROG Maximus XI Extreme
- i9 - 9900K - 5.0 GHz on all cores.
- 64 GB of G.Skill 3600 DDR4 - 17-19-19-39
- New water pump (last getting old)

Board, CPU, RAM, works perfectly - nevertheless, only 2 M.2 showed up... Next session with the ASUS hotline - no this config does not work. Great.

So I used the 2 - M.2's on the Mainboard as a RAID 0 - works nice. (not hardware raid). The benchmark was ~3000 MB/s read/write.

After 6 months I got an error from time to time, on one M.2. Windows could always reactivate the raid, but this is always a bad sign. This time I ordered another card: "ADWITS Quad-M.2-NVMe-SSD-PCIe-16x-8x-Adapter" it should work with every Mainboard and could provide 6500MB/s. I also ordered 4x New Samsung 970 EVO Plus 2TB. I had to order them from different resellers. Btw. it was a good time to upgrade my 1080ti to a new 2080ti.

Good news: The card works - bad news: not all 4 M.2 have the same size. 2 have 1862,89 GB, 2 have 1863 GB. That's why Windows is unable to bind them in a RAID 5 (or RAID with parity as Windows is calling this). But a RAID 0 works fine and I got 5550 MB/s read-write speed on this huge 7,5TB formatted "disk"... Not bad. VM and Delphi is working fine.

I chose  XMP II for the RAM and enabled the CPU clock-AI. It tuned down the clock a little bit - I have no idea why because it runs stable @ 5 GHz all cores in all my Tests. Since my system is running 24/7 @ 42° C or less - I'm fine with 4,8 GHz.

So far so good - Camtasia is now using the GPU for rendering. So let's do some tutorial videos on the FDK and the new D.MVVM framework.

Monday, February 24, 2020

Live Youtube, Chat, FDK & MVVM...

Since 2017 I have this topic on my todo list:

- Create Youtube Video's

After my FDK was ready for release, I wrote some kind of little documentation and some demos, but everything was a little too "short".

The other Idea was to convince people to buy my Framework. While the first customer was waiting for the version, I had to develop my fancy setup/update/shop installer. And also the local service-desktop-software to handle the versions, upload, download and payment. Too bad, at this time my MVVM-Framework (version 2 or 3) was not as good as my "final" version today.

So much to do, but no time for videos. Last time I uploaded a video to my channel is 6 years ago...

Now as my MVVM-Framework is working,  I'm able to refactor my Service-App. I also had to improve the invoice print. The first time I'm using the PDF stuff from my friends at Gnostice.

While talking to Craig Chapman he asks me why I don't do live streams... Never tried, beside one round table with Jim McKeeth. 

A live session only makes sense to me, if this is announced in advance. If nobody is watching  - especially on my channel with only 35 subscribers (at the moment) - this is no fun. Users must also be able to chat with me... My Chat-Software with WebSockets is not ready at the moment, so I installed a free Website-Chat-Script from tawk.to on my homepage.

Perhaps I'll start with some normal tutorial videos for FMX my FDK and my new MVVM-Framework. Then pre-recorded tutorials with a Q&A session like the webinars.

In any case - please subscribe to my channel and hit the bell icon for notifications. If I'll get enough subscribers, I'll try to do the "live-thing" and we could also have friends like Craig or Olaf joining it.

Wouldn't it be great to have a monthly round table?

Please leave a comment! 

PS.: I have a TeamSpeak-Server running for this kind of round table since 06.10.2011. Only used this once for Delphi-Talks...

Wednesday, February 12, 2020

Delphi 25th birthday.

Once Upon a Time...

A young developer programming every day with this Z-80 book on his knees. Z80-ASM was a third language he'd learned. First was a ELAN on the EUMEL OS and of course Basic. By selling his first Basic program to a local computer dealer ( a Paint like program ) - he was able to buy his first color monitor and a floppy disk drive. His first ASM program was FL-DOS-800 a Disk Operating System to load, read, write erase files on a floppy disk and also a Hex/ASCII Disk Editor. Using only 1000 bytes of memory it fits perfectly below the build-in ROM of the MZ-800 and boots in just 1 second.

Side note: You can see even in the year 1986 he loved three-letter names for applications and F has to be the first letter... ;-)

With the money from his FL-DOS-800 he bought his first double floppy drive (2400,- DM ~ 1100,-USD these days) 

With this double floppy drive, he could run CP/M and also his first version Turbo Pascal on his MZ-800. Greetings to Anders Hejlsberg who licensed his "PolyPascal" compiler core to Borland.

While working on exhibitions for a computer company, he got to know the first two customers. He got his job and had to create his first business application. But MS-DOS and MS-DOS-Computer where the sales point, so he had to convert his app from CP/M to MS-DOS. Not knowing anything about this "new" OS. At that time he met "the other" developer at school, who was able to help with the core methods. So it was a good idea to build a company together...

Guess what... These two are still working together and nearly everything they've owned depends on this application, started with Turbo Pascal for CP/M on a 64 KB - Z80 Computer.

In those days everybody was using MS-DOS 3.0 which was able to handle only 30MB drives so if you could afford a 40MB ( not GB, TB ) hard disk. you had two partitions. First guess - this disk space will be enough forever... LOL. And of course only black/white, green or amber with the Hercules Graphics Card.

The Application was still growing and converted from Turbo-Pascal 1 to 2 to 3. Thanks to Borland, Version 4 could handle overlay units, so no problems with memory anymore. (640KB ~ 350KB free). With one of the next Turbo Pascal Versions we could do some tweaking and could compile to protected mode - giving us full use of 16 MB RAM. (Not GB) 

After some tests with Borland-Pascal for Windows 3.1. "No, thanks" we'll stay on DOS. Delphi and Windows 95 arrived... A complete rewrite to windows was out of scope in those days and a CRT emulation of the DOS-Screen was just a proof of concept, too slow for the real world. However we were able to show this Version to our customers, and our competitors had a heart attack. (First time)

Windows 95 where the break trough and we had some time to rewrite "stuff". Not everything at this time, but enough to show the first Windows version of our software - compiled with Delphi 3.0.

This was the second time our competitors had a heart attack. We were years ahead and also the first company in our market segment with a windows version. Everybody else was still on DOS.

We had many clients at that time, not willing to switch to Windows. So we had to compile our DOS Version from the same code base with Turbo Pascal 7.

We kept our DOS Software for many years and also converted the DOS-parts, which used direct memory access to the screen, to a Delphi Console Application. Still being able to compile to "DOS" and Windows from the same codebase. This continued up to Delphi 2007.

It took some time, but with our Windows Version, we got the market lead. 

At every Borland/Inprise/Codegear show, I ask David-I or Mathias Eißing (and it became a running gag over time) could we please have a compiler for the Compact Framework, because we want to support Pocket PC's like the iPAQ and in a good manner, the answer was always "we're thinking about this". This was our first and last escape to C# (sorry about that) but we are still able to use the data collected on these devices in our main app. This was the third heart attack - because nobody had support for these kinds of devices those days. (please, last customer buy a smartphone)

You may imagine I could not wait to get started with the mobile development on XE2, to support iPhones. (Bad idea to jump on this train so early) - I was able to compile my first Version of this app and with XE3 you also could use it. ;-)

After so many years of development, doing FMX was a steep learning curve and ARC was a pain in my a**. I think every FMX developer could not wait for 10.4 to develop FMX without ARC.

In 2012 we presented the first version of our app to our customers.

As the first and only App in our market, this remains a heart attack for our competitors and a persistent headache.

With XE4 we could also present our app on Android. It took a little bit more time to solve every problem, however since XE6 everything works fine. 

The App has grown (255.000 LOC) and got a new design (same on every platform).

Of course this depends 100% on my Firemonkey-Development-Kit. This time the "F" stands for Firemonkey... - believe it or not...

Our Windows application had grown to many million lines of code. We are still using Delphi 2007, but we had to rewrite the core with our own unicode methods. New stuff is compiled with XEx to a DLL also some FMX-Stuff. So we could still uses our codebase. Over time many methods have been rewritten, but I think - if I just dig deep enough - I will find some lines of code just copied from the CP/M Version...

Since march 2017, I'm an Embarcadero MVP, after many years - just beta-testing delphi! (since 6.0).

Because FMX is kind of "still new" to many developers, I help other companies and developers with code-reviews and consulting. If you need help just give me a call or visit my website (delphiprofi.com / delphiprofi.de).

Yes, Pascal/Delphi has accompanied me through my life. If I hadn't been so lucky to make "some" money with my first Turbo Pascal application, Oh man, I should have learned a real job and worked properly.

This is my Delphi story and I hope I can use Delphi for many more years... Greetings to Embarcadero and of course to the friendly people working there - you are doing a great job. 

PS.: Please fix my QC's... ;-)

Tuesday, February 11, 2020

MVVM ist just a concept.

It looks a little bit like a never-ending story, but it isn't.

Two things I realized after the "Pattern" is working.

1.) The main part of the implementation was the binding and also the hardest.
2.) With the D.MVVM-Framework in place, you have nothing to write a real app.


Yes, the only thing you have is some kind method creating the chain of Model -> ViewModel -> View and also binding the component properties to the ViewModel. Of course, this was the most work, but creating the flow of the app is also a necessary part. So what? Good question.

First of all, you need some really good startup/connect all/composition thing. That's why we call it composition root. This is the point where everything is hooked up together. At this stage, you can use a service locator to do your dependency injections. 

After your Main-Chain is running, how to do the program flow? How to load the next form from the View or the ViewModel? With a Navigation-Service! How can I fire some Button-Clicks? With an Action-Service! How to create a Main-Menü on the Main-View (without creating any dependencies?) With a Menue-Service. Dialog-Service... What else?

There might be some more services needed. But at the moment I'm able to do anything with a combination of these Services - Like a "You are not logged in" so fire up a Login-Dialog before loading the next Form/Frame.

At the Model stage ORM/CRUD Database stuff would be perfect. That's why I write this also as a plugin for my FDK because everything you need to do with the database stuff is already in place.

If you never tried this yourself, the best approach is to try a sample application. At this point I realized - yes all this framework stuff is just to be able to do a proper unit-testing and after two weeks of refactoring - lol - unit-testing is a piece of cake, after I created some Mock-Ups to kill the visual dependency's.

Before you are able to buy this framework, I will refactor some of my other projects - this real-life proof of concept will perhaps bring up some more needs, but every new project will do this, up to a point where I call it ready for shipment. 

At the start, my release date was February - but as always - other things got into my way. So it is ready if it is ready - sorry no prediction at this time. We will see. I hope that refactoring my other projects to the framework would only show up additional needs and not the need of changing the kernel. 

Any questions or ideas? That what I really need to put into the framework, please leave a comment.

Thursday, January 30, 2020

TDD - I hate if I do not follow my own rules.

TDD or Test Driven Development is one approach for creating new software, modules, classes or whatever you need in your application.

The main idea behind this is to write your unit-tests first and then your productive code. Sometimes you need to change your tests because while developing the business stuff, you get new ideas on how you get the results you need. But this's fine.

Every time I do consulting in other companies or in my Delphi talks, I tell everybody: "Do your test first, because your development is much quicker" - "And you feel better" - "If every test is green (OK) you can ship the application".

There were complicated classes in the past for my FDK - it had taken more than twice the time to develop them if I hadn't used TDD. And yes, if you do the tests first, it will save you time. So far, so good. Of course, I don't follow my own rules 100% of the time. Sometimes it feels like - this is so simple; I don't need a test for this... In most cases, this is correct - not good, but correct. 

Nearly every app has a point where you have to do more complicated things and like to do some unit-testing. Maybe not for the first release, but if you or your users find the "first" bug, it would be nice if you could write a test to reproduce the bug. Then fix the bug and confirm your test with the OK from your unit-test.

Here's the problem. While creating the unit-test-project you notice, that you have more dependencies in your application than expected. Just one little test and you need to link 90% of the app. Horrible! If you've done the tests first hand, you probably had used more dependency injection. Changing that later is a real pain.

And then?

Your first look into your source code - OMG - What have I done... Yes, I found the problem, but are there any side-effects? Home much unit-test coverage do you have?

OK, Frank - Next time write your tests first..!

Yes, this is an old app from the time where I do not have an MVVM-Framework, but this is no excuse!

Site note:   Assert(TThread.CurrentThread.ThreadID = MainThreadID); it Is very helpful if you are using threads - and I hope with FMX you do everything you can do in a background thread! - Because you sometimes use a class or anonymous procedure in an event from a thread, you haven't done before.

Saturday, January 18, 2020

I wiped my development brain!

Holiday time... Brain-wash time...

On my last holiday I had no PC / Notebook with me. Just my phone - of course...

But my fear was to forget the necessary parts I want to develop/fix/build in the next month. So I took a notebook (paper) and a pen and wrote down some ideas.

Every day I had some topics to write down... The interesting part was I found many topics - like new functions for my FDK that could be used in many old and coming projects. Same with a function that I need for an actual project could also fit in an app that I will start in the next few months. I just wouldn't have noticed that from memory.

After some days of reading the notebook and adding hints, there was a point where I read for hours but did not add anything. So I put this notebook into my nightstand and I felt that my brain was completely wiped of development thoughts.

At this point the real holiday starts - interesting - I hadn't had this kind of empty brain feeling for many years.

So back home - I really want to keep this feeling... But how. At first, I only read the topics from this notebook that are marked as "todo first". I did not read any development related topics - so far. wow...

I use JIRA for my main applications as a ticket system, but for project coordination I never used any software/website. (As I mentioned in the last blogpost "Time-Shared Development Part II".

I googled very hard to find an app at a reasonable price, but I found NOTHING. So if you are using a nice software for this use case, please leave me a comment or/and please fill out my survey!

I do not want to fill my brain with all the stuff from this notebook - I really want to use a software like: "I have 3 hours, what is the most important part I could develop in the time frame?"  or "Give me a list of methods I need most for most of my actual and upcoming projects, order by the estimated time of development"  or "Are there any classes I have to develop for the next release of my apps".

I'm really short of doing the perhaps most stupid decision - New / FMX App / Save as "Project H"...

I hope I have enough important things to do and in the meantime find a solution for my project management...


Perhaps you are also looking for a solution and many other developers, too... So we could start "Project H" together... Or you like to buy this kind of software for you or your team... Try to convince me to start this project...

There are 3.5 Mio Delphi developer out there - if just 1% would love to have this sourcecode for x €.

That would help... ;-)

Or my first open source project? Please help me with this survey!