Jump to content

hsvandrew

Members
  • Content Count

    35
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by hsvandrew

  1. I've used TNetHTTPRequest to setup a request with headers successfully like this: NetHTTPRequest1.CustomHeaders['Content-Type'] = 'text/html'; Typical object setup is like this NetHTTPClient1 := TNetHTTPClient.create(nil); NetHTTPRequest1 := TNetHTTPRequest .create(nil); NetHTTPRequest1.Client := NetHTTPClient1; Usage NetHTTPRequest1.post( url , data , outcome );
  2. hsvandrew

    Delphi 11.2 - Ubuntu Debugger error

    Instructions for linux can be a bit tricky because there are slight differences between versions. If the above doesn't work for you, like it didn't for me on Centos9 (October 2024), install the yum packages as per the script above Find your python 3 library using sudo find / -name libpython3*.so* For example, mine was /usr/lib64/libpython3.9.so.1.0 Run the symbolic link command (ln) as in the script, but using the correct path as you found using find. You might find multiple libpython files. You want the one that looks similar to mine. Hope this helps someone.
  3. hsvandrew

    SplashForm freeze

    The Delphi VCL is not multi-threaded. The code that's running to create all those forms will block code like your animation from working. Its rarely a good idea to actually 'create every form' on startup like this. I know that's how Delphi does it, but its less than ideal. App startup will either be slow because You have some code running in an initialization section somewhere, either in your code or the many libraries you may be using. You have a database connection on a form, perhaps to a database that may not be connectable, and this is causing a delay until it times out when creating a form Generally I would suggest these principles: Create forms when they are first used rather than at startup or during an idle stage when the user won't notice Move operations that aren't VCL/drawing related into threads, allowing the UI to still update whilst they run i.e. disk operations, database operations etc If these things don't work, even though it will have other impacts, you could consider creating a launcher app that shows the splash screen whilst then launching the real app. This will cause a few issues with taskbar/icons etc, but maybe a solution for a very slow startup that can't otherwise be coded around with the above 2 suggestions. Delphi can sometimes encourage people to create enormous forms with thousands of components. This is the only reason I can think of in a modern computing environment other than an IO delay for any noticeable 'load time' during creation of forms on startup.
  4. hsvandrew

    Using Deplhi TWebmodule with parameter

    Hi Jim, To handle parameters built into the URL rather than as query parameters you'll need to do the following: Assign a partial path to the 'pathInfo' of your WebModule Action i.e. /getname/* Then, in your ActionHandler you'll want to access the path part of the URL, break it into an array split by / and then execute based on the parts that matter var paths: TArray<string> = Request.PathInfo.split(['/']); //Check array length etc if sameText(paths[2],'add') then //Do add function else if sameText(paths[2],'delete') then //Do add function object.delete( paths[3] ); Hope that makes sense. I haven't tested this exact code so there might be slight syntax issues.
  5. I'm just wondering how others have created system wide locks to manage sharing a resource such as a single log file with multiple processes (I know, not ideal) Two examples are as follows: {$IFDEF useSemaphore} procedure systemWideLock( name: string; proc: TProc; timeout: integer = 0 ); var hSem: THandle; nameWS: array[0..255] of WideChar; begin StringToWideChar(name,nameWS,254); hSem := CreateSemaphore(nil,1,1,nameWS); try WaitForSingleObject(hSem,INFINITE); proc(); except end; ReleaseSemaphore(hSem,1,nil); end; {$ENDIF} {$IFDEF useFile} procedure systemWideLock( name: string; proc: TProc; timeout: integer = 0 ); var fs: TFileStream; locked: boolean; begin locked := false; while not locked do begin try fs := TFileStream.create('C:\temp\File.lock',fmCreate); locked := true; except end; sleep(random(3)); // can be removed end; try proc(); except end; FreeAndNil(fs); end; {$ENDIF} The challenge with the Semaphore, whilst being a much faster mechanism, is that, if for some reason code execution gets stuck between lock and unlock (let's say a dialog appears in a silent process or the process gets into an endless loop), end tasking the application will not release the semaphore, resulting in the need to reboot Windows. The file approach seems to work better in that a file lock releases when the process terminates (apparently timing might vary but it happened ok in my testing), and you can argue if the sleep should be removed or the time changed, but either way its orders of magnitude slower. Are there any other lock types that could be used that release upon process termination?
  6. I agree with you. I just have to create a solution within a team where someone higher than me doesn't get this 🙂
  7. hsvandrew

    Delphi 12 VCL painting differs through RDP

    I don't know how much access to this server you have, but I would start by connecting to its console session either physically or via something like Anydesk and logging in there, then running your app to see how the base operating system settings are affecting your application. This will then determine if its ONLY via RDP or across the entire machine. If you determine its only in RDP, review the settings in the remote desktop connection (MSTSC) app, by selecting LAN (10mbps or higher) and ensuring all are ticked ON It is also possible for a system admin to disable some of these options server side via policy.
  8. hsvandrew

    The future of Delphi

    In my view, this is how the future Delphi products should be designed. https://www.canva.com/design/DAEr0Sff_lA/42dTO0oDSOAcvWEN0oDA6g/view?utm_content=DAEr0Sff_lA&amp;utm_campaign=designshare&amp;utm_medium=link&amp;utm_source=sharebutton&amp;fbclid=IwAR0vPdkL1g_ckz9rwLzsLEM2Z-kJrB5WnS_lKHTL37F7QzL5QHAm1XxJqYo#8 I really hope that we could have a discussion about this as a community. Review the presentation. Compliment any good ideas. Ask questions. Question things constructively. Discuss different ways.
  9. hsvandrew

    Delphi 12 is available

    Or maybe, after the failures that have been 10.4,11 and 12, 13 could buck the trend and the show superstition for what it is and be amazing... Like do people really think the gods don't know you're staying on the forth floor even if the humans didn't number it 4?
  10. hsvandrew

    Delphi 12 is available

    First impressions of the installer: someone from 1990 tried to replicate the modern Visual Studio installer and failed. Looks ugly and embarrassing. Proportions are wrong, padding is wrong, looks amateur. Let's see if Code Insight finally works as we haven't been able to upgrade since 10.3.3....
  11. hsvandrew

    VLC Player 64bit

    Does anyone have VLC player (the 64bit DLL) working in Delphi? I load the 64bit DLL like this DLL := ‘C:\Program Files\VideoLAN\VLC\libvlc.dll’; FDllHandle := LoadLibrary(PChar(ExtractFilePath(DLL)+‘libvlccore.dll’)); FDllHandle := LoadLibrary(PChar(DLL)); But all the GetAProcAddress functions fail, even though I can see the exports in the DLL.
  12. hsvandrew

    TEdgeBrowser - how to fix a blank display

    Just in-case it helps someone, I've spent hours trying to work out why my TEdgeBrowser (chromium) was blank in one app, whilst working fine in the simple demo app. Turns out CoInitializeEx(nil,COINIT_MULTITHREADED); will stop TEdgeBrowser from working. This adjustment replaces CEF4Delphi, where this method was called and all worked ok. Of course you also need the WebView2Loader.dll in the same folder as your application and to have installed Chromium Edge.
  13. hsvandrew

    VLC Player 64bit

    For the future benefit of anyone having a similar problem, here is the solution and possible keywords for resolution. The code/freeware/project I was using was uTLibVLC FDllHandle was declared as an integer. I suspect the clue to help me realise there was a problem was that LoadLibrary for the libvlc.dll resulted in a negative integer whereas the other DLL's had positive handles i.e. integer overflow Changing FDllHandle : integer; to FDllHandle : HMODULE; fixed the problem.
  14. Hi everyone, Just wondering if anyone has any experience with Delphi 10.2.3/10.3 Apache Modules on Linux request.GetFieldByName('Accept-Language') returns a valid value request.GetFieldByName('HTTPS') is blank, whilst running on a HTTPS connection We aren’t running any load balances and apache IS serving HTTPS content with SNI correctly I’ve even adding to the virtual hosts SetEnv HTTPS on https://serverfault.com/questions/446294/https-variable-in-server-using-nginx-as-reverse-proxy Any ideas? Delphi Rio 10.3 Apache Config <VirtualHost *:443> SetEnv HTTPS on ServerName the.domain.com DocumentRoot /var/www/html SSLEngine on SSLCertificateFile /……(correct file) SSLCertificateKeyFile /…….(correct file) SSLCertificateChainFile /…..(correct file) </VirtualHost>
  15. I don't know if its just Delphi developers that are negative on ChatGPT but it does seem fairly unreasonable. Firstly, our IDE struggles to put begin's and ends and other basic structures in place at present, yet a newish product in its early versions can be given an english statement about what you require and knock out code in multiple languages. For example you can ask it to write a class about a patient going to hospital or ask it to show a delphi example of how a function in curl might be coded. Sure, not every output of code is perfect in every day but seriously, show me the previous system that was even close to this amazing and giant step in computing. This breakthrough is as least as important as the internet and iPhone were to changing the world. If you watch this video and don't see how much this is going to impact business systems, something is wrong with you.
  16. This note is for anyone going about creating an ISAPI in modern versions of Delphi. Request.TranslateURI has been broken (and still remains unfixed in 10.3)for a number of releases. TranslateURI is useful if you run multiple sites on the same IIS server and want to work out the base folder of the site i.e. request.TranslateURI('/') to work out which customer experience/domain etc you are currently serving. I'm not sure if this code covers every unicode etc scenario, but for basic needs it works whereas the built in code does not. You'll need to modify C:\Program Files (x86)\Embarcadero\Studio\20.0\source\internet\Web.Win.IsapiHTTP.pas You need to then ADD the Web.Win.IsapiHTTP.pas to your project with the full source path I'm surprised this bug hasn't had more attention and have to wonder how much web work is going on in Delphi. **please see below for updated version from another member** function TISAPIRequest.TranslateURI(const URI: string): string; var PathBuffer: array[0..1023] of AnsiChar; Size: Integer; begin System.AnsiStrings.StrCopy(PathBuffer, PAnsiChar(AnsiString(URI))); Size := SizeOf(PathBuffer); if ECB.ServerSupportFunction(ECB.ConnID, HSE_REQ_MAP_URL_TO_PATH, @PathBuffer, @Size, nil) then Result := string(PathBuffer) else Result := ''; end;
  17. hsvandrew

    Class Completion

    Is there an option (or plugin) to get class completion to work in a way where all new procedures & functions will appear at the bottom of the unit or in the same order as its declared, rather than in some kind of alpha sorted location? The help topic https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_Class_Completion says "If your declarations and implementations are sorted alphabetically, class completion maintains their sorted order. Otherwise, new routines are placed at the end of the implementation section of the unit, and new declarations are placed in private sections at the beginning of the class declaration." But I don't really know what this means in practice and I can't find any logical settings to control the behaviour... Example: TFoo = class(Tobject) public //Containers procedure Zoo; //Animals procedure Cat; procedure Dog; end; I want the same order to be preserved when creating the implementation.
  18. hsvandrew

    Class Completion

    Thank you @Achim Kalwa I hadn't installed that part of the excellent work by Andreas Hausladen (I use the other critical bits). Still amazes me that these key failures never get actually fixed. Even the alpha sort option doesn't actually work properly.
  19. hsvandrew

    Hot Reload in Delphi?

    In my opinion hot reload is probably the most significant improvement to development since the Delphi IDE made VB look ancient. Developers are very expensive, and there are never enough hours in the day. For some reason developers spend all day making productivity tools for others, but seem to still work with spades instead of bulldozers. I can see this feature being worth at least $5000USD/year/developer which is a game changer. The fact the Delphi community doesn't see how important this is, well, it says a lot.
  20. After much pain and cost and time wasted, I wanted to leave this note for others TTask, Parallel Library -- DO NOT USE My advice to all Delphi developers: stick with OmniThread or write your own ThreadPool using TThread's. The Parallel Task Library (TTask, Parallel For loops etc) are all based on completely flawed code that still isn't fixed in Rio You'll invest many hours moving code across to TTask and then have to deal with all the core fundamental issues which you may not notice under normal conditions. These include: Flawed logic that runs only a few threads at a time (worse on a virtual machine) Flaws which sometimes stop tasks from starting at all Faults that, due to point 1 could result in a complete bottleneck of your app if you nest TTasks which may be hard to detect inside other functions Memory leaks on Linux n 10.2.x Hope this helps someone. We have got to the point where we try to avoid all new EMB built libraries where possible when a third party solution exists as we know it will be supported, tested and properly written.
  21. Hi all, using Delphi 10.2.3 AND Delphi 10.3, the following ISAPI (with no other code, built straight from a new project) crashes the entire ISAPI work queue. I've attached a html test file that causes the crash. It appears like if you have simultaneous ReadTotalContent's running at the same time things lock. Can anyone else reproduce this or suggest why? Please test with IIS 10 or newer. Our test system is Windows Server 2016. TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); var fileOut: TFileStream; begin try handled := true; Request.ReadTotalContent;//This freezes everything (ecb.ReadClient) fileOut := TFileStream.Create('C:\temp\files\'+ request.PathInfo.Replace('_upload2/','')+'_'+ request.QueryFields.Values['chunk']+'.txt',fmCreate); fileOut.Write(Request.RawContent,length(Request.RawContent)); FreeAndNil( fileOut ); except end; end; test.html
  22. We are having a problem with a devart control which may in the end be something funny they did wrong but the behaviour seems strange and more like a low level issue. Basically, the standard SQL Query control contains a simple SQL statement i.e. thisQuery.SQL.text := 'select * from emp where job = :PARAMname'; thisQuery.ParamByName('paramNAME').asString := 'new'; thisQuery.open; On Windows VCL, console etc and on Linux as a console app this works as expected (param is case insensitive as expected) When the exact same code is compiled into a generic brand new Delphi Apache Module and ran on the exact same machine as the console test app, the query fails unless the param is the same case in the SQL statement as it is in the ParamByName function. This seems strange to me. Does anyone know of any kind of Linux operating system quirk where the host application could override a function in such a way that you might expect this type of behaviour?
  23. hsvandrew

    Linux + Delphi + Apache problem on 10.3

    @Cristian Peța From what I can see ICU is available (IsICUAvailable returns true) As many Delphi developers we have a knowledge base of all the quirks on Windows. I feel this is going to be a learning experience to discover the quirks of Linux. This to me is a dangerous issue that needs to be understood because it could have all sorts of unintended and very hard to track down bugs, especially when the problem disappears as soon as you run it on Windows or Linux console. I suspect the same problem will be affecting many string handling functions and probably other functions as well.
  24. hsvandrew

    How to develop cheaply for iOS?

    You simply need the hosting provider to allow you to VPN to the cloud network running the Mac. However, if you want to make a good iOS app you'll need to do your testing on a real device: you just can't get the 'feel' of an app without touching it. If you want to develop cheaply for iOS you would be using Xcode + HTML + JS or similar. As you've already paid a huge amount of money for Delphi, a Mac should be somewhat affordable.
  25. hsvandrew

    Linux + Delphi + Apache problem on 10.3

    This issue has now been updated to show the offending function. Under the operating environment above, the result of this code is -1 Does anyone know why this might happen? procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); begin response.contentType := 'text/plain'; response.content := 'AnsiCompareText(''PARAMname'',''paramNAME'') ) = ' + inttostr(AnsiCompareText('PARAMname','paramNAME')); end;
×