david_navigator
Members-
Content Count
153 -
Joined
-
Last visited
Everything posted by david_navigator
-
I just accidentally instantiated an FMX form in my VCL app and no errors were thrown (nor warnings at compile time). It just seems to work. Is this a fluke or does delphi natively now support VCL & FMX forms in the same app ?
-
Is there a VCL control that does this ?
-
Thinfinity VirtualUI - cloud-based conversion
david_navigator replied to Mark Williams's topic in General Help
Yes. The app is designed to be used on a desktop size device. -
Thinfinity VirtualUI - cloud-based conversion
david_navigator replied to Mark Williams's topic in General Help
Assuming that your IP address ends in .143 - I can see that you successfully authenticate too. -
Thinfinity VirtualUI - cloud-based conversion
david_navigator replied to Mark Williams's topic in General Help
Very odd. Let's see if their support comes up with something next week. -
Thinfinity VirtualUI - cloud-based conversion
david_navigator replied to Mark Williams's topic in General Help
I'll raise a ticket to Thinfinity and see if they have any suggestions. -
Thinfinity VirtualUI - cloud-based conversion
david_navigator replied to Mark Williams's topic in General Help
Odd. Never seen that before (and I have 100's of users). What browser are you using ? Are you on a touch screen device ? Here's a video clip of what you should see https://Navigator.tinytake.com/msc/OTUyNDkyMF8yMzEzMTE5NQ -
Thinfinity VirtualUI - cloud-based conversion
david_navigator replied to Mark Williams's topic in General Help
Odd. You should see something like this. Nothing required client side. -
Thinfinity VirtualUI - cloud-based conversion
david_navigator replied to Mark Williams's topic in General Help
I have a massive app that we converted to use Thinfinty. You can play with it here if you'd like to see the experience from a user POV https://trial.hiretracknx.com:6580/ Alias: ashoka Username: HireTrack_Admin Password: 1234 There are two areas where we still have issues - some DevEx components don't render properly in certain circumstances - e.g on the first form you see, one of the buttons doesn't get drawn fully until you move your mouse over it. I do have a fix for this issue, but there are other DevEx issues apparently, though we haven't hit any yet. The other issue I've come across is launching a form that uses an embedded browser. That doesn't work correctly, though Thinfinity people are very reactive and have promised me a fix in the next week of so. There are areas where we have If Thinfinity.active then in our code - especially anything that involves uploading or downloading files. My biggest gripe with Thinfinity is the license management. We have our app running across about 10 servers, with one licensing server, but there's no way to see which server is using how many licenses - e.g. I can see that 50 licenses are in use, but not which machines are using them. This might not matter for your scenario, but it's an annoyance in ours. David -
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;
-
Thanks, but I meant "only make sure to not use a shared memory memory manager with the exe."
-
@Kas Ob. could you explain in a little more detail about the memory manager please ?
-
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.
-
Detect stack full for recursive routine
david_navigator posted a topic in RTL and Delphi Object Pascal
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 -
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;
-
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.
-
Here you go
-
>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 ?
-
> 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 :)
-
[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 !!!
-
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
-
Detect stack full for recursive routine
david_navigator replied to david_navigator's topic in RTL and Delphi Object Pascal
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. -
Error - 12030 The connection with the server was terminated abnormally
david_navigator posted a topic in Network, Cloud and Web
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 -
Escaping UK pound sign in JSON
david_navigator posted a topic in Algorithms, Data Structures and Class Design
I have some code that I inherited from someone else which is used to convert a dataset to JSON. Mostly it works OK, but rather than a £ being converted to \u00A3 it gets converted to \\u00A3 i.e the slash gets escaped again. So from "Additional Fuel Used 170 Litres @ £2.00 per Litre" rather than "Additional Fuel Used 170 Litres @ \u00A32.00 per Litre" I get "Additional Fuel Used 170 Litres @ \\u00A32.00 per Litre" I've found very similar code in StackOverflow, but that has the same issue. This is the SO code as it's potentially easier to read. Can anyone point out where I/they are going wrong please ? As far as I can tell the EscapeValue code is correctly converting the £ to \u00A3, but then the TJSONPair.create seems to be then re-escaping the one '\' in to '\\' unit Unit71; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, dbxjson, json; type TForm71 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; type TSvJsonString = class(TJSONString) private function EscapeValue(const AValue: string): string; public constructor Create(const AValue: string); overload; end; var Form71: TForm71; implementation {$R *.dfm} constructor TSvJsonString.Create(const AValue: string); begin inherited Create(EscapeValue(AValue)); end; function TSvJsonString.EscapeValue(const AValue: string): string; procedure AddChars(const AChars: string; var Dest: string; var AIndex: Integer); inline; begin System.Insert(AChars, Dest, AIndex); System.Delete(Dest, AIndex + 2, 1); Inc(AIndex, 2); end; procedure AddUnicodeChars(const AChars: string; var Dest: string; var AIndex: Integer); inline; begin System.Insert(AChars, Dest, AIndex); System.Delete(Dest, AIndex + 6, 1); Inc(AIndex, 6); end; var i, ix: Integer; AChar: Char; begin Result := AValue; ix := 1; for i := 1 to System.Length(AValue) do begin AChar := AValue[i]; case AChar of '/', '\', '"': begin System.Insert('\', Result, ix); Inc(ix, 2); end; #8: //backspace \b begin AddChars('\b', Result, ix); end; #9: begin AddChars('\t', Result, ix); end; #10: begin AddChars('\n', Result, ix); end; #12: begin AddChars('\f', Result, ix); end; #13: begin AddChars('\r', Result, ix); end; #0 .. #7, #11, #14 .. #31: begin AddUnicodeChars('\u' + IntToHex(Word(AChar), 4), Result, ix); end else begin if Word(AChar) > 127 then begin AddUnicodeChars('\u' + IntToHex(Word(AChar), 4), Result, ix); end else begin Inc(ix); end; end; end; end; end; procedure TForm71.Button1Click(Sender: TObject); var LText, LEscapedText: string; LJsonString: TSvJsonString; LJsonPair: TJsonPair; LJsonObject: TJsonObject; begin LText := 'The price is £20.00'; LJsonString := TSvJsonString.Create(LText); LJsonPair := TJsonPair.Create('MyString', LJsonString); LJsonObject := TJsonObject.Create(LJsonPair); try LEscapedText := LJsonObject.ToString; showmessage(LEscapedText); LEscapedText := LJsonObject.ToJSON; showmessage(LEscapedText); finally LJsonObject.Free; end; end; end.