Leaderboard
Popular Content
Showing content with the highest reputation since 11/14/24 in Posts
-
Here are a few recent projects I've created that might be useful to others: CScript: C99 Scripting Engine for Delphi ๐ ฒ๐cript represents a sophisticated ๐ ฒ99 scripting engine meticulously crafted for experienced ๐งโ๐ป Delphi developers. Leveraging the compact yet highly versatile TinyCC compiler, ๐ ฒ๐cript seamlessly integrates โ๏ธ dynamic backend code generation into the Delphi development environment. With ๐ ฒ๐cript, Delphi developers can ๐ ๏ธ compile and execute ๐ ฒ scripts at runtime, directly in ๐พ memory, and generate output in the form of ๐ช Win64 executables (.exe), dynamic-link libraries (.dll), or ๐ object files (.obj). MemoryDLL: In-Memory Win64 DLL Loading & Execution for Pascal. The MemoryDLL unit provides advanced functionality for loading dynamic-link libraries (DLLs) directly from memory in Win64 environments. Unlike traditional methods that involve loading DLLs from the file system, MemoryDLL allows you to load DLLs from byte arrays ๐ or memory streams ๐พ, retrieve function addresses, and unload themโall in-memory. This library is ideal for Delphi/FreePascal developers who need to manage DLLs without relying on the filesystem, enhancing both performance โก and security ๐. PSFML: SFML for Pascal PSFML is a Pascal binding for the โก Simple and Fast Multimedia Library (SFML), providing Pascal developers with a straightforward way to utilize SFMLโs multimedia features directly in their projects. Whether building ๐ฎ games, ๐ค interactive applications, or ๐ฅ multimedia tools, PSFML integrates smoothly with SFML, bringing robust multimedia functionality to the Pascal ecosystem. Enjoy! ๐
-
Strict type checking for tObject.
Stefan Glienke replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
It is pretty simple - imagine if the code below would work that way: procedure ReplacePet(var pet: TPet); begin pet.Free; pet := TCat.Create; end; procedure Main; var dog: TDog; begin ReplacePet(dog); dog.Bark; // meow?! end; FreeAndNil is special because it just destroys and assigns nil. But a var parameter does not give that guarantee. -
shareware Some open sourced tools for Delphi developers
Patrick PREMARTIN posted a topic in I made this
Hi From the contacts I have from time to time following presentations or training courses, it seems that I'm better known for the video game coding part of my hobby than for the other stuff. It's true that I find it more fun (especially to stream on Twitch), but I also have utilities for Delphi developers created to simplify my life that I make available as binaries and source code on my GitHub account. App Stores Screen Captures Generator : to generate all the needed images from your screen captures when you have to publish your softwares on current app stores Copyright Pascal Projects : to add a copyright text in the header of each PAS/DPR files of a folder tree DProj To Windows Setup : to generate the Windows setup from Delphi deployment wizard data. It uses Inno Setup to create the install program and Exe Bulk Signing to sign the exe files. Exe Bulk Signing : a local and network signing program for Windows executables (exe+msix). It has an API you can use to integrate it in your projects like I did with "DProj To Windows Setup". Folder to FMX Image List : to create a FireMonkey TImageList to copy paste in your project or in a data module unit from all images in a folder tree. It fills the multires bitmaps depending on file names. Google Play Developer Banner Generator : to create a picture to use has your Play Store developer banner composed by a random collage of images you add to your project. I use it with icons of my Android apps. HTML Writer : to simply get HTML source code or WYSIWYG HTML content. I use Delphi HTML Components library in this program to have the WYSYWYG HTML editor and a memo for the source code tab item. Pic Mob Generator : my icons generator from basics layers or images, SVG, paths or rectangles. It export JPEG&PNG images, ICO and ICNS files. For the SVG I used RiverSoftAVG SVG Component Library, but next release will use Skia4Delphi. SM Code Generator : I use it in some multi players games, for EXE Bulk Signing API and client projects. The program generates Delphi code you only have to use in your projects to have a client / server solution to exchange formatted messages over IP. The library uses standard TCP sockets from Embarcadero (with no external dependencies). SVG Folder to Delphi Unit : to import SVG files as Pascal strings in your projects. I use it in some games with Skia4Delphi to show icons or sprites. The program generates a unit (compatible with Delphi 12.X and higher) with SVG found in a folder. Some of these programs are available from GetIt. The others will be submitted before the end of the year. The download links are on their GitHub repositories and will be added to their websites (which should be redirected to GitHub in the meantime). If you need changes in these programs or have suggestions, be free to tell here or as issues on their repositories. I'm also looking for ideas of simple tools to develop during live coding streams to show Delphi or web solutions. They are distributed as shareware programs. Contributions and sponsoring are welcome but not obligatory, and there are no program restrictions in the absence of a valid license. All features are available for free. -
What if you wanted an even smaller Lua integration for Delphi? Just using stock Lua 5.4.7+, statically linked directly into your Delphi executable with no external overhead, and automatic registration of native Delphi routines, all in a single unit? Introducing Chandra - Lua Scripting for Delphi. A client needed a tiny, simpler, but capable Lua scripting solution than my recently released PLUA. The Chandra.o file (just Lua compiled into a single translation unit) is linked directly into Delphi via {$L Chandra.o} with ~600kb overhead. It can directly register published Delphi class methods via RTTI. Enjoy, happy coding! ๐ https://github.com/tinyBigGAMES/Chandra
-
A word of advice - in C++, NEVER use the Form's OnCreate and OnDestroy events! (they are perfectly safe to use in Delphi only). The events are based on Delphi's object creation model (derived classes created before base classes), which is different than C++'s creation model (base classes created before derived classes). Also, their behavior has changed a few times over the years (due to internal changes [and bugs] related to handling of the TForm.OldCreateOrder property), so they are not always consistent in C++. As such, the events can be called before the Form's C++ constructor and after its destructor, respectively (I've seen it happen), which leads to undefined behavior in C++. In C++, ALWAYS use the Form's actual constructor/destructor instead.
-
Here are a few more projects: PLUA: Lua for Pascal PLUA is a lightweight and powerful ๐ฆ that integrates LuaJIT scripting into Delphi, enabling you to easily add a scripting layer to your Delphi apps. Whether you're building dynamic software ๐ฅ๏ธ, adding mod support ๐ ๏ธ, or simply looking for a way to make your apps more flexible and customizable, PLUA makes this possible through simple, straightforward APIs. CPas: Static C Libraries for Delphi A collection of hand-picked, high-quality C libraries, compiled into a single translation unit and seamlessly integrated into Delphi. This approach eliminates the need for external DLLs, runtime extraction, or loading them in memory, simplifying the development process and reducing potential compatibility issues, such as antivirus ๐ก๏ธ interference. Mamba Game Toolkit: Advanced 2D Game Library for Delphi. Mamba Game Toolkit (MGT) is a sophisticated yet easy-to-use 2D game development library for Delphi. Tailored to meet the needs of Windows developers, MGT offers a streamlined approach to building 2D games, focusing on simplicity, performance, and reducing external dependencies. With everything linked directly into the executable๏ธ, it eliminates the need for runtime DLLs, simplifying deployment and enhancing the overall stability and reliability of your projects. Enjoy! ๐
-
Hi, thanks! At the moment, I'm only targeting Windows. Mostly because much of that audience is on Windows. I won't rule out other platforms, however. The products that I create are for clients using Windows. The libs are open source so if anyone wishes to port to other platforms, go for it. Note that often, a library may take express advantage of a feature that is limited or unique to the Windows platform, however. In the case of games for example, the last time I looked at the Steam stats, the vast majority of users there are still on Windows. It's no debate that Windows still has the best development tools, and it is still much easier to release on it. But, like I said, I'm not against it per say, just that for me, in the current moment, I have no need or desire to release anywhere else.
-
A clipboard history is a convenient way to see lots of passwords in plaintext. Who wouldn't love that.
-
Yes, things have changed significantly for the better. However, there are still some pain points (more specifically debugging, especially on iOS as Apple keeps throwing curved balls) Main difference is that ARC was being source of significant performance issues on mobile platforms. I have done extensive investigations at the time, and by doing slight modifications in FMX code I was able to significantly improve performance. Used optimizations were covered in my blog posts: https://dalijap.blogspot.com/2018/01/optimizing-arc-with-unsafe-references.html https://dalijap.blogspot.com/2018/01/optimizing-arc-hard-way.html https://dalijap.blogspot.com/2018/03/optimizing-arc-weakness-of-weak.html Even though there is no ARC compiler, above articles are still valid when dealing with interfaces in Delphi. Removing ARC compiler was not the only performance improvement. Next one was introduction of Skia library in Delphi 12, which gives better performance on mobile platforms. It is not perfect and depending on the project it is not necessarily working better on the desktop FMX applications, but it is easily configurable, so different rendering methods can be used depending on the platform. Another pain point was using 3rd party frameworks on both Android and iOS, and this has also been significantly improved in the meantime. Overall, plenty of bugs have been fixed in the meantime (of course, that does not mean there are no new bugs), but things are way better than they were at the early beginnings. Most importantly people are successfully using Delphi for writing Android and iOS applications. You can find one such example here: Whether Delphi is the best option for some project that is another question and it can really depend on the project. The best option would be putting down all the tech your app needs to interact with and what are basic features you need to support. After you have tall that listed you can make a demo app to see whether you can easily incorporate all that you need across various tools and platforms. Only after doing that you will be able to tell which one will be the best for the project. And at the end, the grass is not greener on the other side. For development Delphi is much more stable platform than some others. It does not have some fancy features language wise, but its UI frameworks are very stable. Over the years, both Google and Apple made significant shifts in their native frameworks that required extensive code refactoring (yes, you can still use the old ways, but it still requires a lot of work to keep up with changes). If you are looking for cross-platform tool, then situation is not too much different.
-
Buying a mini pc to install Delphi
Brandon Staggs replied to Alberto Paganini's topic in Tips / Blogs / Tutorials / Videos
No, but because Windows machines cost so much less for substantially the same thing. The fact that I build my own machines is not really the point; I don't believe most Windows machines are dead in 3-5 years, that's ridiculous. Nearly everyone I work with is using Windows machines at least that old. If you prefer MacOS that's certainly fine, nobody can criticize you for that. My personal experience as someone actively doing development for Macs is that it is easily the worst system to target for development and gets worse with every major update. Although it may be a lot of Unix under the hood, Apple is locking it down more and more with every update. Apple behaves as if it owns not only its hardware but their users. The Apple Tax is not just overpaying for hardware, but losing personal computer sovereignty with every update. It's bad enough on Windows, it's many times worse on Mac. -
Signotaur Code Signing Server - Looking for beta testers
Vincent Parrett replied to Vincent Parrett's topic in Delphi Third-Party
Obviously we have to take into account the competition (cloud), the fact that potential customers have already dropped $$$ on certificates, the cost of supporting it and of course we need to make a profit to make this all worthwhile (10 monthss of R&D). USD$199 is our current thinking. -
Double, default value
Vandrovnik replied to Skrim's topic in Algorithms, Data Structures and Class Design
What about a class procedure? type tTest = class(tObject) public class procedure MyFormShow(Sender: TObject); end; ... self.OnShow:=tTest.MyFormShow; -
function: how to return nil
Brandon Staggs replied to jesu's topic in Algorithms, Data Structures and Class Design
You're better off doing something like function myfunc(const InVal: String; out OutVal: Double): Boolean; Return True if the value was set and false if not. There are other ways to handle this but the worst way is a magic value in Double. There's no reason to do that when it is so easy to indicate explicitly whether or not the value is valid. -
How do I create/generate unique ID texts?
FPiette replied to JohnLM's topic in Algorithms, Data Structures and Class Design
Here an example: program Crcr32Demo; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.ZLib; var Buf1 : AnsiString; Buf2 : String; Crc : UInt32; begin Buf1 := 'Hello World!'; Crc := System.ZLib.Crc32(0, PByte(Buf1), Length(Buf1) * Sizeof(Buf1[1])); WriteLn('AnsiString ID=', IntToHex(Crc, 8)); Buf2 := 'Hello World!'; Crc := System.ZLib.Crc32(0, PByte(Buf2), Length(Buf2) * Sizeof(Buf2[1])); WriteLn('UnicodeString ID=', IntToHex(Crc, 8)); ReadLn; end. The output is: AnsiString ID=1C291CA3 UnicodeString ID=E2106423 AnsiString and Unicode string doesn't produce the same result because character code are different (8 bit and 16 bit per character). and CRC32 work at the byte level. -
Signotaur Code Signing Server - Looking for beta testers
JonRobertson replied to Vincent Parrett's topic in Delphi Third-Party
If your customers use an Endpoint Protection and Response product, code signing is critical. The one we use sometimes complains even when the executable is signed with a valid certificate. It is a pain in the rear. But it is essential due to the number and sophistication of cyber threats today. Two-factor or multi-factor authentication is also a pain that I have to put up with daily. I can't do my job without my phone. The Internet is a tremendous resource. But there are days that I miss the simplicity of 8-bit computing. -
Signotaur Code Signing Server - Looking for beta testers
Mark- replied to Vincent Parrett's topic in Delphi Third-Party
Yes our previous cloud solution went to the per transaction model and our cost would have gone up over 1000%. Not going to happen. Yes, #2, the pricing page had no data. Funny, before adding code signing, many years ago, not one customer asked for it or made a comment about it. We have wondered if we removed it, would it have any negative effects. -
Signotaur Code Signing Server - Looking for beta testers
Anders Melander replied to Vincent Parrett's topic in Delphi Third-Party
Well, aren't I the lucky one? I've just been tasked with finding a code signing solution for our build pipeline. So far the realistic candidates are: Use Bob's test-server PC in the closet and do it manually (Bob's not too thrilled). Use the certificate providers cloud solution and pay per transaction (not gonna happen). Some clever tool that seems to be designed just for our needs. So do you have any idea about what the price will be on this thing? -
Problem with Brace Highlight in IDE editor (D11.3 and D12.1)
Ruud replied to Ruud's topic in Delphi IDE and APIs
And I reported it on Embarcadero Quality Portal : Problem with Brace Highlight in IDE editor - RAD Studio Service - Jira Service Management -
Circular references with API design
Uwe Raabe replied to Darian Miller's topic in Algorithms, Data Structures and Class Design
The TRecordA/TRecordB relation leads to a structure of infinite size. I would question the design choice, but having no knowledge of the underlying API that is not more than just a gut feeling. IMHO, you should use the approach that fits best. There is no general rule for all cases. -
I've been experimenting with an integrated playground IDE plugin for the Sempare Template Engine ( https://github.com/sempare/sempare-delphi-template-engine or via GetIt). The template engine is available under Apache 2.0 and has been around for years, and has backward capability back to XE4. The playground plugin is similar to the standalone playground demo app that exists in the project. Anyways, I decided it was time to have a richer IDE experience. My initial development currently it supports: - highlighting (script tags, comments, numbers, strings) - toggling whitespace visibility - IDE Options Dialog allows you to customise options (overriding defaults which are IDE theme aware) - Supports prototyping templates against mock data (in json files) - Supports script tags <% %> or {{ }} - Real-time validation of templates and evaluation/preview - Preview as raw text or in a browser As I changed the license of the template engine to be Apache from GPL, this will be available initially to supporters of the project. More to follow... Any other ideas/improvement suggestions welcome. Here are some screenshots:
-
Circular references with API design
DelphiUdIT replied to Darian Miller's topic in Algorithms, Data Structures and Class Design
I disagree the use of pointers directly for a waste use. In the past I had some side effects not "beauty" ... especially if they were targeting structures with "managed types". In the state of Darian exposition, I will prefer the mix solution. CodGen projects are always "beasts", I wish you good luck in your job @Darian Miller -
function: how to return nil
Roger Cigol replied to jesu's topic in Algorithms, Data Structures and Class Design
Very good suggestion by @dummzeuch Very few people give enough thought to naming of functions and variables. Developing a consistent approach can significantly help with long term program readability / long term support for large projects. Anything that hints at doing that gets my full support ! https://cigolblog.wordpress.com/2023/01/ https://cigolblog.wordpress.com/2019/10/ https://cigolblog.wordpress.com/2017/06/ -
Generic from the RTL for sorted list of objects
Stefan Glienke replied to dummzeuch's topic in RTL and Delphi Object Pascal
No, because the parameterless TObjectList<T> constructor sets OwnsObjects to True. And that is nothing new but also already was the case in the old TObjectList from Contnrs.pas I am glad I can use Spring4D and have several flavors of multimaps at my disposal -
Generic from the RTL for sorted list of objects
aehimself replied to dummzeuch's topic in RTL and Delphi Object Pascal
You always can use a TObjectDictionary<String, TObjectList<TMyClass>>. That way you can have multiple instances of TMyClass assigned to the same string key. -
Micro optimization: IN vs OR vs CASE
Stefan Glienke replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
The point that others already have expressed is that despite being interested in a topic as performance improvement so low level (as in instruction-level instead of algorithmic level) you seem to lack some important knowledge to do so such as assembly - it does not require as much as it does to write assembly code but to understand it in order to be able to look at the code in the debugger and see that some comparisons are apples and bananas. I did not even read through your code but simply placed a breakpoint into your IsIN function and noticed that it contained a function call to System.SetElem (that even was the first time I have ever seen that function being called so a TIL for me). Why was that the case? Because you are not using consts here but variables. Had you simply made consts for all those IDs the code would have almost as fast as the IsOR which does not suffer to extra function calls but from memory reads (not noticeable in the benchmark because its all in L1 cache already). On my CPU InOR is still a little faster than IsIN which is due to the fact how the compiler builds the in - you can see that for yourself in the disassembly and then look at instruction timings, read up on macro-operation fusion and data dependency For reference, this is the assembly for the two functions when using consts Project1.dpr.40: Result := aID in [xControlsRec.ButtonID, xControlsRec.FormID, xControlsRec.ListBoxID, xControlsRec.TabControlID, xControlsRec.ComboBoxID]; 004CEE7C 83E802 sub eax,$02 004CEE7F 7417 jz $004cee98 004CEE81 83E802 sub eax,$02 004CEE84 7412 jz $004cee98 004CEE86 83E802 sub eax,$02 004CEE89 740D jz $004cee98 004CEE8B 83E802 sub eax,$02 004CEE8E 7408 jz $004cee98 004CEE90 83E802 sub eax,$02 004CEE93 7403 jz $004cee98 004CEE95 33C0 xor eax,eax 004CEE97 C3 ret 004CEE98 B001 mov al,$01 Project1.dpr.41: end; 004CEE9A C3 ret 004CEE9B 90 nop Project1.dpr.45: Result := (aID = xControlsRec.ButtonID) or (aID = xControlsRec.FormID) or (aID = xControlsRec.ListBoxID) or (aID = xControlsRec.TabControlID) or (aID = xControlsRec.ComboBoxID); 004CEE9C 83F802 cmp eax,$02 004CEE9F 7417 jz $004ceeb8 004CEEA1 83F804 cmp eax,$04 004CEEA4 7412 jz $004ceeb8 004CEEA6 83F806 cmp eax,$06 004CEEA9 740D jz $004ceeb8 004CEEAB 83F808 cmp eax,$08 004CEEAE 7408 jz $004ceeb8 004CEEB0 83F80A cmp eax,$0a 004CEEB3 7403 jz $004ceeb8 004CEEB5 33C0 xor eax,eax 004CEEB7 C3 ret 004CEEB8 B001 mov al,$01 Project1.dpr.46: end; 004CEEBA C3 ret Depending on the number of IDs you have it might be worth using power of two and bitmasks or an enum directly because that would only require one cmp/test making the function twice as fast and perfect for inlining which would then also eliminate the function call overhead at all.