Tuesday, November 19, 2024

RAD Studio 12.2 and AI helpers

This is an invitation to the workshop in Ljubljana next week. As the session will be in Slovenian language, so is this invitation ...

Odkar smo se nazadnje srečali, je minilo kar nekaj časa. Medtem je izšla nova različica RAD Studio 12.2. Ta med drugim prinaša novost, ki smo jo vsi čakali - integracijo umetne inteligence.

Pridružite se nam na delavnici, kjer bomo predstavili  novosti v RAD Studiu 12.2.,podporne sisteme ChatGPTGemini, Claude in Ollama ter skušali ugotoviti, ali so že dovolj napredni, da jih lahko Delphi programerji uporabljajo pri svojem delu.

Poigrali se bomo z računalniškimi pomočniki in preizkusili vaše ideje o uporabi teh orodij. 

Vidimo se v sredo, 27. 11., ob 9.30 v prostorih OOZ Vič, Tržaška cesta 207, Ljubljana!

Klikni za prijavo!

Friday, April 05, 2024

Delphi and Python, working happily together

Next Wednesday, 10th, I'll be talking about Delphi and Pyhon in Ljubljana. As usual for Slovenian workshops, the talk will be in Slovenian language so I'll continue this invitation appropriately ...

Python je izjemno priljubljen programski jezik, ki slovi po svoji raznoliki in preprosti uporabi. Skupnost razvijalcev nenehno prispeva k njegovemu razvoju in izboljšanju jezika, kar dodatno krepi njegovo privlačnost za širok nabor uporabnikov. Kot večina večplatformnih sistemov pa ne slovi po podpori za izdelavo uporabniških vmesnikov. 

Tu nastopi Delphi, ki slovi po svoji hitrosti in učinkovitosti in je odličen za razvoj aplikacij za Windows okolje. Zato ni presenetljivo, da okolji ne delujeta kot neposredna konkurenca, pač pa se izredno dobro dopolnjujeta

Največja prednost je združevanje moči obeh jezikov. Delphi ponuja hitrost in zmogljivost, Python pa berljivost in obsežno knjižnico razširitev. S tem lahko razvijalci izkoristite najboljše iz obeh svetov.

Na predavanju si bomo ogledali: 

  • Kako lahko Python in Delphi sodelujeta na dva različna načina, 
  • predstavili bomo orodji DelphiVCL in DelphiFMX, s katerima lahko v Pythonu enostavno ustvarite lep uporabniški vmesnik 
  • ter nekaj orodij (Python4Delphi, PythonEnvironments, Lightweight Python Wrappers), ki omogočajo, da kodo, napisano v Pythonu, vgradite v svoj Delphi program. 

Spotoma si bomo na kratko ogledali še novosti v novem Delphi 12.1!

Kliknite za prijavo!

Saturday, December 02, 2023

Learn all about RAD Studio 12 in Ljubljana

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 ...

Friday, July 21, 2023

CQLBr for Delph/Lazarus

It is so nice when you see how a small idea grows into a nice, rounded project!

Years age I wrote a unit that allowed you to write SQL statements as Pascal code (GpSQLBuilder). This has allowed me to write a code like this:

  query := CreateGpSQLBuilder;
query
.Select.All
.From(DB_TEST)
.OrderBy(
query.&Case
.When([COL_2, '< 0']).&Then(COL_3)
.&Else(COL_4)
.&End
);

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 ...

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. 

Sunday, July 09, 2023

Delphi High Performance, Second Edition

The second edition of my book Delphi High Performance is now released! Get all 452 pages of Delphi goodness with two new chapters and all the updated and improved content at Amazon or at Packt Publishing!


Delphi High Performance, Second Edition


Wednesday, June 21, 2023

Delphi High Performance, encore!

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 do pair-programming 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.

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.

Update: The book is now available on Amazon and Packt Publishing.

Tuesday, May 16, 2023

International Pascal Congress in Salamanca

Dear fellow readers, I'd like to invite you to International Pascal Congress which will happen from 3rd to 7th July this year in beautiful Salamanca, Spain.

(Not sure you want to go to Salamanca? Think again.)

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.

The program is split between talks (Monday) and many advanced programming courses (Tuesday--Friday) with plenty of time for socializing or for exploring beautiful Spanish country.

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 nominations.

I hope to see you there as this is a perfect occasion to forget all the Covid craziness and get together again!

Friday, November 25, 2022

"Design Patterns", rescheduled

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.

Sunday, October 16, 2022

"Design Patterns" workshop in Ljubljana

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.

Tuesday, May 17, 2022

We'll meet again (finally)!

After two long-distance years we are finally moving back to normality, starting with a Slovenian RAD Studio meeting next Wednesday in Ljubljana.


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.

Pridružite se nam 25. maja ob 9h! (klikni za več podatkov in prijavo)


Thursday, October 14, 2021

Slovenian Delphi 11 Webinar

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. 


Register here

Wednesday, February 10, 2021

Readers-writer lock - Part 4: Improving TLightweightMREW

While the TLightweightMREW is quite handy, it is not perfect. There's a weird assymmetry in it. On all operating systems that Delphi can compile for, read locks are reentrant (recursive) while write locks are not. In other words, if a thread already owns a read lock, it can call BeginRead again and it will succeed. Write locks are different. If a thread already owns a write lock and calls BeginWrite again, it will either deadlock (on Windows) or raise an exception (on other supported platforms).

This is, however, relatively simple to fix. I have implemented a simple wrapper for the TLightweightMREW lock in TLightweightMREWEx. This new record uses internal TLightweightMREW to provide locking and adds some simple logic to implement write lock reentrancy. The implementation and accompanying test program rwReentrantWriter can be found at https://github.com/gabr42/examples/tree/master/Reader-writer%20lock.

Monday, February 08, 2021

Readers-writer lock - Part 3: Some numbers

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.

All code from this article is available in project rwLock at  https://github.com/gabr42/examples/tree/master/Reader-writer%20lock

Tuesday, December 08, 2020

Readers-writer lock - Part 2: Implementation

In the previous installment I introduced the idea of a readers-writer lock. Today I'll look into readers-writer lock implementations (yes, multiple) that are available in the Delphi run-time library.

Sunday, November 08, 2020

Readers-writer lock - Part 1: Why?

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. 

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 ...

In multithreaded programming (as most of my horror stories start), we frequently run into a problem of resource sharing. 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.

To fix this, we add resource protection. 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.

Saturday, May 30, 2020

OmniThreadLibrary 3.07.8

New OmniThreadLibrary is out! Get it while it’s hot!

Version 3.07.8 is mostly a bugfix release. It fixes few small bugs and enables support for Delphi 10.4.

You can get it now on git, download the ZIP archive, install it with Delphinus or with GetIt (in few days).

For more information, visit OmniThreadLibrary home page or write your question on the forum.

Wednesday, May 27, 2020

Top three Delphi 10.4 features

Delphi 10.4 has just been released (turn here 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:

Friday, February 14, 2020

Long live Delphi!

Something great has happened on this day, 25 years ago.

It was the sign of Aquarius. People were listening to Creep. And the AppBuilder was released.

You don’t know AppBuilder? Sure you do! It was developed andthanks to Novell — released under codename Delphi.

Indeed, our beloved Delphi is 25 years old today! A quarter of a century!

Friday, November 29, 2019

Sales! Sales! Sales!

Parallel Programming with OmniThreadLibrary

e-book: 50% off

printed book: 25% off (use coupon BLACKFRIDAY25)


Delphi High Performance

e-book: 72% off


Hands-on Design Patterns with Delphi

e-book: 80% off

Friday, November 08, 2019

ITDevCon X

The ITDevCon X - the tenth edition! - has just ended and boy was it a blast! (As usual, I should say.)

This was my seventh ITDevCon conference and I always like to visit it. This year was no exception.

Thank you Daniele, Valentina, Fabrizio, and all bit Time gals and guys for organizing two days of great fun and great food!

P.S. My slides & code are already available online.

Monday, September 30, 2019

CompareValue for booleans

CompareValue function is incredibly practical when you are writing comparers (functions that determine how some data structure is ordered). System.Math and System.StrUtils define a bunch of functions that can be used to compare integers, doubles, strings … There’s, however, no CompareValue for booleans.

A CompareValue function compares two parameters, traditionally named left and right, and returns 0 if they are the same, –1 if left is smaller and 1 if right is smaller.

If we use the usual ordering of false < true, we can write the missing function as follows:

function CompareValue(left, right: boolean): integer; overload;
begin
  if left < right then
    Result := -1
  else if left > right then
    Result := 1
  else
    Result := 0;
end;

Your task for today – if you choose to accept it – is: Write this function without any if statements.

Thursday, September 12, 2019

Visit “What’s new in Rio 10.3.2” in Ljubljana

On September 26th 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.

This will also be a good opportunity to see my latest book, Design patterns with Delphi, or get your own copy signed.

Participation is free, but you should register here so we can prepare enough food for everyone.

Tuesday, July 16, 2019

When True is not

Pop quiz! How can the following program …

Writeln(True);
Magic;
Writeln(True);

… output this:?

TRUE
FALSE

Simple!

Tuesday, July 02, 2019

The case of a missing begin/end

Delphi never stops surprising me …
Did you know that this is a valid syntax?
case a of
  0: Writeln(0);
  else
    Writeln('else');
    Writeln(a);
end;
This code indeed compiles and works exactly as the following fragment.
case a of
  0: Writeln(0);
  else begin
    Writeln('else');
    Writeln(a);
  end;
end;
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.

EDIT

Anton Alisov suggested formatting first example as:
case a of
  0: Writeln(0);
else
  Writeln('else');
  Writeln(a);
end;
I guess this makes more sense (but just an itsy bitsy teenie weenie bit more).

Thursday, June 06, 2019

Monday, April 29, 2019

Spring4D European Conference 2019 sessions

Slides and code for the Spring4D conference are now published on the conference page.

Slides and code for my two sessions – Design patterns with Spring4D and Interception and dynamic proxy – are also available on my presentations page.

Saturday, April 27, 2019

FastMM4 large memory allocation–benchmarking VirtualAlloc

Earlier this week a long-time customer asked me why FastMM allocates large memory blocks from the top of the memory and if that option could safely be turned 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.
TL;DR Yes, allocating from the top is slower. No, the difference is not big and in most cases you’ll not even notice it.
There were, however, other interesting results that my simple benchmark pointed out. More on that in a moment, but first…

Thursday, April 18, 2019

Books, books, books

Dear reader,

You probably know that I write books. A big part of making a book, however, is not just writing it, but letting all the potential readers out there know that the book exists. I'm doing a lot there - and so is my publisher - but still we can't reach all the potential readers ourselves.

That's where you come in!

If you have read any of my books and if you loved it and want the others to know, please consider publishing a review on the Amazon site. More reviews make Amazon algorithms treat the book with more respect and they recommend it more to customers.

Leave the review here: Delphi High Performance, Hands-on Design Patterns with Delphi.

You can also just tell your colleagues in any social circle - digital or real-life - that you like the book. Spread the word!

If you think that is too much and you don't want to get involved so deep, it doesn't matter. I still love you.

On the other hand, if you didn't like my book, let me know. I want to improve, so tell me why you don't like it and what I can do to make my next book better. My contact info is here.

Thank you,

Primož

Monday, April 08, 2019

Deep Dive into Design Patterns

Hands-On Design Patterns with Delphi Book CoverWhile writing Design Patterns with Delphi, I spent quite some time researching existing literature on design patterns implementation in Delphi, design patterns in other languages, other types of patterns, design principles and so on …

In case you would like to dig deeper than the book takes you, here is my reading list.

Tuesday, March 26, 2019

Spring conference, spring edition

Hurry up, you only have five (5) days left to get a Spring4D European Conference ticket at the regular price!


Spring 4D Logo


It’s gonna be a blast! Stefan will be there, of course (can you imagine Spring 4D without him in the picture?), and so will be I. There will be a ton of interesting sessions, and lots of time for eye-to-eye discussions. Marco has announced his presence, I’ll be bringing my books (or you can bring your own copy, if you already own it and want it signed), Stefan will be accepting musical requests (not really ;) ) …

You can join us for a day or two. Your call, but I would certainly recommend the latter, because this conference will ROCK!

“Bee there Orr Bee A Rectangular Thyng
- The Band With Rocks In *

Friday, March 08, 2019

Delphi developer needed (Slovenia)

Slovenian company BASS is looking for a Delphi developer (on-site in Celje, Slovenia).

(I’m not affiliated with them; they just asked me to spread a word around. If you have any questions, contact them directly.)