Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/12/24 in Posts

  1. Anders Melander

    Why doesn't this work?

    Yes it does. Try again and this time do it exactly like Uwe showed you.
  2. I use Help & Manual. For deployed help file I use their e-reader format which is basically an executable wrapper around the Trident web control that exposes the help html. I also deploy PDFs and web-based help with it. I think it checks all the boxes on your list. Check it out. I think Microsoft really dropped the ball on integrated help. It used to be so easy and straightforward just using CHM.
  3. Hello everyone, While keeping an eye on other mediums I decided that a post here wouldn't hurt either. As the company I currently work for is going through a leadership change - as the title mentions - I am currently looking for new (remote) opportunities home or abroad. I'm aiming for something long-term in the EU-region and while others are not excluded, some agreement will be needed due to time zone differences. The first time I met Pascal was about 29 years ago. As time progressed I upgraded that knowledge to Delphi and it quickly became the go-to solution for repetative tasks at work. Currently on Delphi 12 but I have hands-on experience with 7 and every minor and major release since Seattle. Currently maintaining a big codebase (~1,5M LOC) plus custom components mostly derived from DevExpress. After getting rid of all the memory leaks I alone converted all this to a 64-bit compatible source and - probably due to my affection towards the language - Delphi version updates became my responsibility as well. Right next to Delphi I'm also using C# and have additional knowledge in T-SQL, C, C++, HTML, JS, CSS, Perl, Assembly and PHP. Being a sysadmin for 13 years I welcome windows batch as an old friend with Bash gaining traction lately. I'm not native but English is not an issue. If anyone knows someone looking for a reliable and passionate Delphi dev just forward the posting to me 🙂
  4. 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/
  5. I usually prefix functions like this with "Try", so instead of function GetTheValue(parameters ...): SomeType; it's function TryGetTheValue(parameters ...; out Value: SomeType): Boolean;
  6. Neater and equally fast ... type Conts = (edit, button, check, form, frame, listbox, pgctrl, tabctrl, radiobtn, combobox); Ctest = set of Conts; const Strs : array[Conts] of string = ( 'Edit', 'Button', 'Check', 'Form', 'Frame', 'ListBox', 'PageControl', 'TabControl', 'RadioBtn', 'ComboBox' ); function IsIN(aID: Conts): boolean ; // inline; begin const test : Ctest = [button, form, listbox, tabctrl, combobox]; IsIn := aId in test; end;
  7. Typed consts are not consts unless you type them on the right side of the expression. const NotAConst: Integer = -1; IsAConst = Integer(-1); The record type simply becomes a "scope" for const declarations. Benefit: the consts can be non-uniquely named without polluting your name spaces since you always need to prefix with the type name to access the const. Added bonus - you can have methods in the record declaration that can deal with logical operations related to the constants. type cButton = record const ThisIsFine = mrOK; end; cAnswer = record const ThisIsFine = String('This is fine'); end; cLimit = record const ThisIsFine = Double(3.14); end;
  8. Stefan Glienke

    Micro optimization: IN vs OR vs CASE

    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.
  9. David Heffernan

    Maximum static memory

    Have you considered blogging?
  10. Joseph MItzen

    Delphi compiler need to be opensourced

    1. We get posts here, Reddit, etc. along the lines of "Please help me install Borland Database Engine on Windows 10" all the time. A large number of the Delphi applications being maintained today are being maintained on old versions of Delphi and the companies responsible for them have no desire to spend anything to modernize them. For example, the Melissa and Doug toy company in the United States uses an in-house ERP (Enterprise Resource Planning) program written and still maintained in Delphi 7. 1B. Again, a "skilled developer" can't just look at one million lines of undocumented code (that might be older than they are) and fix it. It could take years for a dedicated open source community to work their way through and document that code. Even then, the only sane options would be to massively refactor and modernize it or, again more likely, simply start over. 1C. Who would be in charge of the code? Would Embarcadero oversee it? If so, they might not approve changes. And they're unlikely to want to give up control, as that would be giving up control of the language. Going back to Firebird, they have a poor history of properly supporting open source code, and Marc Hoffman said that one EMBT employee said during discussions "We own Pascal." Not quite the mindset required to turn over control of their compiler/language to a third party. 1D. If there aren't enough developers interested and able to support FreePascal or NewPascal, where are the developers going to come from to spend years trying to make sense of the old Delphi desktop compilers, a much harder task with a much longer time to payoff? 2. Are you serious? Get-It has about 200 packages after four years, most of which are trials. Torry's Delphi Pages, the oldest collection of Delphi software still around, has a little over 10,000 packages ( a number that's barely moved from 2012), the vast majority of which are from the Delphi 5-7 era and most of the rest being trials of paid software. In the last 30 days it's added 17 files, only one of which is for free software. Now take a look here: http://www.modulecounts.com/ Java has over 274,000 open source libraries at Maven Central, C# has over 148,000 in nuget, Python over 174,000. Java is adding 197 a day, C# 93, Python 122. Per above, Delphi added 1 in 30 days. What libraries is Delphi lacking? Almost anything that doesn't involve grids (Delphi users are obsessed with grids). Serious numeric software (although you can pay $1600 for a bundle of Dew Research's matrix library, sci/stat function library, 3 basic data mining algorithms and Steema's TeeChart). Machine learning libraries. Financial libraries. Let's go smaller - I'm interested in making a media player. Delphi lacks a music file tag manipulation library (that's post-unicode and documented), audio manipulation library, replay gain library, cover art library, etc., all of which I can find on other platforms as open source. I'm working on another pet project now that involves data analysis and machine learning and if successful will require interacting with websites. I'd like to host it on a Linux Virtual Private Server eventually, which means $3500 for Delphi Enterprise. As mentioned above, the Dew Research bundle with source is $1600, bringing us up to $5100. Now let's add in Steema's TeeBi for some basic data manipulation abilities to clean and transform the data, which is $279. Wait, the only plugin it works with out of the box to export to Excel is TMS' FlexCel. So unless we want to find an open source Delphi Excel library and integrate it ourselves, that's another $141USD. Now we're up to $5520. A capable profiler? Smartbear AQTime Pro - another $600. Now we're at $6120. Let's toss in HelpNDoc for documentation for another $280USD. Now we're at $6400 so far. I want some neural networks... Boris Mitov has 1980's-era Kohonen self-organizing feature maps and basic backpropagation for $389 without source or $1369 with source. That's madness; I coded both algorithms circa 1994 for a school project in Turbo Pascal. Let's use FANN instead, which is an open source library that implements some improvements to basic backpropagation and has a fast C core. There's also an open source implementation of the NEAT neural algorithm for Delphi, but not the next-gen HyperNEAT. Oh well. Genetic programming? RiverSoftAVG has a decent library with basic features for $150. So $6550 so far and we haven't looked at logging or databases. We'll need to scrape and parse HTML - DIHtmlParser is $123 with source code but is very low-level. There's a higher-level parser on Github, but the only documentation is in Japanese. There's an "HTML Component Library" available that seems rather nice, but it's bundled with a lot I wouldn't need, raising the price to $350. Come to think of it, once all of this comes together and is working I'm going to need a high-level process to manage all of the various software tasks - downloading data, parsing data, processing data, interacting with the right websites at the right time, not launching a process that depends on another that failed, etc. Sadly, there simply aren't any "pipeline " libraries for Delphi at any price. And this is the point when one does the math and realizes they could take that money and buy a new desktop with a 32 core AMD Threadripper, 64GB memory, high-end graphics card for GPU acceleration, 3 NVMe SSDs in RAID 0 for hyper-fast caching with a few large-capacity hard drives in RAID 5 as backing storage, large curved 4K monitor, etc. and even have some money left over. Seriously. And they can use the Python scientific software stack of NumPy, SciPy, Matplotlib for matrices and graphics, but also use modern "grammar of graphics" (functional composition) libraries like plotnine or altair, something TeeChart doesn't offer. Pandas has had almost a 10 year lead time on TeeBI and is far fuller featured and much better documented. Scikit-learn offers a massive machine learning suite, unlike Dew Research's anemic three methods and no support functions. NeuPy offers a vast amount of neural networks for free, plus one can download and use TensorFlow from Google or PyTorch from Facebook and gain support for modern deep learning frameworks that do things like power self-driving cars. Let's see, there's a HyperNEAT implementation too; and genetic programming libraries like DEAP which can scale across all the machines on a network if you wish, and also the best clustering algorithm, DBSCAN, which I couldn't find for Delphi. There's the well-known scrapy framework, as well as BeautifulSoup for high-level HTML parsing. Pipeline programs? Companies like Spotify have open-sourced tools like luigi and AirBNB has airflow. Both can produce web pages to monitor the performance of your processes and view dependency graphs in real time! And there's Selenium for driving the major web browsers across platforms. And that's the difference between using Delphi and using a modern language with 100,000+ free and open source cross-platform libraries available. I've spent zero on software, gotten much more powerful libraries in many cases, and don't have to spend weeks or months implementing low-level libraries myself and can instead concentrate on the problem I'm trying to solve. That was the original appeal of Delphi - the VCL abstracted away the monotonous low-level Windows API to allow developers to code only the solutions relevant to their specific problem. Nowadays this is a solved problem in the form of open source software and Delphi is no longer the "rapid" application development it originally was. You're going to spend lots of time writing things that other language users can download and install from modern package managers in seconds. Your other alternative is to spend thousands of dollars on lesser libraries maintained by one person who may disappear tomorrow. In a research paper designed to discover what makes programming languages popular, the authors found from surveys that the single most important factor to developers in choosing a language is the amount of libraries available, preferably open source libraries. I've seen one developer put it this way, "Today, isn't not being popular itself a language defect?"
×