Jump to content

Keesver

Members
  • Content Count

    95
  • Joined

  • Last visited

  • Days Won

    2

Keesver last won the day on February 10 2024

Keesver had the most liked content!

Community Reputation

25 Excellent

Recent Profile Visitors

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

  1. For the original QuickJS, this makefile seems to work: CC = i686-w64-mingw32-gcc-posix CFLAGS = -O2 -fPIC -Wall -D_GNU_SOURCE -DCONFIG_VERSION=\"V16\" LDFLAGS = -static -shared -lpthread SRC = quickjs.c libunicode.c libregexp.c cutils.c dtoa.c quickjs-libc.c OBJ = $(SRC:.c=.o) all: quickjs32.dll quickjs32.dll: $(OBJ) $(CC) $(LDFLAGS) -o $@ $^ clean: rm *.o *.dll But this requires the POSIX version of gcc which can be insalled in Ubuntu using: sudo apt install gcc-mingw-w64-i686 This compiler supports the POSIX threading functions required by QuickJS.
  2. With a little help of ChatGpt: CC = i686-w64-mingw32-gcc CFLAGS = -O2 -fPIC -Wall -D_GNU_SOURCE -DCONFIG_VERSION=\"V16\" LDFLAGS = -static -shared SRC = quickjs.c libunicode.c libregexp.c cutils.c xsum.c quickjs-libc.c OBJ = $(SRC:.c=.o) all: quickjs32.dll quickjs32.dll: $(OBJ) $(CC) $(LDFLAGS) -o $@ $^ clean: rm *.o *.dll Just tested it, this makefile works when run from Linux under WSL (I'm not using Windows as using WSL works really well)
  3. One of the reasons behind QuickJS-ng was to make it compatible with CMake and Windows (see this page: Building | QuickJS-NG). It is actively maintained but is still close to the original source made by Fabrice.
  4. We are actively using and developing an QuickJS integration with Delphi. Works brilliantly (QuickJS that is). I can give you support with the compiling of the code. Currently we are using QuickJS-ng (GitHub - quickjs-ng/quickjs: QuickJS, the Next Generation: a mighty JavaScript engine) but this code is still close to the original version made by Fabrice Bellard. For the compilation, we use Linux (running under WSL) and the right compilers (ChatGpt is your friend here). Anyway this MakeFile works for us (save it to MakeFile_Win64): CC = x86_64-w64-mingw32-gcc CFLAGS = -O2 -fPIC -Wall -D_GNU_SOURCE -DCONFIG_VERSION=\"V16\" LDFLAGS = -static -shared SRC = quickjs.c libunicode.c libregexp.c cutils.c xsum.c quickjs-libc.c OBJ = $(SRC:.c=.o) all: quickjs64.dll quickjs64.dll: $(OBJ) $(CC) $(LDFLAGS) -o $@ $^ clean: del *.o *.dll Then run: make -f MakeFile_Win64 (this requires QuickJS-ng, for QuickJS you need to change the listed source files a little) If you need updated pascal files, you can checkout this repo: https://github.com/a-dato/quickJS-Rtti.git.
  5. Yes, I understand. Our software is built using Delphi and we have all the components needed to create professional PM software with Gantt's, Pert, scheduling and more. We have been selling such components since '96 but left the supplier market some time ago. However we are still open to supply these components to other Delphi developers. How? That needs to be discussed. Please send a message to the mail address provided, I can show you what we have.
  6. Hello Chris, We have such components, both for VCL and FMX. You can contact us at kees[dot]vermeulen[at]a-dato[dot]net if you are interested. We are the supplier of Lynx, a project management application that's supports such functionality (see our website: www.a-dato.com). Greetings, Kees Vermeulen
  7. Keesver

    How can you list all the datasources linked to a dataset?

    Thanks, learned something new!
  8. Keesver

    How can you list all the datasources linked to a dataset?

    As a last resort you can define your own TDataset type with a public 'FDatasource' member and then cast the TDataset to this type. Design wise this is a clear 'hack' but it will do the job: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Datasnap.DBClient, Vcl.StdCtrls, System.Generics.Collections; type TForm1 = class(TForm) ClientDataSet1: TClientDataSet; Button1: TButton; DataSource1: TDataSource; DataSource2: TDataSource; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; THackedDataSet = class(TComponent) public FFields: TFields; FAggFields: TFields; FFieldDefs: TFieldDefs; FFieldDefList: TFieldDefList; FFieldList: TFieldList; FDataSources: TList<TDataSource>; end; PHackedDataSet = ^THackedDataSet; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin var ds := PHackedDataSet(@ClientDataSet1)^; ShowMessage(ds.Name); for var src in ds.FDataSources do ShowMessage(src.Name); end; end.
  9. Keesver

    New to Delphi and to the forum - with questions

    For the diagrams: take a look at Graphviz. This is an open source project with a lot of traction. It works like an engine, you pass your data to the 'engine' and get a description of the diagram in return. The 'description' can be an SVG document that you can display using a browser or it can be a json document that you parse in your code and paint onto a canvas. The engine can be a dll, executable or external service. Graphiz can handle a many different diagrams.
  10. Keesver

    More Powerful Grid

    Please check out a-dato/FMX-GRID: This library includes visual grid control, data models, binding system. Data models are extendible at runtime so that users can add/remove properties from objects. I can share a link to our demo application so that you can test it yourself.
  11. Keesver

    Putting Delphi Application inside web page

    We are also a satisfied user of Thinfinity. We have a 40 user license and run 2 VM's behind a gateway (also part of Thinfinity). Works pretty good. Support is good. Pricing is ok, especially since users are counted as 'concurrent' users (as opposed to named users).
  12. Hello, I learned something new as I didn't know such types do not have RTTI. Any property of such type is hidden when you try to get the properties from a object. This makes it impossible to do automatic marshaling. Delphi does support custom marshalling using TJSONMarshal (Serializing User Objects - RAD Studio (embarcadero.com)) that allows registration of marshaling functions: procedure RegisterConverter(clazz: TClass; const func: TTypeObjectConverter); Another option would be to add attributes to your classes to identify these properties and then write your own marshaller that looks at these attributes: Something like this should work: TEnum1 = (Value1=20, Value2=40); TEnum1Helper = record helper for TEnum1 function ToString() : string; end; [TJsonEnumproperty('En', UnmarshalFunc, MarshalFunc)] TObjectWithhEnum = class private _id: Integer; _en: TEnum1; published property ID: Integer read _id write _id; property En: TEnum1 read _en write _en; end; Your marshal method then looks at the attributes defined for the class and then call the MarshalFunc/UnmarshalFunc. Alternatively you can use interfaces to achieve the same. ICustomMarshalling = interface ['{E799D069-66B8-464D-B718-78D5D4DB6747}'] procedure Marshal(M: TJsonMarshal); procedure UnMarshal(M: TJsonUnMarshal); end; TObjectWithhEnum = class(TObject, ICustomMarshalling) private _id: Integer; _en: TEnum1; proteced procedure Marshal(M: TJsonMarshal); procedure UnMarshal(M: TJsonUnMarshal); published property ID: Integer read _id write _id; property En: TEnum1 read _en write _en; end; In this scenario your custom marshaller checks if your class implements the ICustomMarshalling interface and calls the appropriate methods. Like to see what solution you come up with...
  13. You can encode the image using Base64 encoding. ChatGPT came up with this sample code. Calling TNetEncoding.Base64.EncodeBytesToString(Bytes) will do the actual conversion: uses System.JSON, System.SysUtils, System.Classes, System.NetEncoding; function ImageToBase64(const FilePath: string): string; var FileStream: TFileStream; Bytes: TBytes; begin FileStream := TFileStream.Create(FilePath, fmOpenRead); try SetLength(Bytes, FileStream.Size); FileStream.ReadBuffer(Pointer(Bytes)^, FileStream.Size); Result := TNetEncoding.Base64.EncodeBytesToString(Bytes); finally FileStream.Free; end; end; procedure SaveImageBase64ToJson; var JSONObject: TJSONObject; Base64String: string; JSONString: string; JSONFile: TStringList; begin Base64String := ImageToBase64('path/to/image.jpg'); JSONObject := TJSONObject.Create; try JSONObject.AddPair('name', 'Example Image'); JSONObject.AddPair('image_data', 'data:image/jpeg;base64,' + Base64String); JSONString := JSONObject.ToString; JSONFile := TStringList.Create; try JSONFile.Text := JSONString; JSONFile.SaveToFile('image_base64.json'); finally JSONFile.Free; end; finally JSONObject.Free; end; end;
  14. Keesver

    Flow Chart Software??

    Graphviz
  15. This problem has more side effects than expected, after moving a form to a screen with different DPI, the whole form will be re-styled every time a drop down is opened. We filled a report for it: https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-824?sda_source=notification-email Workaround, copy file FMX.Platform.Win to your project then update this method: function TWinWindowHandle.GetScale: Single; begin if not SameValue(FForcedScale, 0, TEpsilon.Scale) then Result := FForcedScale else if not SameValue(FCurrentScale, 0, TEpsilon.Scale) then Result := FCurrentScale // Add these lines, this will force the scale of the popup control to be the same as the scale of the parent else if (Form <> nil) and (Form.FormStyle = TFormStyle.Popup) and (Form.ParentForm <> nil) then Result := Form.ParentForm.Handle.Scale else Result := GetWndScale(FWnd); FCurrentScale := Result; end;
×