Leaderboard
Popular Content
Showing content with the highest reputation on 03/23/23 in Posts
-
Hey guys! I need a little help, I created a ticket. We live in 2023, talking about 64-bit compilers, FMX, and other high-tech stuff, and a string literal can not be longer then 255 chars? for use with resourcestrings, consts. Come on..... Please vote! https://quality.embarcadero.com/browse/RSP-41138
-
try re-assing all files to RAD in "Tool" menus "File Associations" --> uncheck, re-check (if necessary as ADMIN) note: maybe your "versioning tools" hijacked it!
- 2 replies
-
- delphi
- embarcadero
-
(and 1 more)
Tagged with:
-
Are TCompressionStream and TDecompressionStream thread safe?
Dalija Prasnikar replied to c0d3r's topic in Algorithms, Data Structures and Class Design
Generally any kind of stream should be suitable for using in background threads, but also they cannot be simultaneously accessed and shared between threads. Just look at it logically - how can you use stream that holds a state (if nothing else than current position that changes as you read and write) be thread-safe? While you could in theory protect simultaneous access with locks and share stream across threads, you wouldn't gain much from that as stream would have to be locked and accessible to one thread at the time. If you think you could speed some operation by sharing stream and using is in parallel, you will only slow the whole process down, not speed it up. When using TCompressionStream and TDecompressionStream in background thread, OpProgress event handler will run in the context of background thread and you need to take that into account if you want to show progress in the UI and synchronize code. -
Actually I use these quite often. In the case of your SQL, which could as well come from the FireDAC query editor, I just copy the whole code, create a string array constant with a simple template, multi-paste the SQL and format the results: const cArr: TArray<string> = [ // 'SELECT', // 'DATE_FORMAT(co.order_date, ''%Y-%m'') AS order_month,', // 'DATE_FORMAT(co.order_date, ''%Y-%m-%d'') AS order_day,', // 'COUNT(DISTINCT co.order_id) AS num_orders,', // 'COUNT(ol.book_id) AS num_books,', // 'SUM(ol.price) AS total_price,', // 'SUM(COUNT(ol.book_id)) OVER (', // ' ORDER BY DATE_FORMAT(co.order_date, ''%Y-%m-%d'')', // ') AS running_total_num_books', // 'FROM cust_order co', // 'INNER JOIN order_line ol ON co.order_id = ol.order_id', // 'GROUP BY ', // ' DATE_FORMAT(co.order_date, ''%Y-%m''),', // ' DATE_FORMAT(co.order_date, ''%Y-%m-%d'')', // 'ORDER BY co.order_date ASC;', // '']; procedure UseSQL; begin var qry := TFDQuery.Create(nil); try qry.SQL.AddStrings(cArr); // ... finally qry.Free; end; end; The same scheme also works for JSON or XML. Interesting, that you bring up the SQL text, which is neatly split into multiple lines - probably for better readability. Despite allowing string constants with more than 255 characters in one line, it would be more helpful to have string constants over multiple lines preserving linefeeds. Then it wouldn't even matter if the lines are limited to 255 characters each, although I expect this limit being lifted anyway whenever such a feature will be implemented.
-
Really? You've never needed a JSON literal, or an HTML literal, or an XML literal, or some template string literal? Heck, what about SQL queries? SELECT DATE_FORMAT(co.order_date, '%Y-%m') AS order_month, DATE_FORMAT(co.order_date, '%Y-%m-%d') AS order_day, COUNT(DISTINCT co.order_id) AS num_orders, COUNT(ol.book_id) AS num_books, SUM(ol.price) AS total_price, SUM(COUNT(ol.book_id)) OVER ( ORDER BY DATE_FORMAT(co.order_date, '%Y-%m-%d') ) AS running_total_num_books FROM cust_order co INNER JOIN order_line ol ON co.order_id = ol.order_id GROUP BY DATE_FORMAT(co.order_date, '%Y-%m'), DATE_FORMAT(co.order_date, '%Y-%m-%d') ORDER BY co.order_date ASC; This limitation has nothing to do with being readable. It has to do with ancient Turbo Pascal code still in the IDE (ultimate source: Allan Bauer via Mason Wheeler). C++, Java, Python, Swift, Javascript, Ruby, Rust (to name a few) all have long/multi-line string support in one form or another. Clearly it's useful.
-
ok! I never use this!!! = uncheck always! 🙂
-
not only in VCL, but in any other environment... unfortunatelly I lost the beggin in programming ... I would like have learned more about the "root" I would like to be a "cave-man" too! 😪
-
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Brandon Staggs replied to David Schwartz's topic in Databases
I don't see any language bias in this. The outlets I follow have lots of people trying to be rational about this and most of them probably don't know Delphi still exists, LOL. I am impressed by these tools to be sure. But I also know what they are, and I also know that when I ask AI a non-trivial question that I already have expert knowledge about, I am surprised at how bad the answer is. So, I am extremely skeptical when it comes to using it for things I am NOT an expert on. Is that unreasonable? Also, it's a simple fact that these are not any form of intelligence. The mainstream reporting on this issue has been mostly absurd and with far too much cheerleading or doomsaying. This is how these tools work: https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work TL;DR: it's autocomplete. Very complex and impressive autocomplete. When you ask ChatGPT a question, no entity is giving it consideration or thought, no abstract reasoning is occurring, no intuition is being exercised. An algorithm is scraping its database with a "this word should come next" algorithm. A really complex one. Knowing how it works should make anyone skeptical about broadly generalized applications of the technology. I don't think I am being unreasonable at all. -
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Lars Fosdal replied to David Schwartz's topic in Databases
For sure! Who needs an AI to f... things up, when I am perfectly capable of f...ing stuff up myself? 😄 -
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Sherlock replied to David Schwartz's topic in Databases
Oh, I see it, believe me. And I'm looking forward to making more money by fixing stuff this so called AI breaks. Nothing wrong there. -
https://quality.embarcadero.com/browse/RSP-40658 and https://quality.embarcadero.com/browse/RSP-40808 Sound like this issue...and perhaps more.
-
Best way to embed a binary structure so it is linked/compiled in
Remy Lebeau replied to alank2's topic in General Help
Put the raw data into a separate binary file, and then add an .rc script to your project (or use the Resources and Images dialog) to compile the data file as an RCDATA resource in your final executable's resources. Then, in your code, you can use a TResourceStream whenever you want to access the resource data at runtime. See Resource Files Support (just ignore the part about using a Multi-Device project, this works in a VCL project, too). -
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Brandon Staggs replied to David Schwartz's topic in Databases
I don't buy this line of argument at all. ChatGPT will try its best to give you want you say you want, but it will try so hard that it will give you completely useless time-wasting information. If I tell an intern to write a base class for me that uses multiple inheritance in Delphi, I would not expect to be given a unit full of plausible-looking code that cannot compile. I would expect to be told that what I asked for cannot be done in Delphi. ChatGPT fails that basic test. Who has time to check that kind of work product? Sticking with your workplace analogy, wouldn't you fire someone who blithely pretended to fulfil your request like that? I wouldn't put up with it. -
v5.0.0 Added GPU backend render to TSkAnimatedPaintBox in Vcl; #108 Controls Rewritten Canvas, addressing all pending issues and further enhancing performance; #201 #40 FMX Render Improved performance of TSkAnimatedImage in Vcl; Controls Improved anti-aliasing through multi-sampling; FMX Render Improved library reliability through more unit tests; Tests Fixed numerous minor issues and improved the wrapper as well as the C++ code; API Fixed compilation to Android on RAD Studio Rio; #206 API Fixed issues related to transparency and addressed problems with OpenGL in fullscreen mode on Windows #127; FMX Render Fixed deployment for custom build config; #208 Library Fixed custom font in TSkAnimatedImage; #203 Controls Fixed support for Android 5 and Android 6 broken in last version; Library Deprecated SkParticles since Skia stopped maintaining it at Milestone 112; API Minor improvements. Skia version: 107.2.0 Compatibility break We changed very specific APIs, which are unlikely to generate incompatibilities for developers, but a new major was necessary because we faithfully follow the semantic version. Github: github.com/skia4delphi/skia4delphi Website: skia4delphi.org
-
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Lars Fosdal replied to David Schwartz's topic in Databases
The problem is - the more complex a question, the more complex an answer. As long as ChatGPT is mostly right, most of the time - it is high risk that an answer can be a little wrong or a lot wrong. I will not waste time on solutions that might be partially correct or completely wrong, nor will I spend time on researching the problems other people have with shit they got from ChatGPT. When it gets better, we can discuss it again, but I suspect it would be better use of ML to find flaws or room for improvements in our own code. There is learning in the struggle to understand a new topic. Ready made and wrong answers from an "inventive" "AI" are not good for learning. -
TO ChatGPT: In Delphi, is there any kind of an adapter or class that takes a TList<T> and makes it look like a TDataSet?
Lars Fosdal replied to David Schwartz's topic in Databases
ChatGPT is still ShitGPT, IMO. -
I usually keep long texts in resources as RCDATA but extending the limits would be nice...
-
I use this in some kind of "not-human-readable" const definitions,. for example as a central, unique definition of some medium complex SVG pathdata icons. To not confuse anybody I usually put such definitions in a separate unit then, well commented about its purpose. So I see this use case a little more practical, not just pure black-and-white, I think it can make sense in some situations.
-
One last remark, as said, it's this issue not shocking.... I use DevExpress 'dxFormattedLabels' a lot. So in the string there will be extra markup code for setting text to bold and/or italic or change color. So the string can quickly become quite large. If you use a multi language app ( as I have Dutch and English for now), the string can grow beyond it's limitation. Break; never filed a request to EMB before, but I see they changed the status to OPEN and INTERNAL ASSIGNED. So there is a little hope 😉 Have a nice day, to you all. And enjoy D11.3 as much as I do. There are lot's of improvements!!!
-
Voted.
-
I for myself have never spent any time on this limitation, because I never had to (and probably never will) write that long string literals. Not only that the style guide is much stricter, it is just way less readable and thus I would never even think of doing that. In addition I would literally slap such code in the face of the developer presenting it to me. So better don't count me in here.
-
Nice your code... I can not use it! Because of a third party tool. I don't know how many Delphi programmers are here in this world. A few thousand sure, but if we sum all the time spend on this ( for me stupid) limitation lot's of money is thrown away. Is it a show stopper? No. Is it critical? No. Are there workarounds? Yes. The only thing I hope is that EMB changes this old fashion limitation.
-
They are of type String already. The limitation seems to be in the parser which cannot deal with lines longer than 255 characters in the source. But there is an easy workaround, which your third-party tool should use for long string literals: split it into several shorter literals concatenated by '+' plus linebreaks. Much easier to read for you as well if you need to manually correct stuff later.
-
Yes I know you can use the '+' sign. But we have all seen this issue sooner or later. 255 chars is something for Delphi 1 or Delphi 2, not for Delphi 11 in 2023! I have third party tools for my mutli-language app. And if the string is too long everything stucks. The only thing I ask for EMB, why can't they change 'const' or 'resourcestring' from 'shortstring' to string?
-
The compiler accepts this without problems: const CTest = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'+ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ;