ertank
-
Content Count
233 -
Joined
-
Last visited
Posts posted by ertank
-
-
Thank you to all.
My request to have access to problematic computer will not be possible until March 15 due to Covid-19 close down.
I will be able to do further analysis after I do have access.
-
I just read it. Thanks for sharing.
It seems similar. But, in this thread, code continues and not hangs like in my case. If I had same problem, thread would terminate without clock being synced. My problem is thread not terminating.
One additional information I should share is that procedure is threaded using ITask like below.
uses System.Threading, uUtils.Log; procedure TForm2.FormCreate(Sender: TObject); var Task: ITask; begin Log('Creating thread'); Task := TTask.Create(SetSystemTime); Task.Start(); Log('Thread started'); end; procedure TForm2.IdSNTP1Connected(Sender: TObject); begin Log('SNTP Connected'); end; procedure TForm2.IdSNTP1Disconnected(Sender: TObject); begin Log('SNTP Disconnected'); end; procedure TForm2.IdSNTP1Status(ASender: TObject; const AStatus: TIdStatus; const AStatusText: string); begin Log('SNTP status: ' + AStatusText); end; procedure TForm2.SetSystemTime(); var Sntp: TIdSNTP; begin Log('SetSystemTime(): System clock sync starting'); Sntp := TIdSNTP.Create(nil); try Sntp.OnConnected := IdSNTP1Connected; Sntp.OnDisconnected := IdSNTP1Disconnected; Sntp.OnStatus := IdSNTP1Status; Sntp.Host := 'pool.ntp.org'; Sntp.ReceiveTimeout := 2000; try Log('SetSystemTime(): Running actual time sync...'); Sntp.SyncTime(); Log('SetSystemTime(): System clock sync completed'); except on E: Exception do begin Log('SetSystemTime(): ' + E.Message); end; end; finally Sntp.Free(); end; Log('SetSystemTime(): Done'); end;
That code sample is from a project that I am preparing with detailed logging to help identifying the problem.
That code running on my system produces with following lines:
2021-01-20 14:56:58.949 Creating thread 2021-01-20 14:56:58.952 Thread started 2021-01-20 14:56:58.953 SetSystemTime(): System clock sync starting 2021-01-20 14:56:58.953 SetSystemTime(): Running actual time sync... 2021-01-20 14:56:59.067 SetSystemTime(): System clock sync completed 2021-01-20 14:56:59.068 SetSystemTime(): Done
As you can see, there is no connection or disconnection here. Problem might be privilege but, this should not hang whole thread and should just exit from it.
BTW, I just learned (by chance talking to a colleague) that problem occurs only on Windows 10 OSes and not on Windows 7 or Windows XP.
-
I forgot to mention in my initial post that I have already tried to change ReceiveTimeout to 2000 with no success. Sorry about that.
Since ReceiveTimeout did not work that makes me believe there is a kind of a problem like privilege or initial connection. I do not know though. I cannot access to computers in that location for better understanding.
-
Hello,
I have following code running in a thread when application starts.
procedure TMainForm.SetSystemTime(); var Sntp: TIdSNTP; begin Sntp := TIdSNTP.Create(nil); try Sntp.Host := 'pool.ntp.org'; try Sntp.SyncTime(); except // eat exception, we are in thread end; finally Sntp.Free(); end; end;
When there is no internet connection, thread above code runs is never terminated. I could not find some connection timeout setting for IdSNTP.
Is there any other way to terminate Sntp.SyncTime() if it is not completed for a certain period of time like 10 seconds.
There is a location with a corporate firewall (with some weird settings I believe) where check for an internet connection is true, but above code still hangs.
Thanks & Regards,
Ertan
-
I did add private key certificate as a resource as I tried to explain in my initial post.
I did deploy my security config "network_security_config.xml" under "res\xml" in project Deployment. Sorry, forgot to mention that in detail.
BTW, I am not trying to deploy my app in Play Store. Just trying to deploy it with my self signed HTTPS certificate.
-
Hello,
I have my HTTPS proxy for my HTTP REST server. Both running on my development computer.
I setup HTTPS proxy following instructions here: https://twigstechtips.blogspot.com/2016/01/nginx-how-to-set-up-ssl-reverse-proxy.html
These instructions makes you generate two certificate files. KEY and PEM files. I added that PEM file in my project resources as resource type RCDATA and used identifier "my_ca".
I used below link to prepare my security config xmlhttps://stackoverflow.com/questions/56301765/self-signed-certificate-in-android-application-of-rad
Using "@raw/my_ca" as in that stackoverflow question is failing with below error (while packaging the app) when I try to debug run the app.
network_security_config.xml:6: error: Error: No resource found that matches the given name (at 'src' with value '@raw/my_ca/')
So, I prepared my XML file as following:
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <domain includeSubdomains="true">yourdomain.com</domain> <trust-anchors> <certificates src="my_ca"/> </trust-anchors> </domain-config> </network-security-config>
When I try to access my REST server like https://192.168.1.152/...
I get following error
Failed to parse XML configuration from network_security_config
On the other hand, I can get results just fine using identical URL and Postman on Windows OS.
I simply failed to figure how to add that self signed certificate in my app package and use it.
Any help is appreciated.
Thanks & Regards,
Ertan
-
I did not do that. This is what I suspect reading e-mails sent from Embarcadero.
-
Assuming you are actually using CE version mainly.
You are excited about new 10.4 features and wanted to see them at first hand. So, you installed it on your computer for trial.
You uninstalled 10.4 from your computer before the end of trial period (or after, or keeping it without using).
At that point, I suspect, Embarcadero puts you (your e-mail address and relevant account linked to your CE license) in "not eligible for CE anymore" list.
Hence the e-mail messages received.
I wonder if that theory is correct for people having problems updating their CE licenses.
-
Hello,
I am using Delphi 10.3.3 and trying to consume a SOAP web service method.
Wsdl that I need to use is below:
https://dev.gittigidiyor.com:8443/listingapi/ws/IndividualSaleService?wsdl
Delphi 10.3.3 successfully imports that wsdl page. Imported unit generates an output XML for "getPagedSales" method as following (included only relevant parts of XML):
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <getPagedSales xmlns="http://sale.individual.ws.listingapi.gg.com">
When same wsdl is imported using SOAP-UI application, generated sample request output starting as following:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sale="http://sale.individual.ws.listingapi.gg.com"> <soapenv:Header/> <soapenv:Body> <sale:getPagedSales>
If you look closely and compare both, the SOAP-UI generated XML, envelope has "sale" in it as well as method name is put after "sale".
My problem is that web service is not accepting Delphi request and returning an error as following:
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Header/> <env:Body> <env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <faultcode>env:Client</faultcode> <faultstring>Endpoint {http://application.anonymous.ws.listingapi.gg.com}ApplicationServicePort does not contain operation meta data for: {http://sale.individual.ws.listingapi.gg.com}getPagedSales</faultstring> </env:Fault> </env:Body> </env:Envelope>
My question is: Is it possible to modify wsdl imported unit in a way so that out of the box SOAP adds that "sale" in relevant places of requests not just for getPagedSale mothod, but for all sale service methods?
I know it is possible to use THTTPRIO.OnBeforeExecute() and send identical XML to that of SOAP-UI generated (which web service will be accepting). However, I am just trying to avoid that if it is possible.
Thanks & Regards,
Ertan
-
23 hours ago, Kas Ob. said:@stijnsanders That is beauty, one small step though is missing though, and it will not help the OP in his question, no IV or block modes, and i don't think Soji can add those on his own, the most beautiful thing in your library is the clean code and uses clause.
@Ondrej Kelle I know CryptoLib4Pascal for long time but never used it, it is great, now i was browsing the code one thing caught my eye, i think the PKCS7 padding is wrong, as it does accept 0 byte padding and it should not, in other words you should never end up with a byte value 0 at the end, if the length of data is multiple of k then you go and add full block, i think the relation between these should be redesigned:
TPaddedBufferedBlockCipher.DoFinal // does call AddPadding without handling the return value that is not a big deal, but FbufOff should be [1..k] and should never be 0, from https://tools.ietf.org/html/rfc5652#section-6.3
TPkcs7Padding.AddPadding // don't check if inOff is 0
Also i tried to run the tests and play with it, but that package is missing a file HlpIhash, either that or i am missing something.
I hope @Ugochukwu Mmaduekwe can make some comments about PKCS7 padding here.
I have all below repositories and do not have problem with compilation etc. HlpIhash is part of HashLib4Pascal
https://github.com/Xor-el/CryptoLib4Pascal
https://github.com/Xor-el/HashLib4Pascal
https://github.com/Xor-el/SimpleBaseLib4Pascal
-
While trying to prepare minimal reproduction I realize that there is an "else" exists above some explanatory remark lines and my Request variable assignment comes next.
Turned out my mistake of leaving an else that should have been deleted at the first place.
if TokenExpireTime <> 0 then begin // some other stuff with begin..end blocks end else // problem source line // some remark // another remark // more remark Request := '{"appKey":"' + AppKey + '","secretKey":"' + SecretKey + '"}';
It turned out that Request is conditionally filled in if no line above.
Sorry about all the fuss and thanks to all.
-
I just installed and tried madExcept. It doesn't report any buffer overflow or underflow (tried both). Though, there are some leaks reported like Mutex Handle, TCriticalSection, TIdThreadSafe. First one is my code in DPR file, last two being in the initialization sections of relevant units. It was interesting to have leak report even FastMM4 is not reporting any.
Unfortunately, I failed to find a corruption using madExcept. I think is is harder to identify than I think it is.
Thanks.
-
25 minutes ago, Kryvich said:Try remove const in the header of function Login.
That did not help.
-
5 hours ago, FPiette said:Request is a local variable and the way you initialize it is perfectly correct. Each time Login() is called, you get a new variable (on the stack) which is initialized. If this doesn't work, then there is something elsewhere corrupting memory. That will be difficult to find. Especially for us which have no view on your code.
I do have FastMM4 full debug open and it does not report a leak. I do not know if it also reports for corruptions though. Are there any hints/suggestions to search for such corruptions?
-
Hello,
First of all, I am not experienced about technical details of variable initialization and such.
I am using Delphi 10.3.3 and targeting Win32 executable.
I am running multiple threads in my application. One of the threads is making rest web service calls. Other does SOAP web service calls. Below unit is only used by rest web service thread and that thread only.
Rest web service requires me to do logins for every 60 minutes. Problem appears at the second hour. Login requests sent as empty strings. I am sharing only relevant lines (timeout calculations, logging etc are not included below for simplicity):
unit MyRestUnit; function Login(const AppKey, SecretKey: string): Boolean; implementation function Login(const AppKey, SecretKey: string): Boolean; var Request: string; Response: string; begin if AppKey.IsEmpty then Exit(False); if SecretKey.IsEmpty then Exit(False); Request := '{"appKey":"' + AppKey + '","secretKey":"' + SecretKey + '"}'; if uUtils.Http.PostIndy(URL, Request, Response) then // Rest of the function code is irrelevant end;
Code is just as in above. Request is filled in and HTTP request is made.
However, Request variable is filled in for the first time function is used. It is always becoming empty for the remaining calls. My log files says application is actually sending empty request bodies. Rest web service response error also confirms that. No garbage characters just empty.
If I use debug run (F9) and check variable value at run time. It holds proper value for first call, second and following calls it is always empty. Same problem exists for Release build and Debug build.
Only way I could make it always work is changing above code to something like below
Request := EmptyStr; Request := '{"appKey":"' + AppKey + '","secretKey":"' + SecretKey + '"}';
I tried to use different local variable names (more than one) to rule out possible name collision and it still does not work for second calls to function, unless I first make it EmptyStr.
It is also interesting that I do not get any compile time hint/warning like "value assigned is not used" or similar for my second example above. I have all hints and warnings turned on in my project.
My internet searches did not result in something meaningful to me.
My question is: Why first example does not work for the second and following calls?
Asking in here because I could not find an explanation at all and I am really curious as to why. Moreover, that is the first time I am facing such a problem.
Thanks & Regards,
Ertan
-
You can use MARS with Community Edition.
Some examples depend on some FireDAC units which belong to higher edition.
- 1
-
Hello,
I have orders and orderdetails tables. There is one method that should be returning several orders when used. I would like to return a json string to such requests as in following example
{ "orders":[ { "id":1234, "date":"2020-05-29", "details":[ { "item":"1", "amount":3 }, { "item":"5", "amount":2 }, { "item":"116", "amount":1.3 } ] } ] }
I know that I can define method to return a TJsonObject and build json piece by piece in method code. However, I would like to avoid that, if possible. I wonder if there is/are some other ways of doing so in MARS.
Thanks & regards,
Ertan
-
-
Actually, there is a new version released 5.0.1 which also fixes problem of opening tables with lowercase letters.
- 1
-
Even it is not just for REST, you can write your own interface based methods and use mORMot as a REST server.
Learning curve might be slower compared to some other options. However, it does run from Delphi 6 to Delphi 10.3.3 and has Linux support using Lazarus+FPC.
There is no SOAP support as to my knowledge.
- 2
-
If you have the option to choose REST only then you might really would like to consider MARS Curiosity.
Edit: Just checked GitHub and it seems no packages exists for Delphi 2007.
- 2
-
You did not run Delphi.
You did not install any kind of plug-in or component.
Only thing left is OS itself. Something must have been changed in your system that affects Delphi license.
You can try to remember if you did some kind of "restore" or system change (computer name or alike) or hardware change during last week.
You can also look for a "cleaning tool" or similar in the system and disable it for a while just for ruling out that possibility.
-
4 hours ago, Kryvich said:It's impossible. 1 year is the maximum license term for CE license.
Actually it is possible. License days start counting down from the day you activate it for the first time.
Moreover, if you register and get a free license today it will have 366 days left.
-
I am using Delphi 10.3.3 Community Edition right now.
I did have license failure just once for a Community Edition. It was after I changed computer name of Windows.
I do not remember having frequent IDE crashes at all.
FirebirdSQL client library parameter in INI
in MARS-Curiosity REST Library
Posted
Hello,
I am trying to provide client library for FirebirdSQL database connection for a MARS-Server project. I tried a few different INI parameters, all failed including second line below
I wonder what I should be using to be able to use a fbclient.dll in another directory than the EXE file.
Thanks & Regards,
Ertan