Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 08/26/21 in all areas

  1. Lars Fosdal

    Anybody changing FileVersion directly in dproj file?

    I prefer to use a build server that deals with discovering code changes and performs the versioning. We use Continua CI (which is free for personal use) to automatically start builds after a commit to GitHub, and FinalBuilder which deals with the finer details of configuring projects. Continua can assign the same version number to any number of projects in the build configuration.
  2. Angus Robertson

    FTPS Passive Mode

    The ftpFixPasvLanIP fix is finally in SVN, sorry for the delay. Angus
  3. Two new zips for Win32 and Win64 versions of OpenSSL 1.1.1i can now be downloadable from the Wiki at: http://wiki.overbyte.eu/wiki/index.php/ICS_Download or https://www.magsys.co.uk/delphi/magics.asp . The latest 1.1.1 DLLs are also included in the ICS distribution SVN and overnight zip. There are two security fixes, one rated high relating to decryption using SM2 (which standard ICS does not offer) and rated moderate relating to ASN.1 strings used in X509 certificates and the confusing conversion between fixed length strings and C null terminated strings that may cause a crash, this was mainly a problem display certificate content. YuOpenSSL has a new version with OpenSSL 1.1.1l. Angus
  4. Hi Folks, I'm banging my head against the wall trying to understand, why the compiler throws "E2008 Incompatible Types" errors at the marked lines. I must be missing something completely... program Project4; {$APPTYPE CONSOLE} {$R *.res} uses System.Generics.Collections, System.SysUtils; type IMyIntf = interface ['{FCAFF2E8-5F8E-4473-8795-89BD41C89D57}'] end; TMyList<IMyIntf> = class FItems: TList<IMyIntf>; procedure AddItem(AItem: IMyIntf); function GetItem: IMyIntf; end; TMyType = class end; TMyTypeList<TMyType> = class FItems: TList<TMyType>; procedure AddItem(AItem: TMyType); function GetItem: TMyType; end; { TMyList<IMyIntf> } procedure TMyList<IMyIntf>.AddItem(AItem: IMyIntf); var Value: IMyIntf; begin FItems.Add(AItem); // E2008 Incompatible Types FItems.Add(Value); // Compiler is happy end; function TMyList<IMyIntf>.GetItem: IMyIntf; begin Result := FItems[0]; // E2008 Incompatible Types end; { TMyTypeList<TMyType> } procedure TMyTypeList<TMyType>.AddItem(AItem: TMyType); var Value: TMyType; begin FItems.Add(AItem); // E2008 Incompatible Types FItems.Add(Value); // Compiler is happy end; function TMyTypeList<TMyType>.GetItem: TMyType; begin Result := FItems[0]; // E2008 Incompatible Types end; begin try { TODO -oUser -cConsole Main : Code hier einfügen } except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end.
  5. Mike Torrettinni

    Anybody changing FileVersion directly in dproj file?

    Aha, it creates .rc file. Why do you put it in .dpr, to keep it with the project so you know what version it built, right?
  6. DPStano

    Anybody changing FileVersion directly in dproj file?

    @Mike Torrettinni It's our own custom syntax to define version info without touching *.dproj, these lines are parsed by *.ps1 script called from prebuild event https://docwiki.embarcadero.com/RADStudio/Sydney/en/Creating_Build_Events that creates res file https://docwiki.embarcadero.com/RADStudio/Sydney/en/Resource_file_(Delphi) that is linked to project during the build.
  7. DPStano

    Anybody changing FileVersion directly in dproj file?

    we have even hard rule to not commit dproj ... delphi modifies dproj without reason, and it's really annoying to resolve conflicts all the time, we created simple script in PowerShell that runs before build and creates resources with version info based on a custom comment in dpr like program Test; {@FileVersion=2.0.0} {@FileDescription=} {@InternalName=} {@Comments=} {@CompanyName=} {@LegalCopyright=} {@LegalTrademarks=} {@OriginalFilename=} {@PrivateBuild=} {@ProductName=@InternalName} {@ProductVersion=@FileVersion} uses
  8. Ondrej Kelle

    Replace default code template?

    https://www.delphipower.xyz/guide_7/adding_new_application_templates.html Alternatively, you could write a design-time IDE extension implementing IOTAProjectCreator interface.
  9. I don't understand why you would use TMyList<T:IMyIntf> rather than TMyList<T> here
  10. Can't expect 'em to implement a new feature in under 5 years now..
  11. The trick to generics is to only specify the desired type on the left side of a declaration and use <T> to "pass it on". Something like this.. type IMyIntf = interface; TMyList<T: IMyIntf> = class; TOnListItemSelected<T:IMyIntf> = procedure(AItem: T) of object; TOnListUpdated<T:IMyIntf> = procedure(AList: TMyList<T>) of object; IMyIntf = interface ['{FCAFF2E8-5F8E-4473-8795-89BD41C89D57}'] end; TMyList<T: IMyIntf> = class FItems: TList<T>; FOnListUpdated: TOnListUpdated<T>; procedure ListUpdated; end; { TMyList<T> } procedure TMyList<T>.ListUpdated; begin if Assigned(FOnListUpdated) then FOnListUpdated(Self); end;
  12. Thanks Lars, once again this is proof, that T(ea) makes you happy...
  13. program Project4Fixed; {$APPTYPE CONSOLE} {$R *.res} uses System.Generics.Collections, System.SysUtils; type IMyIntf = interface ['{FCAFF2E8-5F8E-4473-8795-89BD41C89D57}'] end; TMyList<T:IMyIntf> = class FItems: TList<T>; procedure AddItem(AItem: T); function GetItem: T; end; TMyType = class end; TMyTypeList<T:TMyType> = class FItems: TList<T>; procedure AddItem(AItem: T); function GetItem: T; end; { TMyList<IMyIntf> } procedure TMyList<T>.AddItem(AItem: T); var Value: T; begin FItems.Add(AItem); // E2008 Incompatible Types No more - Compiler happy FItems.Add(Value); // Compiler is happy end; function TMyList<T>.GetItem: T; begin Result := FItems[0]; // E2008 Incompatible Types No more - Compiler happy end; { TMyTypeList<T> } procedure TMyTypeList<T>.AddItem(AItem: T); var Value: T; begin FItems.Add(AItem); // E2008 Incompatible Types No more - Compiler happy FItems.Add(Value); // Compiler is happy end; function TMyTypeList<T>.GetItem: T; begin Result := FItems[0]; // E2008 Incompatible Types No more - Compiler happy end; begin try { TODO -oUser -cConsole Main : Code hier einfügen } except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end.
  14. This issue is as old as generics are: https://quality.embarcadero.com/browse/RSP-10506
  15. ertank

    thread-safe ways to call REST APIs in parallel

    Not a direct reply to the question. But, if I ever need to run parallel requests, I should be really thinking about building a custom thread class or two with main thread synchronization where needed.
  16. David Schwartz

    thread-safe ways to call REST APIs in parallel

    I understand from the first reply that the three objects need to be created dynamically inside the task. That's fine. A different post about this general topic suggested a fork/join approach using a counter object to know when it's finished. That's fine, too, although it may be more complicated than I need. Another reply here pointed out ExecuteAsync which I had not noticed (although I looked for Async...something), and it has some very interesting properties that also suggest the fork/join approach might have a simpler solution with it. In particular, I like the options that the anonymous methods offer in conjunction with the parameters that say whether the code should run in the main form's thread or the current thread. But every other post here added a warning about this or that, and it got confusing with the Execute vs. ExecuteAsync. The entire discussion seems like it could have been reduced to one or two short code examples like the above, so thank you Dalija. (The whole discussion on fork/join has quite a bit of code in the referenced article, although it seems to me it shouldn't be that complicated. Be that as it may, adding the logic needed to perform the REST queries in the task shouldn't add very much complexity.) I looked on SO for examples as well. It's hard to search for help there (or anywhere) on obscure topics. The few I found had lots of comments back and forth debating this and that, and not much code. (I'd post something on SO, but it seems a lot of my questions get downvoted or locked for being "off-topic". They're Delphi questions -- I don't get what's "off-topic" about Delphi questions in a forum intended for Delphi questions. Now I get warnings from SO saying my account is close to being locked because of the "low-quality" of my questions. I used to have nearly 2000 points and 45 badges before something short-circuited and SO's support people denied there was a problem. All of that "bling" just disappeared. So I don't spend much time there any more. I'm also very hesitant to post any more questions. The last one I posted got lots of opinions, and no definitive answers.) OT: There have been times in my life when I worked with a team of other developers. For the past 12 years or so, I've been either the only Delphi dev or had a junior person working with me with only 3-5 years of experience. Also, I'm a fairly high-level abstract thinker and most of the folks I work with are heavily left-brained highly detail-oriented people who can't handle abstract discussions. They want concrete examples for everything, which I find challenging. My only resources for help have been this place, SO, and Google. I truly do appreciate all of the help that's available here, and it's mostly because I value the level of mastery everybody here has. I know I can be a PITA at times because I often have very clear pictures in my head of what I'm looking for, I just have trouble expressing things clearly. We programmers are often no better at describing things in our heads than our clients, eh? 🙂 Unfortuntely, my memory recall is getting a little flakey, and complex topics I used to have no problem dealing with seem to show up in my head with pieces missing. But I still do love the process of programming -- it has always been like playing word games to me, and it's something I can do for hours and hours and never really get tired of doing. I'm sure most of you can relate ... how many people can say that about the things they do to earn a living? We're blessed in that respect. I only have one compliaint about what we do: we spend way too much time describing and explaining, in text, what it is we're talking about. I mean ... that's all programming is at its core: we have an idea in our head, we conjur up a recipe in some arcane language (Delphi in this case) and we use that to make the computer sing, dance, and jump through hoops. If we want to see a circle on the screen, we describe a circle. If we want to launch a rocket, we describe all of the steps that all of the different parts need to accomplish that. As annoying as I find reverse-engineering code to understand what it's doing (since most code is undocumented and what's there is usually outdated), sometimes the answer to a question is better given as code (or pseudo-code) than words describing what code needs to be written. But overall, I wish there was a more abstract way of dealing with things other than, say, English words explaining what's needed in a translation.
  17. IconFontsImageList components by @Carlo Barazzetta could be the answer: you can explorer the complete wiki to see how it works. Summary of library: An IconFontsImageCollection component that inherits from Delphi's CustomImageCollection and is compatible with VirtualImageList A IconFontsVirtualImageList, to use with Delphi version older than 10.3 A rendering engine of Icon-fonts using GDI+ (from Delphi XE4) A complete backward compatibility with older Delphi versions (from Delphi 7) A useful Collection and Component editor, with support for Category of Icons A custom CharMap viewer, to easily select icons contained in any Font Support for changing the Color based on the active VCL Style. High performance of drawing engine Support for FMX (also for mobile platforms) It's free and open-source Icons based on Fonts are a good alternative to bitmaps because they need only the Font installed in the system to obtain thousands of images (like the "Material Design Font Desktop.ttf" font: https://github.com/Templarian/MaterialDesign-Font). The icons scales perfectly, so, you don't need to multiple resolutions of your images to match the DPI of the monitors and multiple colors for Theme used. The Collection of Icons can be rendered by a single Font/Color defined at collection level, or by different Fonts/Color defined at Icon level, so you can mix different icons from different Fonts in a single collection. The library is quite stable, but any contribution is welcome!
  18. Uwe Raabe

    thread-safe ways to call REST APIs in parallel

    Be aware that this also needs a dedicated TRestClient for exclusive use in the internal thread. Also make sure that the TRestRequest events are either thread-safe or the SynchronizeEvents property is set to true. For create the TRestRequest dynamically for each case and create the TRestClient with the request as owner. That way the client is automatically freed with the request.
  19. Remy Lebeau

    FTPS Passive Mode

    Indy's TIdFTP component has a similar option. Except that, rather than attempt the reply IP first then fallback to the connected IP, it has a PassiveUseControlHost property to control whether it should just ignore the reply IP altogether and use the connected IP only. Not quite the same thing. I'm thinking now that I should add FileZilla's behavior to TIdFTP if PassiveUseControlHost is false.
  20. TSslWSocketServer has a property SslCliCertMethod which determines whether a client certificate is required or optional, you check the certificate in the OnSslHandshakeDone event and close the connection if invalid, it is documented on the wiki page, http://wiki.overbyte.eu/wiki/index.php/TWSocketServer. Note I've not tested this for a while. Angus
  21. Darian Miller

    Is datasnap Webbroker a good approach?

    There are quite a few different avenues you could take to support API development. The first step in any is to get it "to work" which you seemed to have accomplished! Your next question is valid - will it scale? The question remains, how much do you need it to scale? How many concurrent connections are planned, what sort of total throughput is required and what are acceptable latencies? Once you define those, you can test those things yourself by using tools like JMeter and BlazeMeter and see if your performance is acceptable. If it's not, then you can look at scaling methods, either locally with Windows Clusters or migrating to cloud services on AWS or Azure. If the performance isn't satisfactory, you could also look into different implementations. One of the most commonly used frameworks is mORMot which has been highly optimized. If you join their community you'll likely get some help getting started. There's a LOT of code available, and much you can ignore to get started. Another option is to get a commercial finely-tuned multi-tier approach from Components4Developers. This option has been around a very long time and is quite mature, and quite performant. Another commercial option to look into is the Remoting SDK from remobjects. This also has been around quite a long time and is widely used. For a real simple and performant commercial toolkit, also look at RealThinClient components. There are plenty of other choices out there. The next step that I would recommend is to analyze your projected usage and start establishing some real testing metrics that you can validate current and future decisions on. Get the tools in place to back up your API infrastructure with measurements and validation. In addition to API testing, get line-by-line performance measurements with ProDelphi or Nexus Quality Suite to track down different implementations.
  22. Lars Fosdal

    Replace default code template?

    /facepalm
  23. Uwe Raabe

    Replace default code template?

    AFAIK that is not possible. It is hard-coded in delphicoreide<xxx>.bpl
  24. xenog

    FTPS Passive Mode

    Hi François, I have both the Delphi and C++ personalities installed and it is clear that Embarcadero have problems with C++ Builder. If I install the Delphi ICS, it builds and installs with no problems. If I then try and use these components in a C++ project, I get compile errors as C++ Builder can't find the lib and hpp files and then I get linker errors as it can't find the obj files. This is entirely an Embarcadero problem, as your code works perfectly. If I try to install ICS with the C++ Builder packages, I don't get the hpp files or obj files, even if I change the project properties to output all Builder files. Some of these problems could be down to my lack of understanding of how C++ Builders with packages. I'll try again next week and see if I can find a way to get Builder to be happy. Failing that, I may install the Delphi ICS, so that I have the components on the palette, and then add the ICS PAS files to each of my C++ builder projects, so that it can make the hpp and obj files. It's shame that Embarcadero can't allow a Delphi component to work seamlessly in a C++ project. I did try installing ICS from Getit, but that only works for Delphi projects. Thanks for the beautiful components. They are a joy to use. Richard
  25. SOLVED Unfortunately I got no hint for an error when calling PFXImportCertStore, but the format of the parameter was wrong. This does not explain why the other way using the store did not work, but this would have been only a workaround anyway. What I can say at this point: The implementation of Embarcadero really is not good. There is already working code, but one cannot use it, because the functionality is completely unreachable.
×