Jump to content

amit

Members
  • Content Count

    30
  • Joined

  • Last visited

Everything posted by amit

  1. I try to retreive the data from JSON string that return from the server. Here is the JSON String {"RESULT":200, "IDLIST":[1,2,3,4,5]} I wrote delphi code as shown below to get the Array but it return empty string. var jso: TJsonObject; jsv: TJsonValue; s, RetResult, RetIDList: string; begin s := '{"RESULT":200, "IDLIST":[1,2,3,4,5]}'; jso := TJsonObject.ParseJSONValue(s) as TJsonObject; jsv := jso.GetValue('RESULT'); if jsv<>nil then RetResult := jsv.Value else RetResult := ''; // <-- this is OK. RetResult will be '200'. jsv := jso.GetValue('IDLIST'); if jsv<>nil then RetIDList := jsv.Value else RetIDList := ''; // <---I alway get the empty string for RetIDList. end; I try to use jsonpair instead with the code below. I will get the array string. var jso: TJsonObject; jsv: TJsonValue; jsp: TJsonpair; s, RetResult, RetIDList: string; begin s := '{"RESULT":200, "IDLIST":[1,2,3,4,5]}'; jso := TJsonObject.ParseJSONValue(s) as TJsonObject; jsv := jso.GetValue('RESULT'); if jsv<>nil then RetResult := jsv.Value else RetResult := ''; // <-- this is OK. RetResult will be '200'. for iJsonPair in jso do begin if (iJsonPair.JsonString.value = 'IDLIST') then begin RetIDList := iJsonPair.JsonValue.ToJson; // <-- This is OK. RetIDList wlll be '[1,2,3,4,5]'. // RetIDList := iJsonPair.JsonValue.Value; // <-- if I use this line instead I got empty string; break; end; end; end; Why? What is the different between iJsonPair.JsonValue.ToJson and iJsonPair.JsonValue.Value ?
  2. How to determine whether 32 or 64 bits Firebird was installed on PC? Is there any Delphi Code sample for this?
  3. I compile and run the Application from the IDE, it works fine. When I run it by double click on the application file it give me the Runtime Error 217 at 0142EA7C. I try searching for solution on internet and follow the suggestion but it didn't work at all. sfc /scannow dism.exe /Online /Cleanup-image /Restorehealth Any suggestion are appreciated ,
  4. Hi Roger Cigol, English is not my daily use language. I'm not good at English so I'm sorry if it make you confuse about my question. I try to explain as much as I can. I attached 4 pictures to show what I'm trying to explain my question. Problem is 1. All customstyles that applied to all components will not shown properly when compile with Enable Skia. Application can be run from Windows Explorer and under the IDE. 2. If Compile with disable skia, the application can be run under IDE only with properly customstyles display. But the application cannot run from Windows Explorer and it will always give the runtime error 217.
  5. It is FMX application on Windows. Now I found the problem. I used Skia (TSkAnimatedImage) on the form. I run this code under the IDE without Enable Skia, it works without problem but not running directly on the output application. So if I Enable Skia and compile, it works both on the IDE and output application. But I found another problem, all FMX styles that I applied to many components were lost. Can you help solving this problem or I should not use Skia, and find the other animatedImage Component instead?
  6. Follow the suggestion from programmerdelphi2k, I finally found all New Comboboxes or Listboxes will be got effect on new Text Size and Color settting in ListboxItemStyle. It is global effect to all components that Listboxes associated with. I try to rename listboxItemStyle to cboListboxItemStyle in Edit Custom Style and save, then all comboboxes and Listboxes were reset to default no style applied to them. So I try to apply the cboListboxItemStyle during runtime using this code but it has no effect. for var i: integer := 0 to (ComboBox1.Count - 1) do begin ComboBox1.ListItems[i].StyleLookup := 'cboListboxItemStyle'; end; So it seems combobox.listbox were fixed to ListboxItemStyle only. It cannot be customized. I need to know if there is a way to individually customize combobox and listbox.
  7. I have strings in the TStringlist as follows ABC10 ABC1 ABC2 ABC21 I sort it using TStringlist.sort then I got the sorted result as ABC1 ABC10 ABC2 ABC21 But I need to have the results after sort as follows ABC1 ABC2 ABC10 ABC21 Is it possible to do that?
  8. Hi, I created project name A. When I compile project I will get name A.exe. I need to define some directive in source code and it will change the output application name when it was compiled. if it's possible to do that and how? for example Program A; {$DEFINE B} ... begin .. end. if I code it like this. I need to have B.exe or AB.exe instead of A.exe when it was compiled.
  9. I want to use TIdHttp or THTTPClient to send this following curl command. curl -X POST https://notify-api.line.me/api/notify -H "Authorization: Bearer U4314taadsffhjjjjykllFVissffdfssdfsdfsgfgz" -F "message=abcTest" -F "stickerPackageId=1" -F "stickerId=113" -F "imageFile=@D:/mypic.jpg" Could you please help me convert this command to Delphi Code using indyhttp or THttpClient?
  10. I mean to determine its version by Delphi Code.
  11. Delphi IDE editor is used for a long time but it will not support well in my Language. I need to know if it will have any chance to improve the IDE Editor to support more fonts. As you can see in the attach picture compare between VS Editor and Delphi IDE Editor. Is there any trick to make delphi IDE work with other fonts than it provided?
  12. I can use Mutex to prevent multiple instances app in VCL mode. How to Prevent Multiple Instance Application Running in FMX?
  13. How to change Comport Name for example from COM1 to COM10? Msports.dll contains functions concern to work on assigning the comport but I don't know how to call those functions. Please suggest how to write Delphi code to do this task.
  14. I still be able to download if I had login.
  15. HI Remy, I wonder why it can be used on my development PC but not on the target PC. I got this error on the Target PC - EIdOSSLCouldNotLoadSSLLibrary: Could not load SSL library. I knew it concerned to SSL libeay32.dll and ssleay32.dll. I copied it to the application folder but it still have this error. Can you suggest what should I do?
  16. amit

    TIdHTTP to TNetHTTPRequest

    Dear Remy, Are these CredentialStorage and AuthEvent limited to only Basic Authentication? Is there any processing different among using CustHeaders and the methods you suggested? And many thanks for your suggestion.
  17. Sample code for someone who need to work on JSON. JsonDemo.rar
  18. amit

    TIdHTTP to TNetHTTPRequest

    Just try and let me know if it works. uses ..., System.NetEncoding, ... ... var Base64: TBase64Encoding; httpClient: THttpClient; ... begin ... httpClient.ContentType:='application/xml'; Base64 := TBase64Encoding.Create; httpClient.CustHeaders.add('Authentication','Basic ' + Base64.Encode('user:password')); Base64.Free; httpClient.CustHeaders.Add('OrganisationId', 'your dm.Company'); httpClient.CustHeaders.Add('Accept', 'application/xml'); httpClient.Post('your URL',xmlData); ... end;
  19. Thank you Remy. I had created the indy version before you reply. in my version, I did not include IdSSLOpenSSL unit in uses clause and no SSL as shown in your code. However, it works. I just wonder if I should use SSL as you suggested. I'm not sure if I did not use it, it may have problem sometime or not.
  20. Now I knew how to use TIdHttp and THttpClient instead of TRESTClient. For Indy TidHttp, use TIdMultiPartFormDataStream for adding all Parameters. For THttpClient, use TMultipartFormData for adding all Parameters Uwe Raabe, Thank for all helps.
  21. I wonder what is the equivalent command for TIdHTTP and THTTPClient if they were used instead of TRESTClient. request.AddParameter('message', 'abcTest', pkREQUESTBODY); request.AddParameter('stickerPackageId', '1', pkREQUESTBODY); request.AddParameter('stickerId', '113', pkREQUESTBODY); request.AddParameter('imageFile', 'D:\mypic.jpg', pkFILE);
  22. I limit the data send to server at 25 records at a time. Anyway I wonder how I can make sure that the server can successfully insert the whole data on the database without returning the successfully inserted ID. if I just check only the http status 200 returned, I knew only that the server successfully received the whole json string but it is not guarantee that the whole data are inserted successfully on the database. In my server code, I return just only the successfully inserted record IDs, the problem ones will not be returned. The client will update the sentflag on any records that ID are in the RetIDList. So on the next data send phase, the problem ones can be sent again. Is there any other way to check whether there is no problem at all on the server side? Please suggest. Thank you. Oh another thing the IDs that send to the server in Json string is the ID of the records in database's table in the client PC and it will never be inserted to the Server's database for any reference. They will be used for server to reply back to the client if they are inserted succesfully. Client will mark those records by setting sentflag so no need to resend them.
  23. I want to use them to construct the SQL to update record flag in SQL table. The Bracket in the RetIDList will be romoved and finally the RetIDList will be '1,2,3,4,5'. Then I will create Update SQL as qry.SQL.clear; qry.SQL.add('Update Table1 Set Flag=0 where ID in ('+RetIDList+');'); qry.ExecSql; Anyway, if you can point me how to access IDLIST as an array of integer it will be OK. I can generate the SQL from that array.
  24. I had created the report in Quality Central already ( RSP-32335 ). I also attached your Project1.dpr with the report.
×