Jump to content

david_navigator

Members
  • Content Count

    144
  • Joined

  • Last visited

Community Reputation

12 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. david_navigator

    Pascal script memory management

    Thanks, but I meant "only make sure to not use a shared memory memory manager with the exe."
  2. david_navigator

    Pascal script memory management

    @Kas Ob. could you explain in a little more detail about the memory manager please ?
  3. david_navigator

    Pascal script memory management

    I was hoping there was something that the OS could deal with. If I made the scripting engine a stand alone EXE then whatever the user wrote, Windows would clean up when the exe closed. I was hoping that there might be some way to achieve that within my app. Doing some research I see that Job Objects details "The virtual memory of job objects isolates the memory behavior of a group of processes (tasks) from the rest of the system", but so far little about how this is achieved.
  4. david_navigator

    Pascal script memory management

    One of my apps uses PascalScript to allow the user to customise various tasks. However as I've recently discovered it's really easy for the end user to write a script that leaks loads of memory. As far as I can see PascalScript doesn't do any kind of memory tidy up when the script ends - it expects the script's author to do that. Is there some way to encapsulate the instantiated TPSScript object in such a way that I can free any memory when the script object is freed ? Something like (in psuedo code) Create memory container; PSScript:=TPSScript.Create(nil); PSScript.Script.Assign(fScript); PSScript.Compile; PSScript.Execute; PSScript.Free; Destroy memory container;
  5. david_navigator

    Code using TIdIMAP4 driving me mad !!

    Though I can't actually change any of this as it's not my server. I just had to go with what I could to get my delphi app to talk to it.
  6. david_navigator

    Code using TIdIMAP4 driving me mad !!

    Here you go
  7. david_navigator

    Code using TIdIMAP4 driving me mad !!

    >Are you sure you are supposed to be using implicit TLS on port 143, and not explicit TLS instead? If I change the test code above to use explicit then TheImap.Connect; never returns. Have I missed setting something else or if this just a strange server ?
  8. david_navigator

    Code using TIdIMAP4 driving me mad !!

    > need to use implicit tls on port 143 (why?), then you need to set the Port after setting the UseTLS. Thanks. No idea why. I didn't configure the server :)
  9. david_navigator

    Code using TIdIMAP4 driving me mad !!

    [Some time later] I've now discovered that the IdSSLIOHandlerSocketOpenSSL1 code changes the TIMAP4.port property to 993, even though my server wants 143, so setting TheImap.Port := 143; after setting the IdSSLIOHandlerSocketOpenSSL1 properties, addresses the issue. Not sure if this is an Indy bug or a misunderstanding of how it should work by me. Replying to my own question simply because this will no doubt bite me on the bum in 5 years time when I refactor the code !!!
  10. david_navigator

    Code using TIdIMAP4 driving me mad !!

    I have the following fairly simple code to connect to my IMAP server, however I'm doing something wrong, but I can't work out what. The first time I click the button, I always get ExceptionMessage="Socket Error # 10061 Connection refused." ExceptionName="EIdSocketError" However if I then click on the button again, the IMAP control connects to my server just fine and I can retrieve anything I like without a problem. I've tried setting various properties in various different orders, but that makes no difference, so why does it not work the first time ? If I make TheImap & IdSSLIOHandlerSocketOpenSSL1 local to the button1click procedure, rather than class level, then TheIMAP never connects, so that seems to rule out something external blocking the connection first time round and points to something not being initialized correctly, but what am I missing ? type TForm3 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } TheImap: TIdIMAP4; IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL; public { Public declarations } end; var Form3: TForm3; implementation {$R *.dfm} procedure TForm3.FormCreate(Sender: TObject); begin TheImap := TIdIMAP4.Create(nil); IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(TheImap); end; procedure TForm3.Button1Click(Sender: TObject); begin if TheImap.connected then TheImap.Disconnect; TheImap.Host := 'xxxxxxxxx'; TheImap.Username := 'xxxxxxx'; TheImap.Password := 'xxxxxxx'; TheImap.Port := 143; with IdSSLIOHandlerSocketOpenSSL1 do begin Destination := format('%s:%d', [TheImap.Host, TheImap.Port]); // e.g 'imap.gmail.com:993'; Host := TheImap.Host; MaxLineAction := maException; Port := TheImap.Port; DefaultPort := 0; SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; SSLOptions.Mode := sslmUnassigned; SSLOptions.VerifyMode := []; SSLOptions.VerifyDepth := 0; end; TheImap.IOHandler := IdSSLIOHandlerSocketOpenSSL1; TheImap.UseTLS := utUseImplicitTLS; try TheImap.Connect; except on E: exception do showmessage(E.Message); end; if TheImap.Connected then showmessage('Connected ok'); end;
  11. david_navigator

    Obfuscating secrets

    Surprisingly I can't find an answer to my question here or via google (I'm probably asking the wrong question), but what's the best way to obfuscate API secrets in Delphi ? e.g. My app needs to send email using Office 365, which requires an oAuth2 login. To start the login process I have a client_ID & a client_secret given to me by Microsoft to identify my app. Obviously these need to be stored within the exe but how to hide them such that some (casual) hacker, can't pull them out and pretend to be me ? Cheers David
  12. david_navigator

    Detect stack full for recursive routine

    Thanks. This is the first time it's fallen over in 20 years so not too concerned. I just wondered if there was a call like "is there enough stack space left for me to call this routine again" kind of thing.
  13. I have some inherited code that does some complex maths using a recursive function (i.e the function calls itself). Last night a customer had a situation where running the routine killed the app. My belief is that the app ran out of stack space due to this routine calling itself multiple times and thus died. Is there anyway to detect this is likely to happen so that the code can be aborted with a message instead? David
  14. Using Delphi to upload or download from a cloud S3 server, my customers are getting this intermittent error. exception class : ENetHTTPClientException exception message : Error sending data: (12030) The connection with the server was terminated abnormally. thread $2f68: 01d4096a +126 HireTrackNX.exe System.Net.HttpClient.Win TWinHTTPClient.HandleExecuteError 01d40c76 +2d2 HireTrackNX.exe System.Net.HttpClient.Win TWinHTTPClient.DoExecuteRequest 01d4bda2 +1ea HireTrackNX.exe System.Net.HttpClient THTTPClient.ExecuteHTTPInternal 01d4c080 +008 HireTrackNX.exe System.Net.HttpClient THTTPClient.ExecuteHTTP 01d4b0f2 +0ee HireTrackNX.exe System.Net.HttpClient THTTPClient.Execute 01d4bb05 +04d HireTrackNX.exe System.Net.HttpClient THTTPClient.DoExecute 01d4fe18 +050 HireTrackNX.exe System.Net.HttpClient THTTPClient.Put 022b7f32 +03a HireTrackNX.exe Data.Cloud.CloudAPI TCloudHTTP.Put 022b77e7 +077 HireTrackNX.exe Data.Cloud.CloudAPI TCloudService.IssuePutRequest Google seems to suggest it could be a Winsock timeout or a TLS mismatch between the target machine and console machine., but I have no understanding of what that actually means in practical terms - it certainly doesn't seem to be related to the size of the file being transferred. Would that be something as simple as a network connection issue between the client & server ? The server's hosting company tell me there's no issue at their end and the user is connecting to the client over RDP, so there can't be an internet issue at their end either. I'm really looking for any ideas or suggestions on how to either deal with the error better from a user's POV or how to diagnose what the actual cause is and address that. Usually if the user retries the upload or download process a couple of times, it does eventually work. Many thanks David
  15. david_navigator

    Escaping UK pound sign in JSON

    Many thanks. Don't I feel stupid !! Now to do some experimenting to see if all the characters in the above routine get escaped correctly automatically .
×