Jump to content

programmerdelphi2k

Members
  • Content Count

    1406
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by programmerdelphi2k

  1. programmerdelphi2k

    The problem of running the app on IOS

    ...CODE into create()...? what is?
  2. programmerdelphi2k

    The problem of running the app on IOS

    what is done (code) on DM.Create(...)?
  3. maybe some like this help you uses System.Generics.Collections, System.JSON; (* [ {"address": {"building": "1007", "coord": [-73.856077, 40.848447], "street": "Morris Park Ave", "zipcode": "10462"}, "borough": "Bronx", "cuisine": "Bakery", "grades": [....], // many sub-array here! "name": "Morris Park Bake Shop", "restaurant_id": "30075445"}, ... ] *) procedure TForm1.Button1Click(Sender: TObject); function MyFindValues(const AValue: TJSONObject; const AKey: string): string; var LJSONValue: TJSONValue; begin result := ''; // if (AValue <> nil) then begin LJSONValue := AValue.FindValue(AKey); // if (LJSONValue <> nil) then result := AKey + '=' + LJSONValue.ToString; // if another array... needs other approach! end; end; var LJSONValue: TJSONValue; LJSONArr : TJSONArray; begin Memo1.Lines.LoadFromFile('..\..\MyJSON.txt'); Memo2.Text := ''; // LJSONValue := nil; // try try LJSONValue := TJSONObject.ParseJSONValue(Memo1.Text); // or TJSONArray directly! // if (LJSONValue <> nil) then begin LJSONArr := TJSONArray(LJSONValue); // if (LJSONArr <> nil) then for var A in LJSONArr do begin Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'restaurant_id')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'name')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'cuisine')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'borough')); Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'address')); // array = sub-table = needs more iterations to extract items... Memo2.Lines.Add(MyFindValues(TJSONObject(A), 'grades')); // array = sub-table end; end; except on E: Exception do // generic ShowMessage(E.Message); end; finally LJSONValue.Free; end; end; initialization ReportMemoryLeaksOnShutdown := true; end.
  4. programmerdelphi2k

    Send message frmo VCL app to another machine in lan

    Malcolm Groves explains with details about Tethering usage to create your apps communications on network (be the same or not), I think that solve your problem! At end, the TCP/UDP is used on behind scenes! and Observer Pattern is used to subscribes all members! http://www.malcolmgroves.com/blog/?p=1842
  5. programmerdelphi2k

    Conversion between Markdown and HTML

    did you know? (I dont use it) https://convertio.co/document-converter/ https://developers.convertio.co/
  6. try this StackOverFlow: some like this, maybe a "recursive" function .... https://stackoverflow.com/questions/46534011/delphi-parse-json-array-or-array function getData(JsonString: String; User: String; Field: String): String; var JSonValue: TJSonValue; JsonArray: TJSONArray; ArrayElement: TJSonValue; FoundValue: TJSonValue; begin Result :=''; // create TJSonObject from string JsonValue := TJSonObject.ParseJSONValue(JsonString); // get the array JsonArray := JsonValue as TJSONArray; // iterate the array for ArrayElement in JsonArray do begin FoundValue := ArrayElement.FindValue(User); if FoundValue <> nil then begin Result := ArrayElement.GetValue<string>(User + '.' + Field); break; end; end; end;
  7. first you need organize your JSON text: many "arrays with sub-arrays..." your JSON needs some adjusts...: [ {...}, {...}, ... ]
  8. programmerdelphi2k

    Form ObjectAtPoint() does not working or "me" not working :)

    I can not "have" HitTest defined, at all! I need pass over it
  9. programmerdelphi2k

    Form ObjectAtPoint() does not working or "me" not working :)

    nope!
  10. programmerdelphi2k

    The problem of running the app on IOS

    uses uDMMain; var MyDM_on_Init_Section: TMyDataModule; // You wouldn't need this variable if you were going to use the global var "MyDataModule" procedure TForm1.FormCreate(Sender: TObject); begin // using global "var" on "uDMMain.pas" MyDataModule := TMyDataModule.Create(nil); // called: 2º // if (MyDM_on_Init_Section <> nil) then // accessing objects from "MyDM_on_Init_Section" MyDM_on_Init_Section.FDConnection1.LoginPrompt := false; end; procedure TForm1.FormDestroy(Sender: TObject); begin // try comment this lines... MyDataModule.Free; // called: 3º MyDataModule := nil; // avoid "AV" on "finalization section"... "Free" dont release pendent pointers on memory! end; initialization MyDM_on_Init_Section := TMyDataModule.Create(nil); // called: 1º finalization MyDM_on_Init_Section.Free; // called: 4º // if (MyDataModule <> nil) then // if on memory and "valid object"... MyDataModule.FDConnection1.LoginPrompt := false;
  11. programmerdelphi2k

    The problem of running the app on IOS

    Debug works only when a "code" do sense, or be, the "code" is used in any place on project. Else, the compiler ignore it!
  12. programmerdelphi2k

    The problem of running the app on IOS

    Hi @Dave Nottage as always... nobody try "the basic": an empty project deployed avoid so much doubts!!!
  13. programmerdelphi2k

    New Installation of Rad Studio 10.2 (Tokyo)

    RAD backup doesnt works, because your license will be verifyed by Embarcadero when online (maybe some checksum), and, YOU will need backup your REGISTRY with all Embarcadero keys in HCU and HLM!!! then, in your new RAD "re-install/COPY" your MSWindows Registry should receive old-registry-Embarcadero keys backup-ed! -> do it run? now, if using a VM to install your RAD, you can do it! but maybe you have some problem with mobile development/external hardware...
  14. programmerdelphi2k

    The problem of running the app on IOS

    verify if any component is trying access your database - verify DB connection if true on design-time or in some place? it's preferable dont create all forms/datamodules automatically! try create it after main-form on memory!
  15. programmerdelphi2k

    New Installation of Rad Studio 10.2 (Tokyo)

    If your license is allowed have +1 installation, then you can try "delete" all Embarcadero folders to start from begin! -- it's better than reinstall MSWindows! 🙂 uninstall it at first, of course! RAD Studio store your license info and others in c:\ProgramData\Embarcadero (including 3 folders with names using "GUID" format) - normally, 3 first subfolders on \ProgramData in "c:\User\<<win user>>\AppData\Local" and "\Roamming" you'll have the IDE config files after your first load It's preferable install it using ISO to avoid any problem with Embarcadero connection! reserve some like "60GB - 100GB" to installation, after this, you can delete all residual files!
  16. programmerdelphi2k

    D11.2 + FireDAC + MySQL 64 bit not working

    if libcrypto-1_1-x64.dll, libssl-1_1-x64.dll not found show this msg! https://docwiki.embarcadero.com/RADStudio/Sydney/en/Connect_to_MySQL_Server_(FireDAC)
  17. programmerdelphi2k

    D11.2 + FireDAC + MySQL 64 bit not working

    my test using MySQL 8.0.26 Community + RAD 11.2 Alexandria + FireDAC + LibMySQL.dll (libcrypto-1_1-x64.dll, libssl-1_1-x64.dll) (64bits) + App in 64bits NONE DLL on \Windows\SystemXXXX NONE PATH MySQL defined NONE FDDrivers.ini definition! just default by RAD [FDDrivers.ini] Encoding=UTF8 LibMySQL.DLL, libcrypto-1_1-x64.dll, libssl-1_1-x64.dll on exe folder procedure TForm1.Button1Click(Sender: TObject); begin FDPhysMySQLDriverLink1.VendorLib := 'libmysql.dll'; // FDConnection1.Open; if FDConnection1.Connected then begin FDQuery1.Open('select * from customers'); end else ShowMessage('not connected') end; Tip: RAD Studio IDE works in 32-bit, that is why it cannot connect with MySQL 8.0, wich is only available in 64-bit. To avoid this connection issue you can use MySQL 5.7.29, which is the most recent 32-bit version of MySQL.
  18. programmerdelphi2k

    Open AI Chat

    comparing Earth x Mars x Sun: Earth: blue Mars: red Sun: yellow
  19. programmerdelphi2k

    Is there a program for Converting from VCL to FMX?

    in the end, basically, all will be a "find(s) and replace(s)"... and YOU'll have that code it!
  20. programmerdelphi2k

    Adding items to ListView

    ok
  21. programmerdelphi2k

    Open AI Chat

    maybe was better forget Delphi and go back to Basic on CP500? Not? 😋
  22. programmerdelphi2k

    Is there a program for Converting from VCL to FMX?

    in fact, not! because exists many differences between it. then, you always will have code it. in RAD you can find "reFind.exe" that allow "replace" occurrences by other, but you need create your script manually
  23. programmerdelphi2k

    Adding items to ListView

    you cannot use TListIem.Create in FMX. You should use var LVItem: TListViewItem; begin LVItem := ListView1.Items.Add; LVItem.Text := 'hello'; end;
  24. programmerdelphi2k

    Adding items to ListView

    Vcl.ComCtrls; type TForm1 = class(TForm) ListView1: TListView; procedure FormCreate(Sender: TObject); ... implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var MyListItem: TListItem; // VCL begin MyListItem := ListView1.Items.Add; MyListItem.Caption := 'hello'; end; end.
×