tag:blogger.com,1999:blog-293316752024-03-18T04:04:42.646+01:00The Delphi Geekrandom ramblings on Delphi, programming, Delphi programming, and all the restgabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.comBlogger560125tag:blogger.com,1999:blog-29331675.post-15517066570506336652023-12-02T13:27:00.004+01:002023-12-02T13:27:45.943+01:00Learn all about RAD Studio 12 in Ljubljana<p>Next week I'll present all about the new RAD Studio 12 in Ljubljana. As usual, the presentation will be in Slovenian language and so will be the rest of this post ...</p><span></span><a href="http://www.thedelphigeek.com/2023/12/learn-all-about-rad-studio-12-in.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-74948146533597035332023-07-21T16:20:00.001+02:002023-07-21T16:20:15.591+02:00CQLBr for Delph/Lazarus<p>It is so nice when you see how a small idea grows into a nice, rounded project!</p><p>Years age I wrote a unit that allowed you to write SQL statements as Pascal code (<a href="https://www.thedelphigeek.com/search/label/SQL" target="_blank">GpSQLBuilder</a>). This has allowed me to write a code like this:</p><pre style="background-color: #fefdfa; color: #333333; font-size: 13px; line-height: normal;"><code><span class="pas1-space"><span style="color: white;"><span style="font-size: 12pt;"> </span></span></span><span style="font-size: 12pt;"><span class="pas1-identifier"><span style="color: black;">query</span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-symbol"><span style="color: black;">:=</span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-identifier"><span style="color: black;">CreateGpSQLBuilder;<br> query<br></span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-symbol"><span style="color: black;">.<strong>Select</strong>.<strong>All</strong><br></span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-symbol"><span style="color: black;">.<strong>From</strong>(DB_TEST)<br></span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-symbol"><span style="color: black;">.<strong>OrderBy</strong>(<br></span></span><span class="pas1-space"><span style="color: white;"> <span class="pas1-identifier"><span style="color: black;">query</span></span></span></span><span class="pas1-identifier"><span style="color: black;">.</span><span style="color: black;"><strong>&</strong></span></span><span class="pas1-reservedword"><span style="color: maroon;"><strong><span style="color: black;">Case</span></strong><br></span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-symbol"><span style="color: black;">.<strong>When</strong>([COL_2,</span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-string"><span style="color: green;">'< 0'</span></span><span class="pas1-symbol"><span style="color: black;">]).</span><span style="color: black;"><strong>&</strong></span></span><span class="pas1-reservedword"><strong><span style="color: black;">Then</span></strong></span><span class="pas1-symbol"><span style="color: black;">(COL_3)<br></span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-symbol"><span style="color: black;">.</span><span style="color: black;"><strong>&</strong></span></span><span class="pas1-reservedword"><strong><span style="color: black;">Else</span></strong></span><span class="pas1-symbol"><span style="color: black;">(COL_4)<br></span></span><span class="pas1-space"><span style="color: white;"> </span></span><span class="pas1-symbol"><span style="color: black;">.</span><span style="color: black;"><strong>&</strong></span></span><span class="pas1-reservedword"><strong><span style="color: black;">End</span></strong></span></span><span class="pas1-symbol"><span style="color: black; font-size: 12pt;">);</span></span></code></pre><p>It was a small project with minimum support -- as long as it generated SQL code that I've needed, I was fine with it. Much of the SQL language support was missing, there was no support for different SQL dialects and so on ...</p><p>Luckilly, Isaque Pinheiro liked the idea and converted it into a full-fledged library with support for multiple SQL dialects, much more complete SQL language support, units tests, installer, a ton of samples and more. </p><p><span></span></p><a href="http://www.thedelphigeek.com/2023/07/cqlbr-for-delphlazarus.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com2tag:blogger.com,1999:blog-29331675.post-42884440397708335382023-07-09T17:37:00.003+02:002023-07-09T17:37:46.418+02:00Delphi High Performance, Second Edition<p>The second edition of my book Delphi High Performance is now released! Get all 452 pages of Delphi goodness with <a href="https://www.thedelphigeek.com/2023/06/delphi-high-performance-encore.html">two new chapters</a> and all the updated and improved content at <a href="https://www.amazon.com/Delphi-High-Performance-concurrency-programming/dp/1805125877/ref=sr_1_1?crid=2NEBZZON0BOV&keywords=Delphi+High+Performance.&qid=1688465547&sprefix=delphi+high+performance.%2Caps%2C601&sr=8-1" target="_blank">Amazon </a>or at <a href="https://www.packtpub.com/product/delphi-high-performance-second-edition/9781805125877#_ga=2.159462013.1973383234.1688383849-2071815208.1677230471" target="_blank">Packt Publishing</a>!</p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIEjST3ewXPrYwbMKnj2qFEwTBk4lPDCSr86mBiEPf5ZW2evNsUDSDPVzA7QQErqcAuU8KZNU3f3X7NX_O-bdmw2HbXmmcYcpvAFdhKqpGslLlciQQPdzbMgFWeH7yK4ifp0wY0vV3QGvNDzM3D2V55jmSrPcIH7xrUnLDaT672ZMxwWoea6_EUg/s901/dhp2.png" style="margin-left: 1em; margin-right: 1em;"><img alt="Delphi High Performance, Second Edition" border="0" data-original-height="901" data-original-width="764" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIEjST3ewXPrYwbMKnj2qFEwTBk4lPDCSr86mBiEPf5ZW2evNsUDSDPVzA7QQErqcAuU8KZNU3f3X7NX_O-bdmw2HbXmmcYcpvAFdhKqpGslLlciQQPdzbMgFWeH7yK4ifp0wY0vV3QGvNDzM3D2V55jmSrPcIH7xrUnLDaT672ZMxwWoea6_EUg/w271-h320/dhp2.png" width="271" /></a></div><p></p><br /><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-69249511324911187752023-06-21T19:13:00.007+02:002023-07-09T17:35:57.119+02:00Delphi High Performance, encore!<p>It is so interesting to publish a book for the second time. In a way it is similar to reviewing and fixing old code--you go from "well said, old man!" to a "what the #$%! were you thinking when you wrote that" in a matter of pages. It also helps if you <strike>do pair-programming</strike> have great technical reviewers that help by pointing out the latter and add frequent "this may be obvious to you but I have no idea what you've just said" comments.</p><p>Big thanks go to Bruce McGee and Stefan Glienke for improving this book! It would be worth at least a half "star" less without them.</p><p>Update: The book is now available on <a href="https://www.amazon.com/Delphi-High-Performance-concurrency-programming/dp/1805125877/ref=sr_1_1?crid=2NEBZZON0BOV&keywords=Delphi+High+Performance.&qid=1688465547&sprefix=delphi+high+performance.%2Caps%2C601&sr=8-1" target="_blank">Amazon </a>and <a href="https://www.packtpub.com/product/delphi-high-performance-second-edition/9781805125877#_ga=2.159462013.1973383234.1688383849-2071815208.1677230471" target="_blank">Packt Publishing</a>.</p><span></span><a href="http://www.thedelphigeek.com/2023/06/delphi-high-performance-encore.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com2tag:blogger.com,1999:blog-29331675.post-48526309798810523292023-05-16T16:10:00.004+02:002023-05-16T16:10:43.687+02:00International Pascal Congress in SalamancaDear fellow readers, I'd like to invite you to <a href="https://www.pascalcongress.com/index.html" target="_blank">International Pascal Congress</a> which will happen from 3rd to 7th July this year in beautiful Salamanca, Spain.<div><br /></div><div>(Not sure you want to go to <a href="https://www.pascalcongress.com/location.html" target="_blank">Salamanca</a>? <a href="https://www.iberian-escapes.com/salamanca.html" target="_blank">Think again.</a>)</div><div><br /></div><div>Although the congress has wider target audience than pure Delphi, it is sponsored by Embarcadero and many prominent Delphi speakers will participate. Marco Cantu will be there, as will Daniele Teti and Bruno Fierens. I will also add my contribution.</div><div><br /></div><div>The program is split between <a href="https://www.pascalcongress.com/keynote_speakers.html" target="_blank">talks </a>(Monday) and many advanced programming <a href="https://www.pascalcongress.com/courses.html" target="_blank">courses </a>(Tuesday--Friday) with plenty of time for socializing or for exploring beautiful Spanish country.</div><div><br /></div><div>Besides the talks and courses and socializing and a dinner, the IPC will also grant a Niklaus Wirth Award for a Most Valuable Contributor to Pascal. They are still accepting <a href="https://www.pascalcongress.com/awards.html">nominations</a>.</div><div><br /></div><div>I hope to see you there as this is a perfect occasion to forget all the Covid craziness and get together again!</div><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-60284051645525446422022-11-25T09:48:00.002+01:002022-11-25T09:48:54.313+01:00"Design Patterns", rescheduled<p>For the last Delphi meeting in Slovenia this year we have organized a small workshop about Design Patterns. As usual, it is intended for Slovenian programmers and will be given in the Slovenian language.</p><span></span><a href="http://www.thedelphigeek.com/2022/11/design-patterns-rescheduled.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-57769912846137736152022-10-16T17:15:00.002+02:002022-10-18T09:54:39.613+02:00"Design Patterns" workshop in Ljubljana<p><strike>For the last Delphi meeting in Slovenia this year we have organized a small workshop about Design Patterns. As usual, it is intended for Slovenian programmers and will be given in the Slovenian language.</strike></p><span></span><a href="http://www.thedelphigeek.com/2022/10/design-patterns-workshop-in-ljubljana.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-40615401264635577782022-05-17T12:19:00.003+02:002022-05-17T12:19:23.145+02:00We'll meet again (finally)!<p>After two long-distance years we are finally moving back to normality, starting with a Slovenian RAD Studio meeting next Wednesday in Ljubljana.</p><hr /><p>Po dveh letih virtualnih konferenc vas končno spet vabimo na srečanje v živo! Za izgovor za druženje si bomo ogledali novosti v RAD Studiih iz zadnjih dveh let (10.4, 10.4.1, 10.4.2, 11, 11.1), predvsem pa bomo dogodek izkoristili za klepet ob hrani in pijači in ponovno spoznavanje.</p><p><a href="https://www.integralis.si/novice/po-dveh-letih-za-zasloni-emabarcadero-srecanje-koncno-spet-v-zivo">Pridružite se nam 25. maja ob 9h! (klikni za več podatkov in prijavo)</a></p><p><br /></p><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com1tag:blogger.com,1999:blog-29331675.post-88535028396390208102021-10-14T15:58:00.002+02:002021-10-14T15:58:33.025+02:00Slovenian Delphi 11 Webinar<p>Just a short notice for Slovenian readers - In case you missed it, next week you'll be able to join a Slovenian webinar about Delphi 11. </p><p><br /></p><p><a href="https://mailchi.mp/62d16c4907eb/embarcadero-webinar-delphi">Register here</a></p><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-79971771171590570422021-02-10T22:02:00.002+01:002021-02-10T22:03:09.891+01:00Readers-writer lock - Part 4: Improving TLightweightMREW<p style="text-align: left;">While the <i>TLightweightMREW</i> is quite handy, it is not perfect. There's a weird assymmetry in it. On all operating systems that Delphi can compile for, <i>read</i> locks are reentrant (recursive) while <i>write</i> locks are not. In other words, if a thread already owns a read lock, it can call <i>BeginRead</i> again and it will succeed. Write locks are different. If a thread already owns a write lock and calls <i>BeginWrite</i> again, it will either deadlock (on Windows) or raise an exception (on other supported platforms).</p><p style="text-align: left;">This is, however, relatively simple to fix. I have implemented a simple wrapper for the <i>TLightweightMREW </i>lock in <i>TLightweightMREWEx</i>. This new record uses internal <i>TLightweightMREW</i> to provide locking and adds some simple logic to implement write lock reentrancy. The implementation and accompanying test program <i>rwReentrantWriter</i> can be found at <a href="https://github.com/gabr42/examples/tree/master/Reader-writer%20lock">https://github.com/gabr42/examples/tree/master/Reader-writer%20lock</a>.</p><span></span><a href="http://www.thedelphigeek.com/2021/02/readers-writ-47358-48721-45511-46172.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com13tag:blogger.com,1999:blog-29331675.post-47979116137543982242021-02-08T17:12:00.002+01:002021-02-08T17:15:23.472+01:00Readers-writer lock - Part 3: Some numbers<p>In order to convince you that a readers-writer lock is not a stupid idea, I should finally show some numbers. In this article I'll present a minimalistic (but still real-life) example which allows us to compare different locking solutions.</p><p>All code from this article is available in project <i>rwLock </i>at <a href="https://github.com/gabr42/examples/tree/master/Reader-writer%20lock">https://github.com/gabr42/examples/tree/master/Reader-writer%20lock</a></p><span></span><a href="http://www.thedelphigeek.com/2021/02/readers-writer-lock-part-3-some-numbers.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com1tag:blogger.com,1999:blog-29331675.post-75003257052648593502020-12-08T22:12:00.004+01:002020-12-08T22:13:24.531+01:00 Readers-writer lock - Part 2: Implementation<p>In the <a href="https://www.thedelphigeek.com/2020/11/readers-writer-lock-part-1-why.html" target="_blank">previous installment</a> I introduced the idea of a <i>readers-writer lock</i>. Today I'll look into readers-writer lock implementations (yes, multiple) that are available in the Delphi run-time library.</p><span></span><a href="http://www.thedelphigeek.com/2020/12/readers-writer-lock-part-2-impleme.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-33204089079836604542020-11-08T18:54:00.002+01:002020-11-08T18:54:12.591+01:00Readers-writer lock - Part 1: Why?<p>One of the pleasant surprises in Delphi 10.4.1 was the addition of a new readers-writer lock implementation TLightweightMREW. While it was probably not noticed by most of the users, I was quite happy to see it implemented. </p><p>So now you are asking yourself - what is this readers-writer lock and why am I so happy to see it in Delphi? Well, I'm glad that you're asking! Let me explain ...</p><p>In multithreaded programming (as most of my horror stories start), we frequently run into a problem of <i>resource sharing</i>. Two threads want to modify a shared resource at the same time and that can cause many problems, from information being overwritten to corrupted data and program crashes.</p><p>To fix this, we add <i>resource protection</i>. Usually that is just a critical section (typically through a TCriticalSection wrapper), or Delphi's TMonitor. Sometimes, however, protecting resources with a simple critical section causes an unnecessary performance drop, and that's when a readers-writer lock (may) come into play.</p><span></span><a href="http://www.thedelphigeek.com/2020/11/readers-writer-lock-part-1-why.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com20tag:blogger.com,1999:blog-29331675.post-87879697794088452412020-05-30T19:45:00.008+02:002020-05-30T19:51:02.956+02:00OmniThreadLibrary 3.07.8New <a href="https://draft.blogger.com/#">OmniThreadLibrary</a> is out! Get it while it’s hot!<br><br>Version 3.07.8 is mostly a bugfix release. It fixes few small bugs and enables support for Delphi 10.4.<br><br>You can get it now on <a href="https://github.com/gabr42/OmniThreadLibrary/tree/release-3.07.8">git</a>, download the <a href="https://drive.google.com/file/d/1Y0E1AOk8VfCvtdJa1nbhkfg2rv0BFu77">ZIP archive</a>, install it with <a href="https://github.com/Memnarch/Delphinus/wiki/Installing-Delphinus">Delphinus</a> or with GetIt (in few days).<br><br>For more information, visit OmniThreadLibrary <a href="http://www.omnithreadlibrary.com/">home page</a> or write your question on the <a href="https://en.delphipraxis.net/forum/32-omnithreadlibrary/">forum</a>.<span></span><a href="http://www.thedelphigeek.com/2020/05/omnithreadlibrary-3078.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com2tag:blogger.com,1999:blog-29331675.post-61015879369138167332020-05-27T09:24:00.001+02:002020-05-28T09:32:35.107+02:00Top three Delphi 10.4 featuresDelphi 10.4 has just been released (turn <a href="https://community.idera.com/developer-tools/b/blog/posts/rad-studio-10-4-now-available-learn-more" target="_blank">here</a> for a great overview) and has some nice enhancements even for us, die-hard Windows developers. It is too early to give any deep analysis as I have just installed it and did not do any thorough testing, but I can already pick my top three new features. In no particular order, here they are:<br>
<a href="http://www.thedelphigeek.com/2020/05/top-three-delphi-104-features.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com4tag:blogger.com,1999:blog-29331675.post-86278669637469173722020-02-14T09:25:00.001+01:002020-02-14T11:19:45.306+01:00Long live Delphi!Something great has happened on this day, 25 years ago.<br>
<div>
<br></div>
<div>
It was the sign of Aquarius. People were listening to Creep. And the <pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="AppBuilder" data-pwa-heavy="false" data-pwa-hint="Unknown word: AppBuilder" data-pwa-id="pwa-E4987A3EAE06E2AF4227D5EF15B99610" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="AppsBuilder~upbuilder"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="AppBuilder" data-pwa-heavy="false" data-pwa-hint="Unknown word: AppBuilder" data-pwa-id="pwa-0328CBFCE85F045CC9D4F89AB145B6D3" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="AppsBuilder~upbuilder"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="AppBuilder" data-pwa-heavy="false" data-pwa-hint="Unknown word: AppBuilder" data-pwa-id="pwa-049AADAEF39962E2F8F23B330D115033" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="AppsBuilder~upbuilder">AppBuilder</pwa></pwa></pwa> was released.</div>
<div>
<br></div>
<div>
You don’t know <pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="AppBuilder" data-pwa-heavy="false" data-pwa-hint="Unknown word: AppBuilder" data-pwa-id="pwa-33CCAC53666826C1B147CBEA912D9495" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="AppsBuilder~upbuilder~Upbuilder"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="AppBuilder" data-pwa-heavy="false" data-pwa-hint="Unknown word: AppBuilder" data-pwa-id="pwa-47053CC39CC4E991C9CCB64FFAA30DB1" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="AppsBuilder~upbuilder~Upbuilder"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="AppBuilder" data-pwa-heavy="false" data-pwa-hint="Unknown word: AppBuilder" data-pwa-id="pwa-283951DB07170B9A65D6D426E6058512" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="AppsBuilder~upbuilder~Upbuilder">AppBuilder</pwa></pwa></pwa>? Sure you do! It <pwa class="pwa-mark pwa-mark-done" data-pwa-category="style" data-pwa-dictionary-word="was developed" data-pwa-heavy="false" data-pwa-hint="Passive verbs make your writing less direct. Try to use an active verb instead." data-pwa-id="pwa-B0BB3ACA41E82850E33A04ECA021ACC3" data-pwa-rule-id="PASSIVE_VOICE" data-pwa-suggestions=""><pwa class="pwa-mark pwa-mark-done" data-pwa-category="style" data-pwa-dictionary-word="was developed" data-pwa-heavy="false" data-pwa-hint="Passive verbs make your writing less direct. Try to use an active verb instead." data-pwa-id="pwa-7207A014542ADECB7B65DED5A2F95FB2" data-pwa-rule-id="PASSIVE_VOICE" data-pwa-suggestions=""><pwa class="pwa-mark pwa-mark-done" data-pwa-category="style" data-pwa-dictionary-word="was developed" data-pwa-heavy="false" data-pwa-hint="Passive verbs make your writing less direct. Try to use an active verb instead." data-pwa-id="pwa-C04981C97BA92BCBCED99060E159764F" data-pwa-rule-id="PASSIVE_VOICE" data-pwa-suggestions="">was developed</pwa></pwa></pwa><pwa class="pwa-mark pwa-mark-done" data-pwa-category="grammar" data-pwa-dictionary-word=" and" data-pwa-heavy="false" data-pwa-hint="Missing comma before independent phrase" data-pwa-id="pwa-DCED3E71A93836B156BFCAD3532BF9EB" data-pwa-rule-id="COMMA_CC_DP" data-pwa-suggestions=", and"> and</pwa> — <a href="https://www.theopenforce.com/2020/02/danny-thorpe-why-the-name-delphi.html" target="_blank">thanks to Novell</a> — released under codename <i>Delphi</i>.</div>
<div>
<br></div>
<div>
<pwa class="pwa-mark pwa-mark-done" data-pwa-category="style" data-pwa-dictionary-word="Indeed, our" data-pwa-heavy="false" data-pwa-hint="Readability may be enhanced by using: Our" data-pwa-id="pwa-6894AD2F148CA297B101C3DEDF2038F9" data-pwa-rule-id="READABILITY_191" data-pwa-suggestions="Our"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="style" data-pwa-dictionary-word="Indeed, our" data-pwa-heavy="false" data-pwa-hint="Readability may be enhanced by using: Our" data-pwa-id="pwa-89876BB803E092B7957C5B43E0EAEA35" data-pwa-rule-id="READABILITY_191" data-pwa-suggestions="Our"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="style" data-pwa-dictionary-word="Indeed, our" data-pwa-heavy="false" data-pwa-hint="Readability may be enhanced by using: Our" data-pwa-id="pwa-3F4D7A79BB0493EEAF716E18EE0A252A" data-pwa-rule-id="READABILITY_191" data-pwa-suggestions="Our">Indeed, our</pwa></pwa></pwa> beloved Delphi is 25 years old today! A quarter of a century!</div>
<div>
<br>
</div><a href="http://www.thedelphigeek.com/2020/02/long-live-delphi.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com5tag:blogger.com,1999:blog-29331675.post-23705323742695855672019-11-29T19:24:00.002+01:002019-11-29T19:25:30.593+01:00Sales! Sales! Sales!<h2>
Parallel Programming with OmniThreadLibrary</h2>
<a href="https://leanpub.us3.list-manage.com/track/click?u=d9dae16c3f9f533e6c9e48efb&id=719ca248a5&e=48dc54df65" target="_blank"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="e" data-pwa-heavy="false" data-pwa-hint="Unknown word: e" data-pwa-id="pwa-46D50C672C3390363AA74156BB12413E" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="re~a~ex~be~s"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="e" data-pwa-heavy="false" data-pwa-hint="Unknown word: e" data-pwa-id="pwa-2856D775841BE0CF6CF53CD84B4255E9" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="re~a~ex~be~s">e</pwa></pwa>-book: 50% off</a><br />
<br />
<a href="http://www.lulu.com/shop/primo%C5%BE-gabrijel%C4%8Di%C4%8D/parallel-programming-with-omnithreadlibrary/hardcover/product-24004950.html" target="_blank">printed book: 25% off</a> (use coupon BLACKFRIDAY25)<br />
<br />
<br />
<h2>
Delphi High Performance</h2>
<a href="https://www.packtpub.com/application-development/delphi-high-performance" target="_blank"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="e" data-pwa-heavy="false" data-pwa-hint="Unknown word: e" data-pwa-id="pwa-E6FA0FA0A4519923DA0A715860779F4F" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="re~a~ex~be~s"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="e" data-pwa-heavy="false" data-pwa-hint="Unknown word: e" data-pwa-id="pwa-8B1C6ACBE3C6C0CAABCEAAFC083042E4" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="re~a~ex~be~s">e</pwa></pwa>-book: 72% off</a><br />
<br />
<br />
<h2>
Hands-on Design Patterns with Delphi</h2>
<a href="https://www.packtpub.com/application-development/hands-design-patterns-delphi" target="_blank"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="e" data-pwa-heavy="false" data-pwa-hint="Unknown word: e" data-pwa-id="pwa-0E1A2F93BE1A2305D0297EABBA227862" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="re~a~ex~be~s"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="e" data-pwa-heavy="false" data-pwa-hint="Unknown word: e" data-pwa-id="pwa-049FB7205D968DF2B6042BC6DF5087DB" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="re~a~ex~be~s">e</pwa></pwa>-book: 80% off</a><br />
<br /><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-1149375541011880932019-11-08T18:45:00.001+01:002019-11-08T18:46:03.362+01:00ITDevCon XThe <pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="ITDevCon" data-pwa-heavy="false" data-pwa-hint="Unknown word: ITDevCon" data-pwa-id="pwa-563E1FD26D264D294F03A5A2EC0B8EBE" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="Ordovician"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="ITDevCon" data-pwa-heavy="false" data-pwa-hint="Unknown word: ITDevCon" data-pwa-id="pwa-EE7380B8370602650E757EF1954628BD" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="Ordovician">ITDevCon</pwa></pwa> X - the tenth edition! - has just ended and boy was it a blast! (As usual, I should say.)<br />
<div>
<br /></div>
<div>
This was my seventh <pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="ITDevCon" data-pwa-heavy="false" data-pwa-hint="Unknown word: ITDevCon" data-pwa-id="pwa-D444331158871C32225D8E707F646BE8" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="Ordovician"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="ITDevCon" data-pwa-heavy="false" data-pwa-hint="Unknown word: ITDevCon" data-pwa-id="pwa-EA5C3102F1DE0675301B4591F20E1D92" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="Ordovician">ITDevCon</pwa></pwa> conference and I always like to visit it. This year was no exception.</div>
<div>
<br /></div>
<div>
Thank you Daniele, Valentina, Fabrizio, and all b<pwa class="pwa-mark-done" data-pwa-category="grammar" data-pwa-dictionary-word="bitTime" data-pwa-heavy="false" data-pwa-hint="Unusual capitalization. Have you capitalized the wrong letter in this word?" data-pwa-id="pwa-6196CA23F96649E95EE81361276026D5" data-pwa-rule-id="CAPITALIZATION" data-pwa-suggestions="">it Time</pwa> gals and guys for organizing two days of great fun and great food!</div>
<div>
<br /></div>
<div>
P.S. My slides & code <pwa class="pwa-mark pwa-mark-done" data-pwa-category="grammar" data-pwa-dictionary-word="are" data-pwa-heavy="false" data-pwa-hint="Possible subject-verb agreement error" data-pwa-id="pwa-8813D2F357DD636AF301EC314197A014" data-pwa-rule-id="PRP_CTX:C43" data-pwa-suggestions="is">are</pwa> already available <a href="https://www.thedelphigeek.com/p/presentations.html" target="_blank">online</a>.</div>
<div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com1tag:blogger.com,1999:blog-29331675.post-58882252773968758922019-09-30T20:22:00.001+02:002019-09-30T20:22:57.582+02:00CompareValue for booleans<p><em>CompareValue</em> function is incredibly practical when you are writing comparers (functions that determine how some data structure is ordered). <em>System.Math </em>and <em>System.StrUtils</em> define a bunch of functions that can be used to compare integers, doubles, strings … There’s, however, no <em>CompareValue</em> for booleans.</p><p>A <em>CompareValue</em> function compares two parameters, traditionally named <em>left</em> and <em>right</em>, and returns <em>0</em> if they are the same, –<em>1</em> if <em>left </em>is smaller and <em>1</em> if <em>right</em> is smaller.</p><p>If we use the usual ordering of <em>false < true</em>, we can write the missing function as follows:</p><div style="background: rgb(248, 248, 248); border-width: 0em 0.1em 0em 0.3em; border-style: solid; border-color: gray; padding: 0.2em 0.6em; border-image: none; width: auto; overflow: auto;"><pre style="margin: 0px; line-height: 125%;"><span style="color: rgb(0, 128, 0); font-weight: bold;">function</span> <span style="color: rgb(0, 0, 255);">CompareValue</span>(left<span style="color: rgb(102, 102, 102);">,</span> right<span style="color: rgb(102, 102, 102);">:</span> <span style="color: rgb(176, 0, 64);">boolean</span>)<span style="color: rgb(102, 102, 102);">:</span> <span style="color: rgb(176, 0, 64);">integer</span><span style="color: rgb(102, 102, 102);">;</span> overload<span style="color: rgb(102, 102, 102);">;</span>
<span style="color: rgb(0, 128, 0); font-weight: bold;">begin</span>
<span style="color: rgb(0, 128, 0); font-weight: bold;">if</span> left <span style="color: rgb(102, 102, 102);"><</span> right <span style="color: rgb(0, 128, 0); font-weight: bold;">then</span>
<span style="color: rgb(0, 128, 0);">Result</span> <span style="color: rgb(102, 102, 102);">:=</span> <span style="color: rgb(102, 102, 102);">-1</span>
<span style="color: rgb(0, 128, 0); font-weight: bold;">else</span> <span style="color: rgb(0, 128, 0); font-weight: bold;">if</span> left <span style="color: rgb(102, 102, 102);">></span> right <span style="color: rgb(0, 128, 0); font-weight: bold;">then</span>
<span style="color: rgb(0, 128, 0);">Result</span> <span style="color: rgb(102, 102, 102);">:=</span> <span style="color: rgb(102, 102, 102);">1</span>
<span style="color: rgb(0, 128, 0); font-weight: bold;">else</span>
<span style="color: rgb(0, 128, 0);">Result</span> <span style="color: rgb(102, 102, 102);">:=</span> <span style="color: rgb(102, 102, 102);">0;</span>
<span style="color: rgb(0, 128, 0); font-weight: bold;">end</span><span style="color: rgb(102, 102, 102);">;</span>
</pre></div>
<p>Your task for today – if you choose to accept it – is: Write this function without any <em>if</em> statements.</p>
<a href="http://www.thedelphigeek.com/2019/09/comparevalue-for-booleans.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com10tag:blogger.com,1999:blog-29331675.post-62110091070148778922019-09-12T16:58:00.001+02:002019-09-12T16:58:42.309+02:00Visit “What’s new in Rio 10.3.2” in Ljubljana<p>On September 26<sup>th</sup> I’ll talk about RAD Studio Rio in Ljubljana. We’ll discuss 10.3 a bit and 10.3.1/10.3.2 updates in more detail. We’ll also look into the future to see what 10.4 might bring.</p><p>This will also be a good opportunity to see my <a href="https://www.thedelphigeek.com/2019/02/design-patterns-with-delphi-book.html" target="_blank">latest book</a>, Design patterns with Delphi, or get your own copy signed.</p><p>Participation is free, but you should <a href="https://www.eventbrite.com/e/nadaljujmo-pot-v-rio-vse-novosti-od-predstavitve-rad-studio-103-rio-tickets-72484628475?mc_cid=29f6dceeae&mc_eid=[UNIQID]" target="_blank">register here</a> so we can prepare enough food for everyone.</p><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-77792081352728127452019-07-16T15:35:00.001+02:002019-07-17T13:52:46.676+02:00When True is notPop quiz! How can the following program<pwa class="pwa-mark pwa-mark-done" data-pwa-category="grammar" data-pwa-dictionary-word=" …" data-pwa-hint="The punctuation mark '…' may not require a space before it. Consider removing the space." data-pwa-id="pwa-DDCDBA23545278FB8B4E781DEE8A492D" data-pwa-rule-id="WHITESPACE" data-pwa-suggestions="…"> …</pwa><br>
<!-- HTML generated using hilite.me --><br>
<div style="background: rgb(255 , 255 , 255); border-color: gray; border-style: solid; border-width: 0.05em 0em; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="Writeln" data-pwa-hint="Unknown word: Writeln" data-pwa-id="pwa-77B84F071B10BE8C9A0A08392E13FC14" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="Warton~Written~Ritalin~Ortolan~Weirton">Writeln</pwa><pwa class="pwa-mark pwa-mark-done" data-pwa-category="grammar" data-pwa-dictionary-word="(" data-pwa-hint="The punctuation mark '(' may require a space before it. Consider adding a space." data-pwa-id="pwa-35937B4FA14B02B132FD26BF75C89CBE" data-pwa-rule-id="WHITESPACE" data-pwa-suggestions=" (">(</pwa><span style="color: rgb(0 , 0 , 128); font-weight: bold;">True</span>);
Magic;
<pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="Writeln" data-pwa-hint="Unknown word: Writeln" data-pwa-id="pwa-0ED07ACD197769577E67944900402153" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="Warton~Written~Ritalin~Ortolan~Weirton">Writeln</pwa><pwa class="pwa-mark pwa-mark-done" data-pwa-category="grammar" data-pwa-dictionary-word="(" data-pwa-hint="The punctuation mark '(' may require a space before it. Consider adding a space." data-pwa-id="pwa-1700055B4DFC876F29DC1BBE2F463A86" data-pwa-rule-id="WHITESPACE" data-pwa-suggestions=" (">(</pwa><span style="color: rgb(0 , 0 , 128); font-weight: bold;">True</span>);
</pre>
</div>
<br>
… output this:?<br>
<!-- HTML generated using hilite.me --><br>
<div style="background: rgb(240 , 240 , 240); border-color: gray; border-style: solid; border-width: 0.05em 0em; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="line-height: 125%; margin: 0px;"><span style="color: rgb(0 , 112 , 32); font-weight: bold;">TRUE</span>
<span style="color: rgb(0 , 112 , 32); font-weight: bold;">FALSE</span>
</pre>
</div>
<br>
Simple!<br>
<a href="http://www.thedelphigeek.com/2019/07/when-true-is-not.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com3tag:blogger.com,1999:blog-29331675.post-78398363182871472322019-07-02T19:24:00.001+02:002019-07-03T09:20:28.008+02:00The case of a missing begin/endDelphi never stops surprising me …<br />
Did you know that this is a valid syntax?<br />
<pre style="color: #333333; line-height: 16.25px;"><code><span style="color: navy; font-weight: bold;">case</span> a <span style="color: navy; font-weight: bold;">of</span>
<span style="color: blue;">0</span>: Writeln(<span style="color: blue;">0</span>);
<span style="color: navy; font-weight: bold;">else</span>
Writeln(<span style="color: blue;">'else'</span>);
Writeln(a);
<span style="color: navy; font-weight: bold;">end</span>;</code></pre>
This code indeed compiles and works exactly as the following fragment.<br />
<pre style="color: #333333; line-height: 16.25px;"><code><span style="color: navy; font-weight: bold;">case</span> a <span style="color: navy; font-weight: bold;">of</span>
<span style="color: blue;">0</span>: Writeln(<span style="color: blue;">0</span>);
<span style="color: navy; font-weight: bold;">else</span> <span style="color: navy; font-weight: bold;">begin</span>
Writeln(<span style="color: blue;">'else'</span>);
Writeln(a);
<span style="color: navy; font-weight: bold;">end</span>;
<span style="color: navy; font-weight: bold;">end</span>;</code></pre>
I personally would never drop begin/end inside a case/else statement, but at least someone must disagree. I found such example in a very (VERY!) old code (it was written for Delphi 2) and I was quite surprised that it compiles at all.<br />
<br />
EDIT<br />
<br />
Anton Alisov suggested formatting first example as:<br />
<pre style="color: #333333; line-height: 16.25px;"><code><span class="pas1-symbol"><span style="color: navy; font-weight: bold;">case</span> a <span style="color: navy; font-weight: bold;">of</span>
<span style="color: blue;">0</span>: Writeln(<span style="color: blue;">0</span>);
<span style="color: navy; font-weight: bold;">else</span>
Writeln(<span style="color: blue;">'else'</span>);
Writeln(a);
<span style="color: navy; font-weight: bold;">end</span>;</span></code></pre>
I guess this makes more sense (but just an itsy bitsy teenie weenie bit more).<br />
<br /><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com13tag:blogger.com,1999:blog-29331675.post-46416388343194846502019-06-06T15:47:00.000+02:002019-06-06T15:47:34.522+02:00Delphi Day 2019 sessionsSlides and code for my <a href="http://delphiday.it/" target="_blank">Delphi Day 2019</a> sessions are now <a href="https://www.thedelphigeek.com/p/presentations.html" target="_blank">online</a>.<div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com0tag:blogger.com,1999:blog-29331675.post-32509087053568596252019-04-29T17:41:00.001+02:002019-04-29T17:41:02.164+02:00Spring4D European Conference 2019 sessions<p>Slides and code for the Spring4D conference are now published on the <a href="https://conf.spring4d.com/#csi-schedule" target="_blank">conference page</a>.</p><p>Slides and code for my two sessions – Design patterns with Spring4D and Interception and dynamic proxy – are also available on my <a href="https://www.thedelphigeek.com/p/presentations.html">presentations page</a>.</p><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com1tag:blogger.com,1999:blog-29331675.post-39210660029556918972019-04-27T17:48:00.000+02:002019-04-27T18:13:45.825+02:00FastMM4 large memory allocation–benchmarking VirtualAllocEarlier this week a long-time customer asked me why <pwa class="pwa-mark pwa-mark-done" data-pwa-category="spelling" data-pwa-dictionary-word="FastMM" data-pwa-hint="Unknown word: FastMM" data-pwa-id="pwa-72A85D6C458495A6F54EF2C52393C815" data-pwa-rule-id="SIMPLE_SPELLING" data-pwa-suggestions="stemma~fastigium~stemmy~fistmele">FastMM</pwa> allocates large memory blocks from the top of the memory and if that option could safely <pwa class="pwa-mark pwa-mark-done" data-pwa-category="style" data-pwa-dictionary-word="be turned" data-pwa-hint="Passive verbs make your writing less direct. Try to use an active verb instead." data-pwa-id="pwa-C1D9C76CE1C077A8996A013F9E40B53C" data-pwa-rule-id="null" data-pwa-suggestions="">be turned</pwa> off. Their reasoning was that such allocations are much slower than normal ones. The question surprised me as I didn’t know of any such difference in speed so I did what I usually do–I wrote a benchmark application and measured it.<br>
<blockquote>
TL<pwa class="pwa-mark pwa-mark-done" data-pwa-category="grammar" data-pwa-dictionary-word=";" data-pwa-hint="The punctuation mark ';' may require a space after it. Consider adding the space." data-pwa-id="pwa-626A2B74A8E65962FDE9B5438B1398C9" data-pwa-rule-id="WHITESPACE" data-pwa-suggestions="; ">;</pwa>DR Yes, allocating from the top is slower. No, the difference is not big and in most cases you’ll not even notice it. </blockquote>
There were, however, other interesting results that my simple benchmark pointed out. More on that in a moment, but first…<br>
<a href="http://www.thedelphigeek.com/2019/04/fastmm4-large-memory.html#more">Read more »</a><div class="blogger-post-footer"><font size=-2>--- Published under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license</font></div>gabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.com13