Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/18/23 in Posts

  1. Provide ChatGPT with table schema and ask it to generate the Delphi class, along with Create/Read/Update/Delete methods. https://www.ideasawakened.com/post/leveraging-chatgpt-to-generate-a-delphi-class-along-with-crud-code-from-a-table-schema Is there a IDE Expert or stand alone tool that does this sort of codegen?
  2. Ian Branch

    VCL - DevExpress

    Nnnnoooooo!!!!! Yes, Tim is a one man shop, but he poduces excellent products at a great price and excellent support. Let's keep it that way....
  3. Darian Miller

    OAuth2 bearer token example?

    I just did for fun. Here's the result: Can you create an example OAuth2 bearer token example in Delphi using the THTTPClient ? Sure, here is an example of how to use the THTTPClient component in Delphi to authenticate with an OAuth2 bearer token: uses System.Net.HttpClient, System.Net.URLClient, System.NetConsts; function SendRequestWithBearerToken(const AURL: string; const AToken: string): string; var Client: THTTPClient; Request: THTTPRequest; Response: IHTTPResponse; begin Client := THTTPClient.Create; Request := THTTPRequest.Create(TNetEncoding.Base64); try Request.Method := TRESTRequestMethod.rmGET; Request.URL := AURL; Request.Headers.AddValue('Authorization', 'Bearer ' + AToken); Response := Client.Execute(Request); if Response.StatusCode = 200 then Result := Response.ContentAsString else raise Exception.CreateFmt('Request failed with HTTP error %d: %s', [Response.StatusCode, Response.StatusText]); finally Request.Free; Client.Free; end; end; In this example, the SendRequestWithBearerToken function takes two parameters: AURL: The URL of the API endpoint that you want to call. AToken: The OAuth2 bearer token that you want to use for authentication. The function creates a THTTPClient object to send the HTTP request, and a THTTPRequest object to set up the request headers. It sets the HTTP method to GET and sets the URL and Authorization header with the bearer token. Finally, it sends the request using the Execute method of the THTTPClient object and returns the response as a string. You can call this function like this: var ResponseContent: string; begin try ResponseContent := SendRequestWithBearerToken('https://api.example.com/items', 'my_bearer_token'); // Process the response content here except on E: Exception do ShowMessage('Error: ' + E.Message); end; end; Note that in this example, you would need to replace the https://api.example.com/items with the actual API endpoint you want to call, and my_bearer_token with the actual OAuth2 bearer token that you want to use for authentication.
  4. Attila Kovacs

    VCL - DevExpress

    I'm not surprised then you don't even know who you agree with.
  5. Roger Cigol

    VCL - DevExpress

    I agree with @Attila Kovacs Irony and Sarcasm are rarely helpful in a forum such as this. Good in pubs when discussing over a beer or two perhaps. If I feel a need for a bit of sarcasm I try to remember to add a hint such as < not! > after the sentence. By the way I am in the category of using EBT for "useful" rather than "beautiful" software.
  6. David Schwartz

    VCL - DevExpress

    What do you mean "Naaaaaah." That's exactly what I said! I refused to buy it! Raize charged a small upgrade fee ($69 or so) every time they updated the library, which was every few years, and they provided free upgrades each time Delphi required an update. Embt bought it, tried selling it with ANNUAL FEES (several hundred dollars) that simply got you an update every time Dephi was updated -- something Raise had always offered for FREE. That didn't work out well, did it? After 18 months and one upgrade with no new features in it, they dumped it into GetIt where they DO now provide it for free along with free updates each time Delphi is updated as well. And they even make small tweaks to it here and there. I still prefer it over the basic components. I played with FMX a bit, thinking it might be a good replacement for VCL, and it's not that. It's tolerable if you want to use their cross-platform tools for UI stuff. People constantly bitched and complained that while it provided a more-or-less consistent UI experience for the same app on different platforms, it was slow and buggy and inconsistent with the "native" controls on other platforms that most people were used to. So OTHER VENDORS came out with components that let you build cross-platform apps using "native" controls. I don't know if Embt ever saw the light, as I don't even pay attention to FMX any more. I'm glad you seem to like it, I think it's worthless. Anyway, I get the impression that YOU basically have abandoned VCL. That's all I've ever worked with. Every project I've worked on used VCL and many used DevEx. NOBODY used Dephi for anything but Windows development. You seem to be blind to the fact that the vast majority of Embt's customers are large corporations with huge apps built in the early 2000's that are still alive and kicking and making them tens if not hundreds of millions of dollars a year. Cross-platform stuff seemed to be a "hail Mary" approach at something desperately needed to revive interest in something that was on its dying legs outside of Corporate America. It still is here in America, but seems to be doing much better in several foreign countries. One thing we probably DO agree on is that the world seems to have moved on to Web-based apps. There's no evidence that Embt even has anything on the horizon in that respect. TMS is YEARS ahead of them with WEB Core! There's a company that got there 10 years ago, Elevate Software, that's still poking along, but it seems to be a one-man shop. Maybe Embt could buy them up and try competing with TMS? Working with WEB Core takes a little getting used to, but it's quite refreshing and I **LOVE** being able to build an app in Delphi and seeing it run inside of a web browser!!!
  7. As an update to this, I found a lot of success using Live Templates. It is a pain the butt to create all of them, but once they are working, then its is pretty easy. Please see here how to create the live template. An example of one that inserts the alpha symbol is below. Simply type /alpha<space> and you are good to go. <?xml version="1.0" encoding="utf-8" ?> <codetemplate xmlns="http://schemas.borland.com/Delphi/2005/codetemplates" version="1.0.0"> <template name="\alpha" invoke="auto"> <description> inserts the σ symbol based on the latex syntax </description> <author> David Novo-Lake </author> <code language="Delphi" context="methodbody"><![CDATA[σ]]> </code> </template> </codetemplate>
  8. programmerdelphi2k

    VCL - DevExpress

    Indeed, DevExpress is a great collection of components that pretty much meets almost every VCL project need. But like everything big, it is expensive for small projects or individual programmer. On the other hand, RAD Studio provides a good option for any project that doesn't need to be more beautiful than useful. Now, if you want to prioritize "beauty" to the detriment of useful things, then you will need to look for third-party suites, or invest in internal labor to produce them. As this does not seem to be your option, then, the replacement of DevExpress by TMS (currently in great prominence) can be a great acquisition. Especially in the range of VCL and FMX (multiplatform) components they have, unlike DevExpress (VCL-oriented)
  9. Attila Kovacs

    VCL - DevExpress

    Naaaah. I bought it for 500 bucks. In a year it became free. Naaaah. FMX was on the table and VCL is abandoned. Not anymore. Plenty of HDPI issues and EMBT won't spend money on fixing it because VCL is abandoned. Way behind! I'd say loading a form is like going to Canis Majoris. And also as big in size. Sadly they are not bother noticing you on updates nor do they keep old versions to download. Like any of them would cost a penny.... There is howerver https://www.almdev.com/prods/stylecontrols/stylecontrols.html maybe the last actively maintained VCL pack with some awesome components. Don't be afraid of the colorful sample images. They are by default just as grey as the built in components and it's cheap and has a Lifetime license. No upgrade fees. Anyway, I still don't understand the original question. What EMB components do you want to compare to what DevExpress components? It makes no sense. I think there were about 5 new VCL calendars released in the last 5 years and thats all.
  10. David Schwartz

    VCL - DevExpress

    Ever since Borland released Delphi, there has been one overriding dictate: The stuff in the box needs to be "useful", not "the best". Unlike Microsoft, who has a history of buying up great tools and dumping them into their products, Borland wanted to draw a line and say to vendors, "Feel free to build better stuff than this, we won't interfere." And that attitude continues today. (I can't speak for C++ Builder as it has been more of a distant step-child of Dephi's forever. They've been working hard at making it more of an "equal", but the language has become so verbose and the libraries so complex that I find Delphi to be much simpler and easier to work with. Not to mention that Delphi's "generics" and C++'s "templates" are not the same. C++ and Delphi have about 95% overlap in their semantics, but there's some nice stuff I used regularly when I worked with C++ that Delphi simply doesn't support syntactically, and probably never will.) Here's a bit of a history lesson that may be more than you want to know, but it answers your question quite thoroughly: A lot of component libs were created for Dephi that barely added much to the existing stuff; they sold well because they were fairly cheap and saved more time than they cost. Over time, most of them have either disappeared or been turned into FOSS libs. Even some fairly big ones. But if you look closely, for example, at Raize Components, my thinking is, "this is what the base components in Delphi should be!" I'm guessing that Raize got to the point where they sold so few licenses that they just sold the rights to EMBT and washed their hands of the product. But here you can see that original attitude perfectly: EMBT initially started trying to sell this wonderful library for WAY more than Raize charged, and it utterly failed -- I'm guessing because people didn't like the idea of shelling out several hundred dollars for something that looks like the next evolution of what you get in the box. So they made it free and added it to the GetIt library, and it lives on there. I've used Raize Components on every project I can rather than the built-in components because they're so much easier to work with. However, I've noticed that Embt regularly adds more updates to the base components than to the Raize Components, and they'll never replace the base components with Raize Components even though most of the latter are literally derived from the former. (That is, TMemo and TrzMemo are both derived from TCustomMemo, and TMemo adds nothing in terms of logic to TCustomMemo, which is how the library is designed.) So you can see that even when the company has had a great reason and opportunity to upgrade the basic components in a meaningful way, they STILL refused! If we were to say that Raize is a relatively small improvement on the built-in components, like traveling across town, then DevEx is more like going to the Moon in comparison! DevEx started out as Delphi-only, but as Delphi sales shrunk, they expanded to cover C# and other platforms (eg, C++) as appropriate. Several big libraries did this, just as a way to survive, thankfully. Because if they hadn't, they wouldn't still be around today. Another vendor that has been VERY ACTIVELY building stuff that enhances Delphi's base components is TMS Software. I believe they have the widest selection of "Made-for-Delphi" components on the market today. And they're constantly releasing improvements across the board. Personally, I'm a HUGE fan of their Biz library, WEB Core tools, and FNC components, and I've used their VCL components in projects here and there many times over the years. I think that WEB Core is taking Delphi in a direction (web apps) that fits where the market is clearly heading, and there's no sign that EMBT has any interest in going in that direction -- so don't expect anything out-of-the-box to get you there today, or probably ever. Long story short, whatever comes "in the box" with Delphi is a "starting point". Very few projects I've worked on find it adequate to build a well-embellished application that has a lot of user-friendly features included -- at least, not without a lot of manual customization of existing components if not fully customized extensions. (I worked on a project once where Management thought TMS charged WAY too much for their ALL-ACCESS Pass when it was only around $1200 USD, and instead had three devs each working for nearly 6 montus building custom components that duplicated what some stuff in the TMS VCL Pack does. Those Devs cost them around $50k each to build components they could have gotten by paying $1200 per seat -- plus dozens more! Never mind that the annual renewal cost for ALL-ACCESS is only 30% of the new license cost, and those fees allow THEM to deal with all of the maintenance and updates.)
  11. Primož Gabrijelčič

    Hands-On Design Patterns with Delphi

    Mixed. They do their job, but you can definitely tell that it is an Indian team behind. Everything is "yes, of course" and then maybe something happens. Or maybe not. Plus they are very set in some formulaic ways - if you want to write a book, it has to fall into some already defined slot for which they know how they want organize it and then they insist on their way (how the content should be structured, what is allowed and what not etc). That is helpful, but also limiting and frustrating. Most of the time it works the best if you also say "yes, of course" and then do it in your own way. 🙂 Technical staff and editors are mediocre, at best. They definitely will not catch all errors. So - if you are looking for a perfect partner, they are not the one. If, however, you can just say "eh, whatever" from time to time and move on, they work just fine. They do pay on time, though. As for the other publishing houses, I have no idea.
  12. Remy Lebeau

    Using a C++ Class in Delphi

    You can't avoid implementing the C++ class in a DLL or BPL, unfortunately. However, Delphi can use the C++ object directly if it is derived from a Delphi class (ie, TObject or descendant), or is accessible using an abstract interface that is also defined on the Delphi side, or is accessible via/as a COM object. Otherwise, you are stuck using plain C-style wrapper functions, as you already have.
  13. Maybe a little offtopic, but ...
  14. It `s Magic. Before our eyes, large artificial neural networks are becoming more and more intelligent.
  15. https://markwschaefer.medium.com/20-entertaining-uses-of-chatgpt-you-never-knew-were-possible-3bc2644d4507 Some more applications https://marketplace.visualstudio.com/items?itemName=DanielSanMedium.dscodegpt&amp;ssr=false VSCode extension that uses Subj to generate comments or query code snippets
  16. Edwin Yip

    TMS and CoPilot, and Delphi ?

    It seems that the copilot rest API has been available...
  17. David Heffernan

    Opinions about Pascal vs C/C++ IDE

    Both Matlab and R seem completely inappropriate for this usage scenario. But R is not graphical software. It's best thought of as a scripting language designed for statistical use.
  18. David Heffernan

    Opinions about Pascal vs C/C++ IDE

    That's a tool chain limitation rather than language though.
  19. Lars Fosdal

    Manage overloaded IfThen functions

    I just remembered a major reason to put the generic type on the method: Type inference. type Use = record public class function When<T>(const aBool: Boolean; const WhenTrue: T; const WhenFalse: T): T; static; end; { Use } class function Use.When<T>(const aBool: Boolean; const WhenTrue, WhenFalse: T): T; begin if aBool then Result := WhenTrue else Result := WhenFalse end; procedure Test(Cond: Boolean); type TObjectClass = class of TObject; var i: Integer; b: Byte; c: Cardinal; w: Word; s: String; d: Double; o: TObjectClass; begin // if type inference is not able to understand your code, you get // [dcc32 Error]: E2532 Couldn't infer generic type argument from different argument types for method 'When' s := Use.When(Cond,'True', 'False'); // Type inference makes the <T> argument to When optional when the parameters are the same type s := Use.When(Cond, 1, 2).ToString; i := Use.When(Cond, 1, 2); b := Use.When<Byte>(Cond, 1, 2); // Needs <Byte> or you get the inference error - not sure why c := Use.When(Cond, 1, 2); w := Use.When(Cond, 1, 2); d := Use.When(Cond, 3.14, 42.0); // 42 without decimals gives the inference error unless you specify When<Double> o := Use.When<TObjectClass>(Cond, TObject, TStringList); end;
×