Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/19/22 in all areas

  1. Anders Melander

    Open AI Chat

    and here's the answer to the question, supposedly in the style of Rudy Velthuis (I don't think it quite got it here): or in the style of Donald or freestyling
  2. Attila Kovacs

    Open AI Chat

    Actually the way how AI will kill mankind is not like in terminator or co., but a copy pasted AI code into some nuclear reactor code or similar 😛
  3. When I said similarity of images, I meant similarity of pixels. It can check if the image is identical (similarity = 1) or if it is very close (similarity >= 0.99 for example). We use this because it is normal for some drawings to vary a few pixels from platform to platform or from backend render to backend render. For example, text on Windows is slightly different from text on Android, even though both have the same font loaded. So in the unit tests we set up some tolerable similarity for each type of drawing.
  4. I suspect Marco Cantu's book would be sufficient. As I recall, most of the stuff on that first test is pretty much "core language" and "common objects". The second one gets into the really hairy stuff that's in the Enterprise Edition that nobody uses except in really large complicated projects. I think you'd have to either be a consultant moving through a lot of large and diverse projects, or work for someone who wants you to learn all of that stuff to teach it to others. I've never worked at a place that used ANY of that stuff, let alone ALL of it. Good luck!
  5. Bernard

    Open AI Chat

    I have had a bit of fun with the OpenAI chat bot. It is very impressive. Here is a snippet of what I asked. ME : Can you now produce delphi code that has inline variables to count to 10? Certainly! Here is some Delphi code that uses inline variables to count from 1 to 10: procedure CountToTen; var I: Integer; begin for I := 1 to 10 do begin writeln(I); end; end; begin CountToTen; end. This code defines a procedure called CountToTen that uses a loop to count from 1 to 10. The loop variable I is declared as an inline variable using the var keyword. The loop itself is a for loop, which is a common way to count a fixed number of times in Delphi. The loop prints each value of I to the console using the writeln function. You can run this code by saving it to a file with a .dpr extension and then compiling and running it using the Delphi compiler. The output of the program will be the numbers from 1 to 10, each on a separate line. ME: The Delphi language in 10.3 allows more flexibility in the declaration of local variables. The new inline variable declaration syntax allows you to declare the variable directly in a code block (allowing also multiple symbols as usual). Yes, that is correct. In Delphi 10.3 and later versions, it is possible to use inline variable declarations to declare variables directly within a code block, rather than having to declare them at the beginning of the block using the var keyword. This can make the code more concise and easier to read, as the variable declarations are closer to where the variables are used. Here is an example of using inline variable declarations to count from 1 to 10: procedure CountToTen; begin for var I := 1 to 10 do begin writeln(I); end; end; begin CountToTen; end. In this example, the loop variable I is declared using an inline variable declaration within the for loop. The variable is then used within the loop to print each value of I to the console. Inline variable declarations can be used to declare multiple variables at once, as well. For example: procedure CountToTen; begin for var I := 1, J := 1 to 10 do begin writeln(I, ' ', J); end; end; begin CountToTen; end. In this case, the loop declares two inline variables, I and J, which are both initialized to 1. The loop will run 10 times, and on each iteration, the values of I and J will be printed to the console. I hope this helps! Let me know if you have any questions or need further clarification. Me : In your last example there was an error. you cannot have two variables in a for loop. Your first example was correct. You are correct that it is not possible to use multiple variables in the loop control part of a for loop in Delphi. In my previous response, I included an example that attempts to do this, but it is not valid Delphi code. I apologize for the error in my previous response. Here is the correct version of the example, which only uses a single loop variable: procedure CountToTen; begin for var I := 1 to 10 do begin writeln(I); end; end; begin CountToTen; end. This code will correctly count from 1 to 10 and print each number to the console. Again, I apologize for the mistake in my previous response. Please let me know if you have any further questions. The output is not always correct. But it is fun to play with.
  6. David Heffernan

    TRegEx.IsMatch question

    You didn't specify that the pattern had to exhaust the entire string. Capture the match, look at the match, and see. Use a Web tool to test regex and see the matches. This will help you learn more quickly.
  7. Lajos Juhász

    Delphi beta testing a "premium" privilege?

    No, there is no reason to publish it anymore.
  8. Fr0sT.Brutal

    Get method's name as string from the code inside that method

    Not exactly. They're = published when compiled with typeinfo, otherwise = public
  9. Fr0sT.Brutal

    Zeos on Delphi 11.2

    That's religious question and so discussions are useless. There are pro's and contra's for both options, however I'm the fan of portable self-sufficient apps personally
  10. Poesie? Well, that explains a lot.
  11. DelphiUdIT

    Turn display Off/On

    PostMessage(HWND_BROADCAST , WM_SYSCOMMAND, SC_MONITORPOWER, 2); This should works, it always works in every version of Windows. If it not works, it's possible that you have some drivers, services or others that prevents you from turning it off. Any movements of the mouse and key pressing turn on the monitor. Bye
  12. Cross post from: https://stackoverflow.com/questions/74759895/calculation-of-the-illumination-of-a-point-for-png-image-taking-into-account-tr I don't think your handling of COLOR_PALETTE is correct. AImage.TransparentColor specifies a color that should be considered fully transparent (i.e. alpha = 0). It does not contain the alpha of the RGB channels. For performance, I would do the Alpha/255 once instead of 3 times: alpha := LDstAlpha[AX] / 255; r := Byte(Round(r * alpha)); g := Byte(Round(g * alpha)); b := Byte(Round(b * alpha)); or for much better precision and even better performance: alpha := LDstAlpha[AX]; ... Result := Round(0.3 / 255 * r * alpha + 0.59 / 255 * g * alpha + 0.11 / 255 * b * alpha); Apart from that, I don't see how comparing the YUV luminance of colors would help you determine if the colors are the same. Two (subjectively) different colors can have the exact same luminance. For example, here's a red circle in grayscale: here's a green one: and here's a rainbow-colored one: That only makes sense for fully transparent pixels. For alpha transparency, which is what most PNGs use, alpha premultiplying the RGB makes a little more sense. Not a lot of sense, because there's no "right way" to compare an opaque and a semitransparent color. It's really a question of how one chooses to define equality here.
  13. David Schwartz

    Delphi beta testing a "premium" privilege?

    Back in the 90's I used to love beta-testing stuff. I'd get free licenses for my efforts. Companies gradually stopped doing that. They made beta testing seem like they were doing certain users a favor by giving them an early look at the code. I tried that for a little while and never felt like anybody cared about anything I reported. It seemed like what we got as "beta" code was a copy of what was sent to manufacturing because nothing I found and reported was ever fixed. With Delphi, it got to the point where I not only stopped wasting my time looking at betas, I won't use any of the .0 releases until at least one patch has been issued. The vast majority of projects I've worked on were often at least one release behind, simply because there was usually nothing added from one major release to the next that added any value that exceeded the risk of having stable code get screwed-up. Last place I was at, there was a guy there for 7 years whose main job was rebuilding everything in the latest updates, doing a tiny bit of refactoring, and running tests for months to determine if it was "safe" to upgrade to the latest Delphi Release. Another group worked with C# and they were constantly upgrading, mostly because of improvements in core parts of the language and support environment. It always seemed to get more upgrades in one release as Delphi got in the past dozen. Of course, they had a whole team of guys working on their code, which was only a fraction of the size of our code base, and much buggier. I've applied for the Delphi betas only to be able to read the "What's New" docs. It became increasingly hard to get any of that data as they started tying it to the license level (price) you had purchased. But working for companies with a dozen or two licences (mainly just Pro), we'd get a conference call with one of the techs who'd go through the entire set of slides discussing new features, and they'd bust their humps to get us the early docs, beta code, and loved it when we'd send them feedback. We got the same treatment as when I was an MVP, but we were just regular customers with a bunch of licenses. And as an MVP, I put in dozens of hours of my time and didn't even get a complimentary license for my efforts. I had to pay for it out-of-pocket just like everybody else once the one-year license I was given to use while promoting Delphi for Embt expired. Now their licensing is so aligned with their financial needs that they look more like a car company than a software company. The past few major releases add more and more stuff that's targeted at enterprise needs and continue to ignore core things that have been ignored for a decade now. I don't know why I should keep paying a license fee for something that continues to keep adding stuff I'll never use while core things that newer languages and platforms keep refining and expanding upon.
  14. Yeah, we got it for several years already. 0.9l milk, 900g rice, even 9-egg pack. And finally what I consider the absolute evil - 0.4l beer!
  15. excellent thanks, this is exacly what I was looking for.
  16. Hi, I implemented Sugiyama here: https://github.com/VilleKrumlinde/zgameeditor/blob/master/tools/ZDesigner/3rdparty/SugiyamaLayout.pas It is fully defined in a single unit. I've used it in several projects and it is very fast, robust, and as far as I know bugfree :). Let me know if you need help with using it! You create a subclass and override ExtractNodes and ApplyNodes methods. See this unit for an example (the TMyLayout class).
×