Jump to content

corneliusdavid

Members
  • Content Count

    569
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by corneliusdavid

  1. corneliusdavid

    Using Deplhi TWebmodule with parameter

    I haven't used either of these in a WebBroker app but I think the asterisk will match any URI; for example, both /getname/list and /getname/edit. I don't remember seeing ":id" on the end of PathInfo in any examples; not sure what that's for.
  2. corneliusdavid

    Using Deplhi TWebmodule with parameter

    The pathname should not contain the asterisk, just /getname You don't have to "create" the parameters, by simply accessing the URL with something like /getname?ssn=123456789&dob=19990531, the TWebActionItem parses out the URI and creates the parameters for you. Then, you just access them in your event handler like this: procedure TMyWebApp.ActionHandler(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); var SSN: string; DOB: string; begin if Request.QueryFields.Count >= 2 then begin SSN := Request.QueryFields.Values['ssn']; DOB := Request.QueryFields.Values['dob']; ... The "?" starts the beginning of the list of parameters; the "&" separates the parameters. On a side note, you should never pass private info this way (using the GET method on the URL); instead you should put them in a POST BODY. But that's a different topic.
  3. corneliusdavid

    Getit Package Manager working?

    Do you have it filtered?
  4. corneliusdavid

    Two CE Versions on same PC

    Good to know!
  5. corneliusdavid

    Two CE Versions on same PC

    While I don't use CE and don't have an official answer for you, I would highly doubt this is possible--don't jeopardize your current installation! The CE FAQ doesn't answer this specific question but the fact that 1) it doesn't allow Delphi & C++Builder (only one or the other) and 2) doesn't allow CE and a paid version on the same machine, I'm almost positive it wouldn't allow two different CE versions to coexist. You could, however, install a virtual machine, and try it out there as it would be a completely separate environment.
  6. corneliusdavid

    Which of the 3 LLMs might be the best to try in 12.2?

    I believe each has a free trial or limited mode; try them out to see what works best for you, then sign up for that one. I posed similar questions to each and thought the response from Claude was the best.
  7. corneliusdavid

    Delphi 12.2 available for download

    Right+Click in the Code Editor and select "Smart CodeInsight" and select "AI Chat".
  8. corneliusdavid

    SQLite with Delphi 7

    It looks like ZeosLib is still active: https://sourceforge.net/projects/zeoslib/ I have no experience with it but recent updates says it supports Delphi 7 through 12.
  9. If you purchased "support" I think you may have purchased the wrong thing. Support is for Embarcadero to help you with programming questions. I think what you wanted is "Update Subscription" or maybe even "Maintenance Update" if that actually updates from an old version (which I didn't think they offer anymore). You'll need to contact your sales rep and explain what you really wanted/need and ask for clarification of what you purchased; if it's not what you thought it was, I hope they'll let you change it to the subscription.
  10. corneliusdavid

    Delphi 12.2 available for download

    I get an error message about FMXLinux not found when I start 12.2. Not actually sure how to disable/reinstall it yet.
  11. corneliusdavid

    Delphi 12.2 available for download

    The feature matrix has been updated.
  12. corneliusdavid

    Delphi 12.2 available for download

    Watch the webinar to find out what's new: https://blogs.embarcadero.com/save-your-seat-whats-coming-in-rad-studio-athens-12-2/
  13. corneliusdavid

    What are you using AI code-gen tools for that's working well?

    You don't need AI for that, you just need GExperts!
  14. corneliusdavid

    SetStyle overloads are not compatible

    I've got a Delphi 12.1 VCL application where, by default, there is no style applied. If the user wants, they can switch to a dark mode at which point, I load a pre-selected .vsf file and all is good. If the user wants to switch back, I simply set the style to 'Windows' and it switches back to the default style. It all still works. Because there will be several programs with this same functionality and option, I don't store the style file in the application but load it dynamically at runtime. And if, down the road, I want to replace the style file with a different one, I can because it's named simply "DarkMode.vsf" even though the internal style name could be "CopperDark" or "Windows10 BlackPearl" for example. With the overloaded TStyleManager.SetStyle procedure that can take either a string (the style name) or a TStyleServicesHandle (returned from LoadFromFile), I figured I could use either one interchangeably; therefore, it's simplest in my code to refer to the loaded file by its handle and not it's name but when changing back to the default style, I simply use the standard 'Windows' string name, leading to these procedures: procedure TMainForm.LoadThemeFiles; begin // save handle to dark style for later FDarkStyleServicesHandle := TStyleManager.LoadFromFile(TPath.Combine(ThemePath, 'DarkMode.vsf')); end; procedure TsMainForm.SetDarkTheme; begin TStyleManager.SetStyle(FDarkStyleServicesHandle); end; procedure TcssMainForm.ClearTheme; begin TStyleManager.SetStyle('Windows'); end; However, I found that once SetDarkTheme has been called followed by ClearTheme, SetDarkTheme will no longer work (as in the case the user switches DarkMode off then tries to turn it back on). I've attached a small program to demonstrate this; I've tried it in both Delphi 11.3 and 12.1. I've submitted a bug report but also have a work-around. Since SetStyle(string-name) works consistently, I've changed the LoadThemeFiles procedure to get and save the name of the style. The TStyleManager has a list of all registered style names, including 'Windows' so if I load one style, TStyleManager should have two style names: procedure TsMainForm.LoadThemeFiles; var StyNames: TArray<string>; begin TStyleManager.LoadFromFile(TPath.Combine(ThemePath, 'DarkMode.vsf')); StyNames := TStyleManager.StyleNames; // reminder not to load any styles into the project if Length(StyNames) > 2 then raise EProgrammerNotFound.Create('Styles should not be defined in the project!'); for var sn in StyNames do begin if not SameText(sn, 'Windows') then begin // save the dark-mode style name FDarkStyleName := sn; Break; end; end; end; After that, the change to SetDarkMode procedure is pretty obvious: procedure TcssMainForm.SetDarkTheme; begin TStyleManager.SetStyle(FDarkStyleName); end; I looked at the VCL source for the two SetStyle procedures and the string version simply looks through the list of registered style names and calls the TStyleServicesHandle version. So why does the first method fail? VclStyleToggle.zip
  15. corneliusdavid

    What are you using AI code-gen tools for that's working well?

    Last December, I blogged about how ChatGPT helped me write a DLL to call a SOAP web service where the header packet was already created (I had always used the wizard-created class and had a brain block). More recently, I've been using Claude to jump-start projects. For example, I needed to write a small WebBroker app but hadn't done that in a while and just needed a quick reminder of the structure. I was about to look up an old project when I decided to ask Claude and it built a simple example. AI isn't doing my work for me but it's increasing my productivity by either reminding me of techniques or helping me get something going quicker. It's sort of like a writer who sits down to type the next novel but just needs a shove of inspiration to get it started.
  16. I suppose this is legal but if you need to create/free a TStringList, why not use a class instead of a record? I always thought of records as a collection of simple types--it never even dawned on me to add a field that required it to be created at runtime.
  17. corneliusdavid

    "Death to WITH" in your Delphi Code

    This is good in that it eliminates scope confusion and is actually 2 lines shorter than using the nested with because there's no need for "end" statements. And, you could combine the first two var lines into one. Now, if refactoring and the debugger would just work well enough with inline vars that this won't cause frustration down the road if you ever need to change or debug it, then this is the perfect answer!
  18. corneliusdavid

    "Death to WITH" in your Delphi Code

    Ah! So you did! I hadn't read down through all the links. That's a pretty comprehensive study of everyone's opinion! Good job!
  19. corneliusdavid

    "Death to WITH" in your Delphi Code

    I agree with this in about 95% of the cases. In fact, I've inherited an old Delphi 7 project that I'm maintaining and upgrading for a customer and it is filled with WITH statements--even nested ones! It's a mess to untangle! A couple of years ago, during the "Delphi Debates" webinar series, I blogged my stance on this: Delphi Debates: With, Goto, & Label--and Exit. I've added a +1 comment to your QP ticket.
  20. corneliusdavid

    AI code generation for Delphi code?

    You might want to check this recent topic:
  21. corneliusdavid

    Delphi 2007 and XE5 Crashes on Windows 11

    Just to add my experience with Windows 11, I have an old laptop that originally came with Windows 10 and I upgraded it to Windows 11 several months back. It has the following versions of Delphi on it, all of which have multiple components and plug-ins installed and which I use to maintain various projects: Delphi 7 Delphi XE Delphi XE2 Delphi 10.1 Berlin Delphi 10.4 Sydney Delphi 11 Alexandria Delphi 12 Athens Make sure your path settings are right, all other apps and libraries are up-to-date (like Java libraries), you're not running out of memory or disk space, and all the other suggestions above.
  22. corneliusdavid

    ifthen strange return value !

    There are two allocations for memory you're dealing with: LObj is a pointer to an object. That pointer takes up space in memory and is allocated in your VAR declaration section as soon as that procedure is called. If it's not specifically initialized with either nil or a pointer to an actual object, the value of that pointer will contain whatever happened to be in that memory location. The second memory allocation happens when the statement LObj := TMyClass.Create; is called. That allocates memory for the object type TMyClass and the pointer to that memory space is stored in the LObj pointer variable. So when you say "LObj is just a variable..." you're right but you might be forgetting what that means: it's a variable at a memory location and in this case, it's a pointer variable that doesn't yet know what it's pointing at. Another way to look at it is if you declared this in your VAR section: var X: Integer X is a variable just like LObj is in that it's allocated when the procedure is called and similarly, if you don't assign X a value, you'll end up with whatever value happens to be in that memory space. Can you imagine testing the value of X without first assigning a number to it?
  23. corneliusdavid

    ifthen strange return value !

    When you compiled, you likely got the following warning: [dcc32 Warning] Main.View.pas(54): W1036 Variable 'LObj' might not have been initialized You should always take special notice to eliminate warnings in your code.
  24. corneliusdavid

    ifthen strange return value !

    Because LObj is not initialized to nil; therefore, it gets whatever happens to be in memory. Assigned() simply checks to see if the pointer is 0; when I ran it in Delphi 12.1, and put a break-point at the label assignment, LObj was -1 ($FFFFFFFF).
  25. corneliusdavid

    WebUI framework: Technical preview. Part 1.

    It looks like this is similar to Elevate Web Builder. I think TMS has a product that does this also. Are you targeting a different or lower-cost market or is there something specific about this I missed that is really unique?
×