Re: [fpc-pascal] SqlDB TSQLQuery sqoAutoApplyUpdates does not work with ExecSQL
Am 15.12.2022 um 11:15 schrieb Michael Van Canneyt via fpc-pascal: On Thu, 15 Dec 2022, Andreas Frieß via fpc-pascal wrote: On MSSQL i use a stroed procedure to count a value in a table and use the following statement in Lazarus 1. procedureTForm1.BuExecuteClick(Sender:TObject); 2. var 3. SQL:string; 4. begin 5. Memo1.Clear; 6. SQL:=''; 7. SQL:='EXECUTE [dbo].[GetNextZaehler] :TagNr,:ProduktNr '; 8. Query.Active:=false; 9. Query.Clear; 10. Query.SQL.Text:=SQL; 11. Query.ParamByName('TagNr').AsInteger:=10; 12. Query.ParamByName('ProduktNr').AsInteger:=100; 13. Query.Options:=[sqoAutoApplyUpdates,sqoAutoCommit];// <-- AutoApplyUpdates doesnt work !? 14. try 15. Query.Open; 16. ifnot(Query.EOFandQuery.BOF)thenbegin 17. Memo1.Append('Wert='+Query.FieldByName('StueckZaehler').AsInteger.ToString); 18. end 19. elsebegin 20. Memo1.Append('Kein Wert'); 21. end; 22. //Query.ApplyUpdates; // <-- If i use this it works But you are not modifying anything or posting any data, why do you need an applyupdates ? What do you want ApplyUpdates to do ? 23. Query.Close; 24. except 25. on E:Exceptiondobegin 26. Memo1.Append('BuExecuteClick Exception =>'+E.Message); 27. end; 28. end; 29. end; 30. I must extra write an ApplyUpdates, because the sqoAutoApplyUpdates is ignored by the ExecSQL of the query. There is no relation between ExecSQL and applyupdates, so your solution is definitely faulty. An ApplyUpdates only makes sense in the context of the Post operation. No, if you use a stored procedure on the MSSQL Server there can be changes on tables. Without the ApplyUpdates these changes are not persitent. If you close and reopen the connection ALL is lost. With ApplyUpdates it works. If you test the SP in the MSSQL-Studio it works, with Lazarus without the ApplyUpdates not. Michael. ___ fpc-pascal maillist - fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal Code for Stored Procedure on MS-SQL Server including the tabledefinition USE [CounterTestDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[B_AktStueck]( [TagNr] [int] NOT NULL, [Produkt] [int] NOT NULL, [Stueckzaehler] [int] NOT NULL, CONSTRAINT [PK_B_AktStueck] PRIMARY KEY CLUSTERED ( [TagNr] ASC, [Produkt] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[B_AktStueck] ADD CONSTRAINT [DF_B_AktStueck_TagNr] DEFAULT ((0)) FOR [TagNr] GO ALTER TABLE [dbo].[B_AktStueck] ADD CONSTRAINT [DF_B_AktStueck_Produkt] DEFAULT ((0)) FOR [Produkt] GO ALTER TABLE [dbo].[B_AktStueck] ADD CONSTRAINT [DF_B_AktStueck_Stueckzaehler] DEFAULT ((0)) FOR [Stueckzaehler] GO CREATE PROCEDURE [dbo].[GetNextZaehler] -- Add the parameters for the stored procedure here @TagNr integer, @ProduktNr integer AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @NewCnt integer Set @NewCnt = 0; BEGIN TRAN Tran1 SELECT TOP 1 @NewCnt = [StueckZaehler] FROM [B_AktStueck] WHERE ([TagNr] = @TagNr) AND ([Produkt] = @ProduktNr) ORDER BY [TagNr] DESC print ' old CounterValue ' print @NewCnt if @NewCnt = 0 begin print '-- No entry -> created ' INSERT INTO [B_AktStueck] ([TagNr], [Produkt], [StueckZaehler]) VALUES (@TagNr, @ProduktNr, @NewCnt) end UPDATE [B_AktStueck] SET [StueckZaehler] = [StueckZaehler] + 1 WHERE ([TagNr] = @TagNr) AND ([Produkt] = @ProduktNr) COMMIT TRAN Tran1 SELECT TOP 1 [StueckZaehler] FROM [B_AktStueck] WHERE ([TagNr] = @TagNr) AND ([Produkt] = @ProduktNr) ORDER BY [TagNr] DESC END GO ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] SqlDB TSQLQuery sqoAutoApplyUpdates does not work with ExecSQL
On MSSQL i use a stroed procedure to count a value in a table and use the following statement in Lazarus 1. procedureTForm1.BuExecuteClick(Sender:TObject); 2. var 3. SQL:string; 4. begin 5. Memo1.Clear; 6. SQL:=''; 7. SQL:='EXECUTE [dbo].[GetNextZaehler] :TagNr,:ProduktNr '; 8. Query.Active:=false; 9. Query.Clear; 10. Query.SQL.Text:=SQL; 11. Query.ParamByName('TagNr').AsInteger:=10; 12. Query.ParamByName('ProduktNr').AsInteger:=100; 13. Query.Options:=[sqoAutoApplyUpdates,sqoAutoCommit];// <-- AutoApplyUpdates doesnt work !? 14. try 15. Query.Open; 16. ifnot(Query.EOFandQuery.BOF)thenbegin 17. Memo1.Append('Wert='+Query.FieldByName('StueckZaehler').AsInteger.ToString); 18. end 19. elsebegin 20. Memo1.Append('Kein Wert'); 21. end; 22. //Query.ApplyUpdates; // <-- If i use this it works 23. Query.Close; 24. except 25. on E:Exceptiondobegin 26. Memo1.Append('BuExecuteClick Exception =>'+E.Message); 27. end; 28. end; 29. end; 30. I must extra write an ApplyUpdates, because the sqoAutoApplyUpdates is ignored by the ExecSQL of the query. in sqldb.pp the following code is executed procedure TCustomSQLQuery.ExecSQL; begin CheckPrepare; try Execute; // Always retrieve rows affected FStatement.RowsAffected; If sqoAutoCommit in Options then SQLTransaction.Commit; finally CheckUnPrepare; // if not Prepared and (assigned(Database)) and (assigned(Cursor)) then SQLConnection.UnPrepareStatement(Cursor); end; end; I see the autocommit is configured, but sqoAutoApplyUpdates is missing. It hink it should be procedure TCustomSQLQuery.ExecSQL; begin CheckPrepare; try Execute; // Always retrieve rows affected FStatement.RowsAffected; If sqoAutoCommit in Options then SQLTransaction.Commit; If (sqoAutoApplyUpdates in Options) then ApplyUpdates; finally CheckUnPrepare; // if not Prepared and (assigned(Database)) and (assigned(Cursor)) then SQLConnection.UnPrepareStatement(Cursor); end; end; to get the correct behavior. Actual only Post and Delete fire the ApplyUpdates correct if sqoAutoApplyUpdates is activated. Should i file a Bug or is the actual behavior by design ?! (and cannot be changed) Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report
Am 19.03.2021 um 13:34 schrieb Michael Van Canneyt via fpc-pascal: On Fri, 19 Mar 2021, Andreas Frieß via fpc-pascal wrote: If it is not a bug, so a featurerequest must be possible, because other reports can handle this without a problem. You can definitely submit a feature request. For severity, simply select 'feature'. Done: 0038639 , but i am not able to set the severity to 'feature' ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report
Am 19.03.2021 um 11:07 schrieb Michael Van Canneyt via fpc-pascal: On Fri, 19 Mar 2021, Michael Van Canneyt via fpc-pascal wrote: On Fri, 19 Mar 2021, Andreas Frieß via fpc-pascal wrote: Make a Report Preview -> only the contend of the first dataset is shown. I will file a bug No need, because this is as designed. For clarity: it's as designed, but that doesn't mean I won't consider changing the design. Just don't report it as a bug, because it is not. Michael. For the record, is this written downwhat is 'by design' ? For me it is a bug, because i can design a unuseable not working second Databand and i got no message. Nor Designtime, nor runtime. If it is not a bug, so a featurerequest must be possible, because other reports can handle this without a problem. Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report
Am 18.03.2021 um 16:06 schrieb Andreas Frieß via fpc-pascal: Am 18.03.2021 um 14:24 schrieb Michael Van Canneyt via fpc-pascal: In that case, you must put lReportOLData2 on a separate design page. So: * Add a design page (page 1) to the report. * Do what you need with lReportOLData1 on this page. * Add a second design page (page 2) to the report * Do what you need with lReportOLData2 on this page. That should be it. Michael. It is a joke, every ReportData need a new page. The issue is, fpreport handle the Databand not correct. All have no Masterband set A ) If i bound no Data to a Databand, automatic the dataset of the parent (Page) is used -> Ok yet -> Dataloop of parent is used B ) If i bound Data to a Databand and it is the same like the parent (page) -> Ok -> Dataloop of parent is used C ) If i bound Data to a Databand and it is not the same like the parent -> Not Ok -> the first it is handled like B - it should use their own dataloop You can make this with a fake working. Make a dummy Databand with a Dataset with ONE entry only. Then bound the datasets as childdatasets and it works. You see the problem with the FPReport Designer too. - Make a new report - add two datasets (eg, csv with valid data) - add PageheaderBand, TitleBand and PageFooterband - add a Databand bound the Data1 to it - add a Databand bound the Data2 to it Make a Report Preview -> only the contend of the first dataset is shown. I will file a bug Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report
If i load the design created by the demo in the FPReportDesigner i see the expected layout. DBBand01 should show the the data of the first Objectlist, DBBand02 the data from the second Objectlist. Actual changed demo included. Am 18.03.2021 um 14:13 schrieb Andreas Frieß via fpc-pascal: The expected layout is in the demo. Test.json Description: application/json <> ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report
Am 18.03.2021 um 14:24 schrieb Michael Van Canneyt via fpc-pascal: On Thu, 18 Mar 2021, Andreas Frieß via fpc-pascal wrote: The expected layout is in the demo. 'Expected layout' for me is a PDF, screenshot image of some finished document, showing what you want to see printed. I have data inside of ObjectsList=OL (here in the demo two) and i want to report one OL by one. This should be done continuos and each OL have their own layout. There is no master-detail. After one OL is finished the next should be processed and appended, if the one page is finished, it should continued on the next page. This works for lReportOLData1 ok, but lReportOLData2 is never used/seen/reported. In that case, you must put lReportOLData2 on a separate design page. So: * Add a design page (page 1) to the report. * Do what you need with lReportOLData1 on this page. * Add a second design page (page 2) to the report * Do what you need with lReportOLData2 on this page. That should be it. Michael. It is a joke, every ReportData need a new page. I have tested it yet in the FPReportdesigner with a new project. I can add two ReportDatasources on a new report (eg. csv) and add to a report two Databands and connect every Databand with a datasource. If i press preview, i see the first data shown and the second is missing. I thinks this is a issue in fpreport not to handle this correct. With LazReport i have done this without a problem. Andreas There ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report
The expected layout is in the demo. I have data inside of ObjectsList=OL (here in the demo two) and i want to report one OL by one. This should be done continuos and each OL have their own layout. There is no master-detail. After one OL is finished the next should be processed and appended, if the one page is finished, it should continued on the next page. This works for lReportOLData1 ok, but lReportOLData2 is never used/seen/reported. Andreas Am 18.03.2021 um 13:05 schrieb Michael Van Canneyt via fpc-pascal: . I can't advise you on what bands you must place memo and how to advance the 2nd data list, because for that I would need to know the expected layout. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report
I have a sample attached to show the problem. I want in the report (created a runtime) to use more than one report datasource. I create a databand and connect this with a TFPReportObjectListData object. Each TFPReportObjectListData object works. But i want to have the data of the first, then the data of the other object. But i am not able to combine this two Data in one Report. ** DataBand := TFPReportDataBand.Create(p); DataBand.Name:= 'DBBand01'; DataBand.Layout.Height := 10; DataBand.Data:= lReportOLData1; // First Data ! This is shown Memo := TFPReportMemo.Create(DataBand); Memo.Layout.Left := 5; Memo.Layout.Top := 0; Memo.Layout.Width := 60; Memo.Layout.Height := 5; Memo.Font.Name := defaultFont; Memo.Text := '[InfoA] - [ValueA]'; DataBand2 := TFPReportDataBand.Create(p); DataBand2.Name:= 'DBBand02'; DataBand2.Layout.Height := 10; DataBand2.Data:= lReportOLData2; // Second Data ! This is not shown Memo2 := TFPReportMemo.Create(DataBand2); Memo2.Layout.Left := 5; Memo2.Layout.Top := 0; Memo2.Layout.Width := 60; Memo2.Layout.Height := 5; Memo2.Font.Name := defaultFont; Memo2.Text := '[InfoB] - [ValueB]'; *--* Any Hint for this problem to solve ? <> ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] go32 tcp
I would like to use TCP in a DOS FPC project. I see in go32-v2 download page under "Optional-Files" the unit ufclndos. I downloaded it but have not managed to find any documentation for it. 1) Is there any documentation for this unit? 2) Can this unit be used to create a server for a TCP connection? 3) How does the unit "talk" with the 16-bit DOS packet driver? Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] go32 tcp
I would like to use TCP in a DOS FPC project. I see in go32-v2 download page under "Optional-Files" the unit ufclndos. I downloaded it but have not managed to find any documentation for it. 1) Is there any documentation for this unit? 2) Can this unit be used to create a server for a TCP connection? 3) How does the unit "talk" with the 16-bit DOS packet driver? Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BSON formatter
Am 2020-05-07 15:26, schrieb Ryan Joseph via fpc-pascal: The amount of redundant information being sent around is ridiculous. Mainly, the spec gives no way for the client to cache results and refer to them later in various requests. We're literally sending around mega bytes of data for no reason whatsoever, except lazy programmers I guess. Computers just keep getting slower and slower sometimes it feels... That's the normal approach now. Why should you optimize anything if you can simply buy better hardware? So I end up with a machine ten times as fast as a few years ago and still cannot run much more in parallel than back then, because even calendar apps are now written with a full browser stack (looking at electron here). As someone who still is happy when a GUI is a statically compiled app that is < 10MB and doesn't take more than that as memory when starting up, I am disgusted by the current "state of the art" development. It's no longer an art. (I am even more pissed off about this on my smartphone. Why does a messenger app have to be 100 MB in size?! We had whole operating systems in just 1% of that size. Even a full oracle database is just around 30 MB if you strip away the java based management console stuff ... and that thing is a feature monster for data management.) -- Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] BSON formatter
Am 2020-05-07 08:40, schrieb Ryan Joseph via fpc-pascal: Working on the language server it's become clear that JSON is going to be a killer bottleneck, but that's what Microsoft decided to use. It's almost a deal breaker just because of the sheer size of the data due to JSON's verbose plain text formatting. I've seen there is such thing as BSON (https://en.wikipedia.org/wiki/BSON) which could be implemented over JSON without disrupting the underlying architecture. Is there any BSON formatters for the FPC JSON libraries? It's just serializing in a different text format so it's probably pretty easy to implement but I thought I would ask first. I would go with ProtoBuf for something like this. If you really want to be flexibel in the datastructure, look at msgpack/messagepack. Both (protobuf and msgpack) are pretty good in benchmarks. -- Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] "Hello world" syscalls
Am 2020-01-09 00:30, schrieb Graeme Geldenhuys: So the resulting Java.class is 16 MByte in size!!! How? No it's not. I quote: The size of all files which must be present at runtime (interpreters, stdlib, libraries, loader, etc) are included. So 16mb is pretty generous. I wouldn't immediately know how to strip down the JRE to 16mb. Mine is ~300mb. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-report demos not working on windows10/64 with win64 compiled - Font Arial not found
Hello, both fonts are on the system, see attached textfile. It was the content of the Windows Font Directory only. But where in the sample is setting this path on a windows machine? No one. I have inserted a printout of the actual Font search path. The path (for windows) is NOT SET by default. This is the first issue. And where should the fallback found ? It can not be found too, because no path to the system font dir was set. - D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d jsondata -f pdf Fontspath start - D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\/fonts/ Fontspath end - 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 Exception at 00010004C44F: EReportFontNotFound: Font not found: "Arial". Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 4895 memory blocks allocated : 1547952/1562136 4895 memory blocks freed : 1547952/1562136 0 unfreed memory blocks : 0 True heap size : 262144 (320 used in System startup) True free heap : 261824 D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos> Am 27.12.2019 um 23:03 schrieb Michael Van Canneyt: Hello, Can we please tackle one problem at a time ? The first problem is: Why is the "liberation sans" not found ? Once we've established that, we can check why the fallback is not found, and perhaps the error message. Michael. On Fri, 27 Dec 2019, Andreas Frieß wrote: Hello Michael, if the font is not found, why is there not the correct indication of the missing font ? The errormessage is in this case completly wrong. If a fallback should be possible, it should work and not mask the problem and create a false errormessage. Maybe the font liberation Sans is not on a Windows10/64 machine, if this is true i should see the message -> fpreport: Could not find the font in the font cache. Or -> EReportFontNotFound: >> Font not found: "Liberation Sans". Andreas Am 27.12.2019 um 16:00 schrieb Michael Van Canneyt: As I said: The demos do not use Arial on purpose. Probably it is used as a fallback somewhere. So the question is: why is the demo falling back to Arial ? It means the actually used font (Liberation Sans, line 74 of rptjson) is not found. Michael. On Fri, 27 Dec 2019, Andreas Frieß wrote: The reason (with ReadStandardfonts inserted): --- D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d jsondata -f pdf 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 1 : Name -> Albania 1 : Population -> 2894000 2 : Name -> Algeria 2 : Population -> 38934000 3 : Name -> Angola 3 : Population -> 24228000 some lines skipped . 155 : Name -> Zambia 155 : Population -> 15721000 156 : Name -> Zimbabwe 156 : Population -> 15246000 Exception at 0001000631E0: Exception: fpreport: Could not find the font in the font cache. Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 74069 memory blocks allocated : 101484860/101702272 74069 memory blocks freed : 101484860/101702272 0 unfreed memory blocks : 0 True heap size : 2785280 (320 used in System startup) True free heap : 2784960 D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos> - Original (without ReadStandardfonts) = Original -- D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d jsondata -f pdf 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 Exception at 00010004C36F: EReportFontNotFound: Font not found: "Arial". Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 4894 memory blocks allocated : 1547732/1561920 4894 memory blocks freed : 1547732/1561920 0 unfreed memory blocks : 0 True heap size : 262144 (320 used in System startup) True free heap : 261824 Michael Van Canneyt wrote: > > > On Fri, 27 Dec 2019, Andreas Frieß wrote: > > > I have now built the fcl-fpreport demos on win64 on a Windows10/64 > > machine. But the demo is not running (comandline with -d jsondata -f > > pdf), because the font Arial is not found. It looks like the demos > > didnt use the gTTFontCache.ReadStandardFonts and so the standard > > font is not found. > > Why do you think Arial is needed ? > > All demos explicitly use a font, but never Arial. That is why > gTTFontCache.Read
[fpc-pascal] fcl-report demos - expressions - have problem with [RecNo]
There is more not working in the report demos. The expressionparser have problems with a simple [RecNo] D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d expressions Exception at 000100096E0D: EExprParser: Expected ( bracket at position 12, but got -. Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 1708 memory blocks allocated : 149127/155288 1708 memory blocks freed : 149127/155288 0 unfreed memory blocks : 0 True heap size : 196608 (256 used in System startup) True free heap : 196352 - ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Fwd: Re: fcl-report demos not working on windows10/64 with win64 compiled - Font Arial not found
Hello Michael, if the font is not found, why is there not the correct indication of the missing font ? The errormessage is in this case completly wrong. If a fallback should be possible, it should work and not mask the problem and create a false errormessage. Maybe the font liberation Sans is not on a Windows10/64 machine, if this is true i should see the message -> fpreport: Could not find the font in the font cache. Or -> EReportFontNotFound: >> Font not found: "Liberation Sans". Andreas Am 27.12.2019 um 16:00 schrieb Michael Van Canneyt: As I said: The demos do not use Arial on purpose. Probably it is used as a fallback somewhere. So the question is: why is the demo falling back to Arial ? It means the actually used font (Liberation Sans, line 74 of rptjson) is not found. Michael. On Fri, 27 Dec 2019, Andreas Frieß wrote: The reason (with ReadStandardfonts inserted): --- D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d jsondata -f pdf 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 1 : Name -> Albania 1 : Population -> 2894000 2 : Name -> Algeria 2 : Population -> 38934000 3 : Name -> Angola 3 : Population -> 24228000 some lines skipped . 155 : Name -> Zambia 155 : Population -> 15721000 156 : Name -> Zimbabwe 156 : Population -> 15246000 Exception at 0001000631E0: Exception: fpreport: Could not find the font in the font cache. Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 74069 memory blocks allocated : 101484860/101702272 74069 memory blocks freed : 101484860/101702272 0 unfreed memory blocks : 0 True heap size : 2785280 (320 used in System startup) True free heap : 2784960 D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos> - Original (without ReadStandardfonts) = Original -- D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d jsondata -f pdf 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 Exception at 00010004C36F: EReportFontNotFound: Font not found: "Arial". Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 4894 memory blocks allocated : 1547732/1561920 4894 memory blocks freed : 1547732/1561920 0 unfreed memory blocks : 0 True heap size : 262144 (320 used in System startup) True free heap : 261824 Michael Van Canneyt wrote: > > > On Fri, 27 Dec 2019, Andreas Frieß wrote: > > > I have now built the fcl-fpreport demos on win64 on a Windows10/64 > > machine. But the demo is not running (comandline with -d jsondata -f > > pdf), because the font Arial is not found. It looks like the demos > > didnt use the gTTFontCache.ReadStandardFonts and so the standard > > font is not found. > > Why do you think Arial is needed ? > > All demos explicitly use a font, but never Arial. That is why > gTTFontCache.ReadStandardFonts should not be necessary. > > Most demos use the LiberationSans font. Some use DejaVuSans or the > Ubuntu font. You must of course have these fonts installed in your > system. The LiberationSans font is included in the fonts subdirectory > of the demo dir. > > So the question is, why does not the demo program find these fonts ? > > Michael. > ___ > fpc-pascal maillist - fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-report demos not working on windows10/64 with win64 compiled - Font Arial not found
The reason (with ReadStandardfonts inserted): --- D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d jsondata -f pdf 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 1 : Name -> Albania 1 : Population -> 2894000 2 : Name -> Algeria 2 : Population -> 38934000 3 : Name -> Angola 3 : Population -> 24228000 some lines skipped . 155 : Name -> Zambia 155 : Population -> 15721000 156 : Name -> Zimbabwe 156 : Population -> 15246000 Exception at 0001000631E0: Exception: fpreport: Could not find the font in the font cache. Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 74069 memory blocks allocated : 101484860/101702272 74069 memory blocks freed : 101484860/101702272 0 unfreed memory blocks : 0 True heap size : 2785280 (320 used in System startup) True free heap : 2784960 D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos> - Original (without ReadStandardfonts) = Original -- D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d jsondata -f pdf 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 0 : Name -> Afghanistan 0 : Population -> 31628000 Exception at 00010004C36F: EReportFontNotFound: Font not found: "Arial". Heap dump by heaptrc unit of "D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe" 4894 memory blocks allocated : 1547732/1561920 4894 memory blocks freed : 1547732/1561920 0 unfreed memory blocks : 0 True heap size : 262144 (320 used in System startup) True free heap : 261824 Michael Van Canneyt wrote: > > > On Fri, 27 Dec 2019, Andreas Frieß wrote: > > > I have now built the fcl-fpreport demos on win64 on a Windows10/64 > > machine. But the demo is not running (comandline with -d jsondata -f > > pdf), because the font Arial is not found. It looks like the demos > > didnt use the gTTFontCache.ReadStandardFonts and so the standard > > font is not found. > > Why do you think Arial is needed ? > > All demos explicitly use a font, but never Arial. That is why > gTTFontCache.ReadStandardFonts should not be necessary. > > Most demos use the LiberationSans font. Some use DejaVuSans or the > Ubuntu font. You must of course have these fonts installed in your > system. The LiberationSans font is included in the fonts subdirectory > of the demo dir. > > So the question is, why does not the demo program find these fonts ? > > Michael. > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fcl-report demos not working on windows10/64 with win64 compiled - Font Arial not found
I have now built the fcl-fpreport demos on win64 on a Windows10/64 machine. But the demo is not running (comandline with -d jsondata -f pdf), because the font Arial is not found. It looks like the demos didnt use the gTTFontCache.ReadStandardFonts and so the standard font is not found. If i change in udapp.pp procedure TReportRunner.RunReport(AFileName : string); ... // ask to generate the font cache gTTFontCache.ReadStandardFonts; // implies gTTFontCache.BuildFontCache; ... the report is now built, but the rendere of pdf in fpreportpdfexport.pp have the same issue with not find font arial. It is not logical for me. gTTFontCache is built correct for the report, why is the renderer not found the font ? Is the renderer use another fontcache ?! Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-fpreport not built complete, missing fpreport.dom
Actual Debian x64 with fpc & lazarus from svn (with fpcupdeluxe) if you compile fpreportdesign.lpr on a x64 system (i386 works) windows and linux -- Hint: (11030) Start of reading config file D:\data\lazdev\work64ft\fpc\bin\x86_64-win64\fpc.cfg Hint: (11031) End of reading config file D:\data\lazdev\work64ft\fpc\bin\x86_64-win64\fpc.cfg Free Pascal Compiler version 3.2.0-beta-r43633 [2019/12/03] for x86_64 Copyright (c) 1993-2018 by Florian Klaempfl and others (1002) Target OS: Win64 for x64 (3104) Compiling lclfpreport.pas (3104) Compiling lclfpreportbuild.pp Fatal: (10024) Unit fpreportdom searched but fpreport found Fatal: (1018) Compilation aborted Error: D:\data\lazdev\work64ft\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode -- if i activate show debug infos and show unit infos in fpc.cfg i see (FPREPORTDB) (10048) Adding dependency: FPREPORTDB depends on DB (FPREPORTDB) (10056) Finished loading unit FPREPORTDB (LCLFPREPORTBUILD) (10048) Adding dependency: LCLFPREPORTBUILD depends on FPREPORTDB (LCLFPREPORTBUILD) (10027) Load from LCLFPREPORTBUILD (interface) unit FPREPORTDOM (FPREPORTDOM) (10055) Loading unit FPREPORTDOM (FPREPORTDOM) (10002) PPU Name: /home/andi/data/lazdev/trunk/fpc/units/x86_64-linux/fcl-report/fpreport. ppu (FPREPORTDOM) (10005) PPU Time: 2019/12/23 14:53:48 (FPREPORTDOM) (10003) PPU Flags: 4224 (FPREPORTDOM) (10004) PPU Crc: 083B0CC3 (FPREPORTDOM) (10004) PPU Crc: 50A62B54 (intfc) (FPREPORTDOM) (10004) PPU Crc: 6196D615 (indc) (FPREPORTDOM) Number of definitions: 3227 (FPREPORTDOM) Number of symbols: 10461 Fatal: (10024) Unit fpreportdom searched but fpreport found Fatal: (1018) Compilation aborted Error: /home/andi/data/lazdev/trunk/fpc/bin/x86_64-linux/ppcx64 returned an error exitcode see https://forum.lazarus.freepascal.org/index.php/topic,47627.msg344017.htm l#msg344017 and https://forum.lazarus.freepascal.org/index.php/topic,47889.msg344069.html#msg344069 Andreas Michael Van Canneyt wrote: > > > On Thu, 26 Dec 2019, Andreas Frieß wrote: > > > I have get fpc from actual svn trunk for x64 on windows and x64 on > > linux (debian) and i have seen, some parts of fcl-fpreport are not > > built and i found no ppu's for it. maybe the makefiles for fpreport > > have to be refreshed. > > > > I am missing fpreportdom.pp compiled, there is no fpreportdom.ppu. > > In the fpmake.pp it is commented out !!! But, if you want to > > compile in (win64, linux) Lazarus the standalone designer and/or > > the fpreport package, the ppu is searched. So it breaks building of > > Lazarus. > > fpreportdom is not needed, has never been since it is in FPC. > > Where is it used ? > > Michael. > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fcl-fpreport not built complete, missing fpreport.dom
I have get fpc from actual svn trunk for x64 on windows and x64 on linux (debian) and i have seen, some parts of fcl-fpreport are not built and i found no ppu's for it. maybe the makefiles for fpreport have to be refreshed. I am missing fpreportdom.pp compiled, there is no fpreportdom.ppu. In the fpmake.pp it is commented out !!! But, if you want to compile in (win64, linux) Lazarus the standalone designer and/or the fpreport package, the ppu is searched. So it breaks building of Lazarus. Start compiling package fcl-report for target x86_64-win64. Compiling fcl-report\BuildUnit_fcl_report.pp Compiling .\fcl-report\src\fpreportstreamer.pp Compiling .\fcl-report\src\fpreporthtmlparser.pp Compiling .\fcl-report\src\fpreport.pp Compiling .\fcl-report\src\fpreportdata.pp Compiling .\fcl-report\src\fpreportdb.pp Compiling .\fcl-report\src\fpreportdatacsv.pp Compiling .\fcl-report\src\fpreportdatadbf.pp Compiling .\fcl-report\src\fpreportdatajson.pp Compiling .\fcl-report\src\fpreportdatasqldb.pp Compiling .\fcl-report\src\fpjsonreport.pp Compiling .\fcl-report\src\fplazreport.pp Compiling .\fcl-report\src\fpreportbarcode.pp Compiling .\fcl-report\src\fpreportjson.pp Compiling .\fcl-report\src\fpextfuncs.pp Compiling .\fcl-report\src\fpreportcontnr.pp Compiling .\fcl-report\src\fpreportcanvashelper.pp Compiling .\fcl-report\src\fpreporthtmlutil.pp Compiling .\fcl-report\src\fpreportpdfexport.pp Compiling .\fcl-report\src\fpreporthtmlexport.pp Compiling .\fcl-report\src\fpreportfpimageexport.pp Compiling .\fcl-report\src\fpreportqrcode.pp Should i file a bug for FPC ? Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] linking Openwatcom object files (DOS)
While reading some old FPC posts I saw that the old DOS compiler (3.0.4) used the OpenWatcom linker. Does this mean that I can link object files and libraries created with the OpenWatcom C++ compiler? If this is so, it would be very good for me. I could finally port one of the main programs still in use by the company I work for from C++ to Freepascal. Regards, Andreas Berger ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Link with GCC object files
Thank you Sven, this will be a big help Regards, Andreas On 22/08/2018 12:12, Sven Barth via fpc-pascal wrote: Andreas <mailto:andreasberger@gmail.com>> schrieb am Mi., 22. Aug. 2018, 12:59: Hi, I have a question. Is it possible to link FPC for Linux (PC and ARM) with GCC or other C++ object files? You can use the $L directive for this ( https://freepascal.org/docs-html/current/prog/progsu43.html#x50-490001.2.43 ). If you use C++ it's recommended to use "extern "C"" however even though FPC supports cppdecl (as it can't handle all cases currently). And classes won't work either. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Link with GCC object files
Hi, I have a question. Is it possible to link FPC for Linux (PC and ARM) with GCC or other C++ object files? Regards, Andreas Berger ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Backport of Bugfix 0031517 possible
Hello, it looks the fix Bug 0031517 is more and more visible, if you compile an actual stable Lazarus with the actual stable fpc. You see with a Lazarus with more packages, the Error - No memory left - rises. See e.g. the thread http://forum.lazarus.freepascal.org/index.php/topic,40351.0.html about this. My question is, is it possible to make a backport of this fix? Should i reopen the Bugreport oder create a new one ? The soloution is now one year in trunk and i have seen no problems with it. Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor
Depending on the Information of the list here i have created some patches and an Bug-Report https://bugs.freepascal.org/view.php?id=33217 The heats of my changes is a more typesafe conversion and to use QWord for the JSON. So nothing is broken and it rangechecksafe now. - a small snippet function QWordToReportColor(AQWord: QWord):TFPReportColor; begin Result := TFPReportColor(AQWord and $); end; The second, i foung a not created Font, if you are not using Parent-Fonts. Also fixed. Thx to all who have some things more clear to me AND why. Andreas Am 22.02.2018 um 08:05 schrieb Michael Van Canneyt: On Thu, 22 Feb 2018, Andreas Frieß wrote: Another possible Problem with the definition TFPColor (fpc) record with word <> TColor (lazarus) -$7FFF-1..$7FFF <> TFPReportColor (fpreport) UInt32 So you cannot use in Lazarus the 'well known' TColors. With TColor it is also Delphi compatible. Using TColor is not an option, it is windows specific and depeds on Graphics. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor
Another possible Problem with the definition TFPColor (fpc) record with word <> TColor (lazarus) -$7FFF-1..$7FFF <> TFPReportColor (fpreport) UInt32 So you cannot use in Lazarus the 'well known' TColors. With TColor it is also Delphi compatible. If the defines are Lazarus compatible. It works for both systems. I can make a patch if needed. But the teams have to IMHO to decide the best way :-) Andreas Am 21.02.2018 um 23:53 schrieb Michael Van Canneyt: On Wed, 21 Feb 2018, Mattias Gaertner wrote: On Wed, 21 Feb 2018 19:54:55 + Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> wrote: [...] > Because UInt32 is not a JSON dataformat. Well, then I'll say that FPC's JSON needs to be extended to support UInt32, as it is a perfectly valid Object Pascal data type. How should FPC's JSON support something, that is not supported by JSON? The problem is not in JSON. Native Javascript supports 2^52 (or so) integer values, so every UInt32 value should fit if written properly. FPC's JSON supports Int64 and even QWord in FPC, so a UInt32 is definitely supported. If the colors (a UInt32) is currently written as Longint (signed 32-bit) then of course a range check will follow, and this needs to be fixed. The easiest solution is simply to read/write it as Int64. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpreport rangeerrors with TFPReportColor
Andreas Frieß wrote: > when i compile in Lazarus the Reportdesigner with activated > RangeCheck it gives a lot of runtimeerror with rangeerrors. > For explanation what i mean in my previous post, UInt32 is not an integer or JSON compatible size (and actual rangecheck unsafe). ANdreas -- in systemh.inc maxLongint = $7fff; in objectpas.pp const MaxInt = MaxLongint; type Integer = longint; in fpreport.pp TFPReportColor = type UInt32; in systemh.inc Cardinal = LongWord; ... UInt32 = Cardinal; in fpreport.pp const { The format is always RRGGBB (Red, Green, Blue) - no alpha channel } clNone = TFPReportColor($8000); // a special condition: $80 00 00 00 .. AWriter.WriteInteger('FontColor', Font.Color); . Font.Color := AReader.ReadInteger('FontColor', Font.Color); .. in fpReportStreamer.pp function TFPReportJSONStreamer.ReadInteger(AName: String; ADefault: Integer): Integer; var d: TJSONData; begin d := FindChild(AName) as TJSONData; if d = nil then Result := ADefault else begin if d.JSONType = jtNumber then Result := d.AsInt64 else Result := ADefault; end; end; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fpreport rangeerrors with TFPReportColor
when i compile in Lazarus the Reportdesigner with activated RangeCheck it gives a lot of runtimeerror with rangeerrors. The definition is TFPReportColor = type UInt32; Loading and saving in JSON is done by function ReadInteger(AName: String; ADefault: Integer): Integer; override; function WriteInteger(AName: String; ADefault: Integer): Integer; override; internally of write and read there is a cast from d.AsInt64 to integer. This means you have at reading a AsInt64 -> Integer -> UInt32. Actual i have a value of 2147483648 ($8000) wich make a rangecheckerror :-) Should the definition for TFPReportColor not better TFPColor ( I KNOW THE DIFFENCES) or QWord with the according routines. Because UInt32 is not a JSON dataformat. Integer seems to be to small, so QWord fits this better. TFPColor is more FPC-Compatible (with the overhead of the needed conversions). I am wrong ? Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MSEide+MSEgui 4.6 for FPC 3.0.4
On 25/11/2017 14:43, Martin Schreiber wrote: On Saturday 25 November 2017 15:04:05 Andreas Berger wrote: On the Android side I actually only need a graphical app with access to the Bluetooth and possibly be a TCP client. And why Free Pascal to develop the android application? What would be the advantages instead to use the tools of the platform? The architecture of MSEgui would allow to make widgets for Android in RAD style development, either ownerdrawn or wrapper for native widgets with 'ifi'-data- and event-connections to the business logic in the application. Today much of the maintenance at the client is done using netbooks. We wish to use cell phone exclusively. We have a large program base with many programs all written in FPC and/or Delphi. The company is migrating all FPC to Rad Studio 10.2 so that the same code base can be used when we migrate some of these programs to android. I would rather migrate our last delphi programs to FPC. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MSEide+MSEgui 4.6 for FPC 3.0.4
On 25/11/2017 14:43, Martin Schreiber wrote: On Saturday 25 November 2017 15:04:05 Andreas Berger wrote: On the Android side I actually only need a graphical app with access to the Bluetooth and possibly be a TCP client. And why Free Pascal to develop the android application? What would be the advantages instead to use the tools of the platform? The architecture of MSEgui would allow to make widgets for Android in RAD style development, either ownerdrawn or wrapper for native widgets with 'ifi'-data- and event-connections to the business logic in the application. Today much of the maintenance at the client is done using netbooks. We wish to use cell phone exclusively. We have a large program base with many programs all written in FPC and/or Delphi. The company is migrating all FPC to Rad Studio 10.2 so that the same code base can be used when we migrate some of these programs to android. I would rather migrate our last delphi programs to FPC. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MSEide+MSEgui 4.6 for FPC 3.0.4
On the Android side I actually only need a graphical app with access to the Bluetooth and possibly be a TCP client. On 25/11/2017 10:28, Martin Schreiber wrote: On Saturday 25 November 2017 11:52:39 Andreas Berger wrote: I went back to Delphi because our company is converting all programs that the maintenance uses to work on cell phones. Rad Studio 10.2 was bought and even our desktop programs are being converted form FPS/Delphi7 to Delphi 10. If FPC for Android worked off the shelf I probably could convince the company to go back to FPC since all our current projects work with it. Can you elaborate a bit what you actually need? Do you need a Firemonkey equivalent? Something other? Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MSEide+MSEgui 4.6 for FPC 3.0.4
I went back to Delphi because our company is converting all programs that the maintenance uses to work on cell phones. Rad Studio 10.2 was bought and even our desktop programs are being converted form FPS/Delphi7 to Delphi 10. If FPC for Android worked off the shelf I probably could convince the company to go back to FPC since all our current projects work with it. I Never used MGE but have been keeping an eye on it and know what you do is very stable. On 25/11/2017 04:25, Martin Schreiber wrote: On Friday 24 November 2017 18:38:39 Andreas wrote: Hi Martin, do you have any plans to cross compile to android? Maybe if there is enough interrest or a sponsor. What do you need? Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] MSEide+MSEgui 4.6 for FPC 3.0.4
Hi Martin, do you have any plans to cross compile to android? On 24/11/2017 06:08, Martin Schreiber wrote: Hi, MSEide+MSEgui version 4.6 has been released: https://sourceforge.net/projects/mseide-msegui/files/mseide-msegui/4.6/ There are also new versions of MSEgit, MSErun, MSEspice and MSEkicadBOM: https://sourceforge.net/projects/mseuniverse the cross environment for Raspberry Pi: https://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/ and FPC for Raspberry Pi: https://sourceforge.net/projects/mseide-msegui/files/fpcarm/ Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Food for thought - language string improvement
Graeme, I am a big fan of your messages. You have many good ideas and I sometimes read a theme that I am not interested in just to see your response. In this case however I think you are wrong. Pascal has fantastic inherent type and error checking in its structure. It would be wrong to have an editor that can introduce unwanted errors. Just one way that I can see potential problems in you code style is the line end. Not every string is a SQL text which is very flexible in it's interpretation. Other string may want one or more spaces between the last symbol on the top line and the first on the second, today the editor normally strips these spaces away. If they are left in, they are spaces that visually I can not determine just by looking at the code. A mess. For this reason I would be against this implementation. Maybe taking away the need for the + sign at the end of the line. The strings are concatenated until a semi-colon or other symbol is encountered On 06/07/2017 11:13, Graeme Geldenhuys wrote: Ever had a problem like this? You have some SQL, say: SELECT Customers.CustomerName, Orders.OrderID FROM Customers FULL OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID ORDER BY Customers.CustomerName; and you want to add that SQL to the SQL property of a query at runtime. You end up either having to turn this into a string like this: 'SELECT Customers.CustomerName, Orders.OrderID' + 'FROM Customers' + 'FULL OUTER JOIN Orders' + 'ON Customers.CustomerID = Orders.CustomerID' + 'ORDER BY Customers.CustomerName;' or manually in each line like this (oh please NEVER do this!): FDQuery1.SQL.Add('SELECT Customers.CustomerName, Orders.OrderID'); FDQuery1.SQL.Add('FROM Customers'); FDQuery1.SQL.Add('FULL OUTER JOIN Orders'); FDQuery1.SQL.Add('ON Customers.CustomerID = Orders.CustomerID'); FDQuery1.SQL.Add('ORDER BY Customers.CustomerName;'); Now this has normally not been much of a problem for me, because part of tiOPF's support tools, there is a tool name tiSQLEditor that does bi-directional conversions for you - to and from quoted strings for SQL. And even straight from/to the clipboard. This tool has been around for 17+ years. But why must this be a tool problem or a IDE problem? Why can't the Object Pascal language solve this for us! [the following part quoted from a online discussion by somebody else - I fully agree with his thoughts though] Imagine if FPC had type inference and multi-line strings, neither very exotic features. The code then becomes: = var query := '''SELECT Customers.CustomerName, Orders.OrderID FROM Customers FULL OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID ORDER BY Customers.CustomerName;''' FDQuery1.SQL.Add(query); = Easier to read, easier to edit, no need for a IDE wizard or external tools. Language features like this is what increases productivity. But unfortunately it seems we all rather rely on a specific tool or IDE to improve our productivity - thus also locking us into using those tools only. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Serial to TCP gateway in FPC?
I know this is off topic, but does Synapse work on Android? I am planning on using FpcUpDeluxe to write an android app that has a TCP client, but am still looking for the TCP component. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] googleapiconv raises ERESTAPI error
I think the same problem will appear in Lazarus with the gooleapis components (and examples), because they based on the fpc. ... Exception-Class >>ERESTAPI<< TTasklist: unsopported array element type Andreas Am 06.11.2016 um 16:00 schrieb Michael Van Canneyt: On Sun, 6 Nov 2016, Andreas Frieß wrote: Hello, i will try to use the googleapiconverter from the gooleapi examples directory. I got some excepions, so i reduced the problem to a generic one. I use the trunc of FPC and compile the googleapiconv without a problem (inside lazarus). If i run it direct from commandline with -A -k ig ot the following infos. The stored json file look wellformed and ok. > C:\Data\development\fpctrunk\fpc\packages\googleapi\examples\generator > >googleapiconv.exe -A -k Exception at 0043DF98: ERESTAPI: > Unknown class : "¼F ÿ¼F ý¼F »F °│F T┤FTTypeDef ê█E > TTypeDefä`F ÉF googlediscoverytopas TRestMethodParam > ê█E ÿ ê█E á TRestMethodParams É". Any hint 4 me ? There has been a change in the RTTI, which has not yet been corrected in the restbase unit. This needs to be done still, it is on my TODO list. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] googleapiconv raises ERESTAPI error
Hello, i will try to use the googleapiconverter from the gooleapi examples directory. I got some excepions, so i reduced the problem to a generic one. I use the trunc of FPC and compile the googleapiconv without a problem (inside lazarus). If i run it direct from commandline with -A -k ig ot the following infos. The stored json file look wellformed and ok. > C:\Data\development\fpctrunk\fpc\packages\googleapi\examples\generator > >googleapiconv.exe -A -k Exception at 0043DF98: ERESTAPI: > Unknown class : "¼F ÿ¼F ý¼F »F °│F T┤FTTypeDef ê█E > TTypeDefä`F ÉF googlediscoverytopas TRestMethodParam > ê█E ÿ ê█E á TRestMethodParams É". Any hint 4 me ? Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] code example where AnsiString used in FCL (SqlDB) causes data loss
All in all Graeme is right. FPC looks pretty much broken to me, too. For my projects I pulled the emergency-break on anything FPC. The most serious flaws for me of FPC 3.0 are: - assuming that it's possible to assign an encoding to every string - using an (unsafe) guess about the encoding for auto-conversions It's not possible to assign a valid encoding to every string (not automatically, and not even manually). Some examples: 1) String-Buffers Split a UTF-8 String into chunks of 1024 bytes. Trying to assign an encoding to those chunks, and allowing auto-conversions will just lead to corruption. Where is the string-type for string-buffers gone? 2) Most programming languages out there use something like "sequence of UTF-16 codepoints" as a string-type. (That's not the same as UTF-16 string !) It's a proper string type for "UTF-16 buffer" - pretty much nobody out there uses a low-level string-type that assumes that the content is a complete UTF-16 string. 3) Filenames on Windows You can't convert any random filename on Windows to UTF8 and back without dataloss. There simply isn't any encoding that correctly fits to all possible filenames. A lot of APIs use buffers. You can try to assign an encoding to a buffer, but if you use that encoding to auto-convert anything you made a blatant mistake. Assuming that anything from the outside world (WindowsAPI, C#, Java...) is UTF-16 is yet another blatant mistake... 4) some Barcodes, 5) Various File-Format-Standards, 6) anything that uses ASCII + some Control-Bytes for communication, 7) some encodings used in databases, ... all that won't fit into the FCP scheme of 'known encodings'.. The most obvious showstoppers for FPC 3.0 are: FPC 3.0 doesn't have a useful type for string-buffers. FPC 3.0 doesn't have a useful type for Filenames FPC 3.0 adds unsafe auto-conversions ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Linux: resolving hostnames in local network
Thanks, cnetdb.gethostbyname() works fine (at least on my raspberry). :) Creating a wrapper function is recently my work-around for an actual ping component (since linux doesn't seem to have a corresponding component like ping.dll and I want to ping as non-root) Am 23.04.2016 um 12:42 schrieb Marco van de Voort: > In our previous episode, Michael Van Canneyt said: >> You will need to use the C library routines for this. > (which is in unit cnetdb in somewhat recent FPC's) > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > > > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Linux: resolving hostnames in local network
Hi, how can I resolve hostnames in a local (private) network under linux? Both gethostbyname() and THostResolver work fine for google.com etc, but not for local hostnames like testhost.local. Testhost is reachable from console by hostname: ping testhost.local -> success (resolved in background by avahi) gethostbyname() works fine under Windows even for LAN resolution (resolved in background by Netbios name service). Currently I'm working on Ubuntu 15.10 on a raspberry, fpc 3.0. Best regards! Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] heaptrc and high RAM usage
Am 2016-03-30 13:35, schrieb Felipe Monteiro de Carvalho: Any ideas if I should try something else instead of heaptrc? Or any other ideas about what to do? I think valgrind could be of more use in this case, since it has specific tools for profiling (not just error/leak detection): http://valgrind.org/docs/manual/ms-manual.html Best regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] New feature: IfThen() intrinsic
On Tue 02/02/2016 10:52, Serguei TARASSOV wrote: On 02/02/2016 13:41, fpc-pascal-requ...@lists.freepascal.org wrote: Date: Tue, 02 Feb 2016 10:32:28 -0200 From: Andreas Berger<andr...@thebergerclan.org> On Tue 02/02/2016 09:27, Jonas Maebe wrote: > >The parameter evaluation order issue is irrelevant in this context: >Delphi guarantees left-to-right (or used to anyway, this may have >changed), FPC doesn't guarantee anything. > Wow, what's this? I never knew this. I have been using Borland products since TP 1.0 and for me left-to-right is automatic, I don't even think about it. If FPC doesn't guarantee this my code is full of potential problems. You confuse left-to-right operator's precedence with function arguments evaluation. You are totally correct Serguei, I overlooked the parameter evaluation and saw operator precedence. My code is safe :) Sorry everyone for my posts. Regards, Serguei ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Parameter evaluation order
On Tue 02/02/2016 10:41, Jonas Maebe wrote: Andreas Berger wrote on Tue, 02 Feb 2016: On Tue 02/02/2016 09:27, Jonas Maebe wrote: The parameter evaluation order issue is irrelevant in this context: Delphi guarantees left-to-right (or used to anyway, this may have changed), FPC doesn't guarantee anything. Wow, what's this? I never knew this. I have been using Borland products since TP 1.0 and for me left-to-right is automatic, I don't even think about it. If FPC doesn't guarantee this my code is full of potential problems. It also may have problems when compiling with the Delphi "NextGen" compiler: http://stackoverflow.com/a/11010685 Like Graeme said "I guess I have been lucky"! I have all printed documentation for the versions I bought from TP1 to Delphi 7, and it was always guaranteed. This sucks!!! Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] CrossFPC
I tried it with XE6 since it said it should work with versions above XE4. Guess I was wrong. Will try it with XE3 which I also have. Thanks. On Sun 24/01/2016 13:23, Michael Ring wrote: What version of Delphi do you use? CrossFPC is compatible to only rather 'old' Versions, the documentation on main page says XE4. I was subscribed to the Mailinglist but have not received a single mail for the last years so propably the mailinglist is dead. Michael Am 24.01.16 um 16:03 schrieb Andreas: CrossFPC recently released a new update and I decided to test it. Howerver it fails to install on either of my two machine. I tried subscribing the their email list (twice) but with no success. I never received the confirmation email. I know this is not the CrossFPC list, and most on this list are probably contrary two it, but I would still like to know if someone here knows how I can get on the CrossFPC list, or how to install it. Thanks ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] CrossFPC
CrossFPC recently released a new update and I decided to test it. Howerver it fails to install on either of my two machine. I tried subscribing the their email list (twice) but with no success. I never received the confirmation email. I know this is not the CrossFPC list, and most on this list are probably contrary two it, but I would still like to know if someone here knows how I can get on the CrossFPC list, or how to install it. Thanks ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] unit for PHostEnt definition
Hi, after a whole night of unsuccessful googling I'm still wondering, which unit(s) I have to use to find a type definition of PHostEnt in linux. I need it for the gethostbyname function. In Windows it's defined in winsock and there should be an equivalent record in linux according to systems "man gethostbyname". Thanks! Andreas Working on fpc 2.6.4 (from ubuntu repository) on ubuntu (raspberry 2). ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] using eventfd
Hi, which unit(s) do I have to include to use eventfd() under Linux? Is this function used internally by TEvent? Or where does TEvent end up on Linux level to create the event handle? I'm looking for a way to wait for >=2 events without polling. A thread should yield until one of them has been set. Best regards Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FileIO in FPC 3.0
On Fri, 25 Sep 2015, Michael Van Canneyt wrote: > It uses UTF16 on windows, not a codepage aware string. > So if you use widestring for all your filename strings, there will be no > problem. No conversions will happen. If I understand that correctly, it stores the filename in a string that has been tagged as valid UTF-16. Do I then have to be careful about any automagic conversions? Of course anything that assumes that a conversion of an UTF-16 tagged string to an UTF-8 one is lossless has to be avoided. Is it safe to pass the Filename to procedures from the RTL without risking corruption? For me this is more a general problem when dealing with external data. Should I tag raw external data as UTF-16/UTF-8 and be super-careful, or should I tag it as some kind of "raw" string (which one?) and handle any conversions manually. For me Filenames are more a type that has some kind of affinity to an encoding for display, but I'd rather not tag its content as valid UTF-16 - any magic internal conversion is potentially lossy. All in all I think if everything works for filenames, everything else will follow... (Now lets better not start about the encoding of Filenames on non-Windows OS... :-)) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] FileIO in FPC 3.0
Hi there, In the discussion about resourcestrings I read that the RTL now uses codepage-aware strings for FileIO. So I wonder what kind of codepages do you use for FileIO? The Windows-documentation calls Filenames "opaque sequence of WCHARs". https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx So e.g. converting a Filename from the Windows-API to UTF-8 can be lossy. Does the new FPC-FileApi work correctly if a Filename contains invalid UTF-16 sequences? Assigning a codepage to something that basically is just some raw sequence of bytes from an external source sounds dangerous to me. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] libxml on MacOS X
Oh god, that must have been tunnel vision. Yeah, that was the obvious next step. Thanks :-) I compiled all the supplied examples and ran them, and they seem to print plausible results. The only hurdle is, that ld doesn't pick up libxml2.dylib on its own - for whatever reason. I had to explicitly add {$linklib xml2} to the code to get it to link. (Although in the code it explicitly references 'libxml2.'+sharedsuffix; already, which should have the same result, imho.) Can I easily install the libxml package into my installed fpc for the given target? (by using fppkg, fpmake, or whatever?) Marco van de Voort mailto:mar...@stack.nl 21. Februar 2015 20:33 Copy libxml/src/* simply to your working dir and compile your demo ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] libxml on MacOS X
Hello, is there a specific reason why libxml is not built for MacOS X / darwin? My first instinct was to just try it and but then I found out the hard way, that I have no idea how to correctly use fpmake ... So in case there is simply no one who tried libxml on OSX, I would be willing to do. However, how to correctly build it? I modified fpmake.pp to include darwin as possible target, but calling fpmake fails: ./fpmake The installer encountered the following error: Could not find unit directory for dependency package rtl What would be the best next step from here? Thanks! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SetLength procedure
I very seldom comment on this, or any, forum unless I have a good answer and no one else seem to have one. This case is different. I have noticed quit often here that instead of answering the question people try to reason why in the world the author of the question would even want to do this. Would it not be better to tell him how to do it or at the most say I don't know. I know there are times when you want to prevent someone from making a serious mistake, but this is not the case here. Sometimes the question is placed by someone new to programming and it is important to learn from your own work, mistakes and all. Often the question also comes from people migrating from, or knowledgeable with, another language where a similar functionality exits. This type of argument will only discourage them away from our beloved Pascal. Nur mein Senf. On Sun 27/07/2014 11:18, Jürgen Hestermann wrote: Am 2014-07-27 12:51, schrieb Steve Gatenby: I would find code in the form of ArrayLen := IncLength(ArrayName, 1); to be much more readable then SetLength(ArrayName, Length(ArrayName)+1); ArrayLen:= High(ArrayName); Why? It is not clear which index ArrayLen will receive from IncLength. You need to look up (or remember) what exactly this function does while in the two-line version it is all clear and unambiguous. Especially, if you not only add 1 element but more as in ArrayLen := IncLength(ArrayName,2); SetLength(ArrayName, Length(ArrayName)+2); ArrayLen:= High(ArrayName); In the first version, which value will ArrayLen be set to? High(ArrayName) or High(ArrayName)-1? This is very clear in the second version. IMO it is not worth investing time into writing a function that obscures the code. If you look at it months later you may no longer know what IncLength does exactly, not to talk about if someone else has/wants to read your code. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SourceForge April 2014 Project of the Month: Free Pascal
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 15.04.2014 14:43, João Marcelo Vaz wrote: Congratulations, FreePascal! http://sourceforge.net/blog/april-2014-project-of-the-month-free-pascal I just saw that news too in the SourceForge newsletter :-) That's really awesome! Hopefully this pushes FreePascal further. It's such a great compiler and platform to work with. Thanks to all developers and contributors for offering us such a fantastic toolset (especially Lazarus is outstanding in regards to RAD GUI development). Thanks!! - -- Best Regards, Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlNNb6YACgkQIxziJkiYZxEcXgD/R9urZy/M04idzZ5nzewBJpEb /dg6GbsewX08RVZ6IdUA/0Ql3j36hUnxk809cWLXZuwV3e0pv7WwjH7l4IR3wAbH =kj/y -END PGP SIGNATURE- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cloning objects?
On 19.03.2014 23:01, Timothy Groves wrote: Is there a drop-dead simple way to clone an object? I've got a small tree of classes (tBaseProfile, and four descendants of such). Only the descendant classes are instantiated. I need to be able to create new copies of these objects for use in other lists. At the moment, I am writing a Duplicate method that returns the new object. But this means assigning all of the data to the duplicated object. There must be an easier way! There is usually a good reason to NOT do it blindly for all members and why you don't find a default clone method in any programming language in can think of right now. Just think about it: you clone a database object (from an ORM or similar). How far does the clone/copy go? Will you also clone the associated database connection object? Probably not, so your manual code would only assign the same reference to the clone. However the table name, field name, sql statement etc. will be copied. Or think about file access: your object has a TFileStream as member. Will you clone that? What if the access was read/write and maybe even exclusive? IMHO there is no one-size-fits-all here. Best regards, Andreas signature.asc Description: OpenPGP digital signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Objects in dynamic arrays
On Saturday, November 16, 2013, at 02:36 Martin wrote: On 16/11/2013 01:03, Timothy Groves wrote: Here's the code I *actually* have in the method: var index, last : integer; begin last := length (t_volumes) - 1; index := 0; while ((t_volumes [index] t_current_volume) and (index last)) do inc (index); if (index last) then begin t_volumes [index] := t_volumes [last]; Objects are actually stored via a reference (internal pointer) So t_volumes [last] just points to the objects data The above statement duplicates the reference t_volumes [last].Destroy; destroys the object pointed to by both: t_volumes [last] and t_volumes [index] You should have destroyed t_volumes [index] *before* copying the value Maybe a bit late, but that might not be true. If Timothy really talks about _object_ (and not _class(TObject)_) it should work as he does it. Also Destroy would probably be appropriate. Just saying :-) The actual type defs used are missing. -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Bootstrap binaries
On Monday, March 4, 2013, at 01:59 Joao Morais wrote: Hello list. How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap like lists are built? I missed at least i386-linux and i386-win32 binaries. Just to know how I will update my drafts. Joao Morais I guess bootstrap isn't necessary when the full compiler is available. Which it is for i386-linux and i386-win32 (see directory above). -- Best Regards, Andreas pgp4Vt49BdRvj.pgp Description: PGP signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] CrossFPC is finally released
Simon, If I use CrossFPC with D7 or XE3 + FPC for windows, will the Delphi IDE use it's built-in debugger? The main reason I don't use Lazarus is because of the lousy debugging in Windows. Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Cross platform signal handler?
On Sunday, July 15, 2012, at 14:48 leledumbo wrote: It will depend on what you want to achive. So, what do you need it for? Handle Ctrl+C and other kinds of forced program termination. Take a look here http://hg.aksdb.de/CentrED/files/3bf040abc0311f68ad6c90486625fac2ce914c80/Server/UCEDServer.pas#L78-105 and here http://hg.aksdb.de/CentrED/files/3bf040abc0311f68ad6c90486625fac2ce914c80/Server/UCEDServer.pas#L351-359 -- Best Regards, Andreas pgpVV4VtoVtbY.pgp Description: PGP signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Help!!
On Sunday, January 15, 2012, at 15:04 Mattias Gaertner wrote: On Sun, 15 Jan 2012 05:58:21 -0800 (PST) Malvin malvin...@gmail.com wrote: So far i've managed to do the program quite well, and I was wondering, can i close the main form (form1) whils opening form2 and not closing the app? Is there any way that I can do it? If you mean LCL forms: The MainForm can not be closed, but you can hide it. But you can trick the LCL into changing what Form is considered to be the MainForm. Btw. is there any chance for having an official way to do this? i.e. making TApplication.MainForm a writable property? (I ask this here instead of opening a ticket because I suspect there's a good reason why this isn't available yet, which you will tell me now. :-)) -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Help!!
On Tuesday, January 17, 2012, at 13:15 Felipe Monteiro de Carvalho wrote: If the use case is closing the main form without quitting the application, then I would prefer a property TApplication.QuitApplicationWhenMainFormCloses or something like that. My current use case is: - show a login form - when login succeeds, show a progress form (connection initialization) and close login - on failure: go back to login - on success: show the actual application form and close the login form Showing the main form always wouldn't seem nice. Starting the application with the mainform hidden doesn't work afaik. You can hide it manually AFTER it was shown (.Hide), but Visible=False is ignored on startup. This just doesn't look nice if the main form pops up for a second to be hidden again. So I use the workflow described above, which changes the current Application.MainForm several times. -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Why is Random(255) some 529x slower compared to Delphi 7?
FPC uses MT at least for 10 years and nobody complained about performance yet. So I suspect the cases might be very rare when random performance matters and having good random numbers is always a good thing ... I prefer not to change it but it's fine for me for delphi compatibility's sake ;) Or maybe it's because no one had anything to compare it to. I have a program that sends encrypted data every night to our data base. The encryption part (which I wrote with random numbers) is VERY slow. I never gave it much thought since it is running at a time where not much else is happening. But I will look into it now. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Division by Zero
At Tuesday, 23.08.2011 on 8:57 Michael Fuchs wrote: Hello, WriteLn(FloatToStr(100 / 0)); This code prints on the screen +Inf, but I think it should be NaN. Is this a bug or a special case in computer arithmetic? http://en.wikipedia.org/wiki/Division_by_zero#In_computer_arithmetic -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] compiling turbo power lockbox on ubuntu 64
At Tuesday, 26.07.2011 on 10:13 herux wrote: Hi, I use RSA encryption library lockbox turbo power. in a windows environment I managed to compile and the apps working well, I use {$ mode delphi}. but when I compile it on ubuntu 64bit, there is an error when compiling component/LockBox/LbCipher.pas(708,10) Error: Unknown identifier EBX component/LockBox/LbCipher.pas(708,10) Warning: No size specified and unable to determine the size of the operands, using DWORD as default component/LockBox/LbCipher.pas(709,10) Error: Unknown identifier EAX component/LockBox/LbCipher.pas(709,10) Warning: No size specified and unable to determine the size of the operands, using DWORD as default component/LockBox/LbCipher.pas(710,13) Error: Unknown identifier EAX component/LockBox/LbCipher.pas(710,15) Error: Assembler syntax error in operand component/LockBox/LbCipher.pas(710,19) Error: Unknown identifier EAX component/LockBox/LbCipher.pas(710,19) Error: Assembler syntax error in operand component/LockBox/LbCipher.pas(711,12) Error: Unknown identifier BH component/LockBox/LbCipher.pas(711,14) Error: Unknown identifier AL component/LockBox/LbCipher.pas(712,12) Error: Unknown identifier BL component/LockBox/LbCipher.pas(712,14) Error: Unknown identifier AH component/LockBox/LbCipher.pas(713,13) Error: Unknown identifier EBX so on ... asm delphi like code doesn't compiled right ? but why on windows compiled ? I am trying to cross compile it in windows, for linux x86_64, and produces the same error. whether the asm code is not supported for 64bit? Assembler code is (highly) processor dependent. x86_64 is a different architecture from x86 (well, it's actually an extension, but with certain restrictions/changes). x86_64 can still execute 32bit code, but if you want a 64bit application, the assembler code has to be written for 64bit aswell. If you want to compile for ARM, you have to write assembler for ARM. Same procedure with SPARC, POWER, etc. In other words: you can't use that 32bit ASM when compiling as/for 64bit. That's one of the reasons why you should avoid assembler whenever possible - and for LockBox it certainly was possible, but TurboPower liked to optimize their code by using loads of assembler. -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] compiling turbo power lockbox on ubuntu 64
At Tuesday, 26.07.2011 on 15:31 herux wrote: thanks for the info for you guys, where can I read the complete freepascal asm document for 64bit ? Assembler is not FreePascal specific. But before you rewrite that Assembler into x86_64 compatible Intel assembler, you better rewrite it into native (Object)Pascal and get rid of the assembler code at all. It's a lot easier to write and to maintain. Plus you also get rid of platform specific code and most likely even gain performance, since the old code probably doesn't utilize all the current extensions like SSE(2, 3, 4, ...) and other things the compiler MIGHT do better. -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC for ARM-7
I am hoping to use FPC for ARM-7, compiling and debugging on a Windows machine. At the moment I am using Keil C + ULink2. Is it possible to use FPC from Windows and debug via the ULink2? Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inherit interface from 2 interfaces
On Fri, 8 Apr 2011,michael.vancanneyt worte: The whole idea of interfaces is to avoid multiple inheritance. Hm. I don't believe that. One of the major points of interfaces is indeed to avoid the problems of multiple class inheritance (diamond problems - i.e. problems caused by conflicting implementations of a method in different ancestor classes). But Interfaces themselves don't have an implementation, so those diamond problems simply don't exist for them. I don't think there's a good reason against multiple interface inheritance. Not having multiple interface inheritance complicated certain situations for myself.. forcing me to put runtime interface-casts into my code that a compiler with multiple interface inheritance could have checked at compiletime. -- Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Inherit interface from 2 interfaces
On Tue Apr 12, michael.vancanneyt worte: On Tue, 12 Apr 2011, Andreas Dorn wrote: On Fri, 8 Apr 2011, michael.vancanneyt worte: The whole idea of interfaces is to avoid multiple inheritance. Hm. I don't believe that. One of the major points of interfaces is indeed to avoid the problems of multiple class inheritance (diamond problems - i.e. problems caused by conflicting implementations of a method in different ancestor classes). But Interfaces themselves don't have an implementation, so those diamond problems simply don't exist for them. Of course they do. If they inherit from 2 interfaces that have the same method with a different signature, you have a problem. InterfaceA = Interface Function IsValid : Integer; end; InterfaceB = Interface Function IsValid : String; end; Good point. Well, I don't see a diamond here as such a serious problem as it is for multiple class inheritance. (where eventually trying to override the conflicting methods in descendant classes will bite...) C# handles multiple interface inheritance quite well, so I'm quite confident that it's possible to get it done right. As far as I've seen the diamond problem for interface inheritance there just means that it's not directly possible to call an ambigous method directly from InterfaceC without first casting to Interface A or B - and that sounds rational to me. What's important is that you can get from C to A and B without a blind cast and then call the method you like. How to define : InterfaceC = Interface(InterfaceA,InterfaceB) Let's give it a try: Interface A and B are sets of pointers to Methods, InterfaceC then simply is the union of those sets. (As a pure contract InterfaceC itself doesn't really have to contain non-ambiguous signatures) It's no problem for a class to implement Interface A and B at the same time anyway... TTest = class(TObject, InterfaceA, InterfaceB) function InterfaceA.IsValid = IsValid_A; function InterfaceB.IsValid = IsValid_B; function IsValid_A: Integer; function IsValid_B: String; end; All ambiguities regarding implementation can be resolved by the implementing class. It just has to map all the pointers to (non-conflicting) method implementations. .. Finally I'd like to mention one usecases for interface inheritance I'd like to have: 1) Splitting a big IDataInterface into smaller ones, like: IDataInterface = Interface(IInitMethods, IReadMethods, IEditMethods, ...) This would allow me to pass an IDataInterface into Factories, Loggers, etc. without passing too many methods and without ugly runtime casts or artificial single-inheritance chains... 2) Containers. Without multiple inheritance it's a pain to get some things like: IMyContainer = Interface(ISortableContainer, IVectorList, IEditableList, ...) Practically for me not having multiple interface inheritance sometimes leads to: a) artificial (single) inheritance chains b) blind runtime casts instead of casts to a known parent c) having to pass parameters that are bigger than necessary (IQuery instead of IReadOnlyQuery) All in all I'd really like to have multiple interface inheritance... -- Andreas. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Memory leak or object destruction?
On Wed, 2 Feb 2011 21:09:42 -0800, Andrew Hall wrote: Interfaces support reference counting. Only COM interfaces, but they are currently the default anyway. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: How to use GetElementById?
Title: Re: [fpc-pascal] Re: How to use GetElementById? On Sunday, January 30, 2011 13:52 silvioprog wrote: Sorry... but nobody? :( Well, when you crosspost to two mailing lists (which you shouldn't ...), then also check both of them ;-) There was an answer on the Lazarus ML. -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Converting .doc and/or .html to .pdf
On Friday, January 28, 2011 15:52 Marcos Douglas wrote: You're right. The command line is more simple. Thanks for the tip, I will try this. I have not found Since you also mentioned that you need to access it from ASP, I guess that one might offer you the most flexibility: http://www.artofsolving.com/opensource/jodconverter ... because you can run it as webservice. Or you can simply invoke it from commandline. -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to convert a large integer to base64
On Saturday, January 15, 2011 18:52 Frank Church wrote: Is there a FCL library that can be used to convert a large integer into base64 format? Define large integer ... in case you mean a normal integer/int64: IntToHex(...); -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to convert a large integer to base64
On Saturday, January 15, 2011 21:42 Frank Church wrote: I mean int64 into base64 encoding, as in the mime type. Oops, my bad. Then yeah, as Henry said the base64 unit should help. Depending on who and how the number is to be decoded then, you could also take a look at strutils.Dec2Numb which can convert from decimal into any given number system. (... and the opposite Numb2Dec) -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Converting .doc and/or .html to .pdf
On Saturday, January 15, 2011 22:18 Marcos Douglas wrote: Hi, There are libs, in Pascal, to convert .doc and/or .html files to .pdf? I don't think so, but I would suggest to use a headless OpenOffice.org/LibreOffice for the conversion. Using the Pascal UNO Bridge you may even be able to control it from a Pascal application, but for a simple conversion it's probably a lot easier to just invoke it via commandline. -- Best Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] The new Delphi compatible unicode string
On Tue, 4 Jan 2011 14:20:55 +0200, Juha Manninen wrote: If I told to a Java programmer that Object Pascal features match Java features, how would I prove it? By showing him the HTML component code? IFDEFs and self-made conversion funcs just to support different string types. The Java guy would ask if there is any common unicode string type. I would say Not yet but it's coming, but we can't use it because we must support the old compiler versions. The code also has lots of containers and thousands of typecasts to access their elements which could be eliminated by using generics containers. I would explain to the Java person: Object Pascal already has generics but we can't use them because we must support the historical Pascal syntax. I would also laugh if I was the Java developer. So, the minimum requirements for the modernized HTML component would be Delphi 2009 / FPC with the new unicode support. If a Java developer ever pulls that argument, slap him in the face. Just look at some of the common Java libraries ... for example SWT. It is probably still compatible to Java 1.4 or even 1.3 (hell it could even be 1.2). For that reason it doesn't use generics and not even enums (which came with Java 1.5 ... yeah, no real type safety in that regard until then). It also took until Java 1.5 to have a for-each loop, so even in that regard FPC isn't really behind. But Java is a bad example anyway ... if you read the fine Execution in the Kingdom of Nouns[1] by Steve Yegge, FPC will get a pretty good look ;-) (Although he doesn't mention FPC, the points he makes with C++ match FPC just as well). Best Regards, Andreas. [1] http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Reading MDB (MS-Access) data under Linux
On Mon, 01 Nov 2010 13:34:00 +0100, Bo Berglund bo.bergl...@gmail.com wrote: Just tacking on the other MS database MSSQLServer: Is it possible to also work with MS SQLServer databases via ODBC on FPC from Linux? Obviously the SQLServer must be running on Windows so this is about network access to the database engine. When I make data sources in Windows for these databases I do not use ODBC but a native SQLServer driver, is such available also on Linux? Bo Berglund I only know of a unixodbc driver called FreeTDS. I successfully connected to a MSSQL Server 2008 from my FPC application on Linux, using unixodbc, freetds and sqldb :) Best Regards, Andreas Schneider. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can variables be declared within a block?
for (int i = 0;...) Can't see anything wrong. I use declaration of variables inside blocks quite often in Java and C++ but have never missed it in pascal. Please enlighten me. What is so bad about creating temporary variables inside blocks instead of the beginning of a function in a language that supports it? R. But it should make you wonder why this is no longer allowed in the latest C++ standards. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can variables be declared within a block?
But it should make you wonder why this is no longer allowed in the latest C++ standards. What do you mean? The current C++ standard (ISO 1998+TR1) permits short scope declarations. Indeed, C++ permits declarations to appear anywhere, not just after a { to open a function or compound statement. It has done since the A.R.M. days, and in some implementations before that. You are correct. Been a while since I programmed in C++. The new standard enforces that the short scope variable declared in a for loop goes out of scope at the end of the loop. Older implementations did not always enforce this. My bad. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TFileStream and stdin - how to make this work?
On Sun, 03 Oct 2010 15:05:10 +0200, Bernd Kreuss prof7...@googlemail.com wrote: Hi, this might be a stupid question but I find myself again struggling with file IO and stdin/stdout. I am trying to do the following: StdIn := TFileStream.Create('/dev/stdin', fmOpenRead); and later on i want to poll whether there is something to read. I want to try reading binary data that will be piped to my application and i need to poll (non blocking!) and in case of incoming data read the first byte to determine the type of message that has arrived and then read the rest. The Stream seems to be able to read when there is something to read on stdin but I cannot find any way to actually test whether the ReadByte() will block (nothing to read) or whether there is data available. the properties size and position both are always $ and the stream has no eof property. Can this be done at all? And is my way of opening the stream correct? What would be a more platform independent way of opening the stdin as a stream to read binary data or is there a different and better way to do this, maybe a stream is not the correct thing for this at all? How do I poll and read binary data from stdin? Bernd You could use TIOStream from the unit iostream. AFAICS that should do exactly what you want - i.e. opening stdin/out/err as a TStream descendant. I don't know however, if that fixes the problem you have with the stream blocking when nothing is to be read. If nothing else helps I guess you could use a thread to read the data from stdin, then it shouldn't matter if it blocks. Best regards, Andreas. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] ARM-Cortex port
I know that FPC works under ARM+Linux. Is this also true for the Cortex version of ARM? One of our major applications is written in C++ simply because it is to run in the future on an embedded system as well as the PC. Well the embedded processor has been chosen - the Luminary (TI) ARM-Cortex processor. Will FPC run on this processor? Does anyone have experience? If FPC runs I may be able to convert my last C++ app to pascal. Thanks, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ARM-Cortex port
Thanks Jonas and Jeppe for your answers. I will probably wait then to switch (or try to convince the company to use an ARM-9) On 23/8/2010 11:21 AM, Jeppe Johansen wrote: Den 23-08-2010 16:09, Andreas Berger skrev: I know that FPC works under ARM+Linux. Is this also true for the Cortex version of ARM? One of our major applications is written in C++ simply because it is to run in the future on an embedded system as well as the PC. Well the embedded processor has been chosen - the Luminary (TI) ARM-Cortex processor. Will FPC run on this processor? Does anyone have experience? If FPC runs I may be able to convert my last C++ app to pascal. Thanks, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal From my findings Luminary is Cortex-M3 based, in which case there's needed a base code RTL for it. FPC will generate code for it, and it should generally work, but it's not very optimized yet(other than generic optimization), and there are many unsupported inline assembler instructions(primarily special system instructions). But there are ofcourse workarounds for the assembler code Currently there's only half working stub code for the STM32F103 Cortex-M3 based chip, but I'll gladly help if you have any questions Regards, Jeppe ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Hashmap for integers
On Sun, 22 Aug 2010 17:05:21 +0300, Juha Manninen (gmail) juha.mannine...@gmail.com wrote: Hi Is there an implementation of a hash map where the keys are integers. It is needed when the integers are too big for a lookup array. I only need check the existence of keys so the data type is not important. About like this: uses fgl; type TIntMap = specialize TFPGMapInteger, Integer; //Maps Int -- Int var Len: integer; SeenLen: TIntMap; // or whatever the type is called ... if not SeenLen.Has(Len) then begin ... work with Len ... SeenLen[Len] := nil; // If the data type is pointer end; A related question: What is the state of the generic containers now? FPC 2.4.x should be fine with generics, although 2.5 is still more advanced in that sector. Best regards, Andreas. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OFF TOPIC - how I can migrate of Delphi to FPC
On Sun, 15 Aug 2010 09:59:10 -0300, Marcos Douglas m...@delfire.net wrote: Zeoslib uses ADO too. So, it could be used with MS SQLServer. I think Zeoslib is more faster than ODBC. That depends on the platforms you want to target. AFAIK ADO is Windows-only, so you bind yourself to Microsoft platforms. If you intend to use *nix too, ODBC is the safer way to go, thanks to unixodbc (which can use FreeTDS, a free implementation of the Sybase protocol as used by Sybase and SQL Server). If you have the necessary time at hand, you can maybe implement your own backend for SQLDB/ZEOS that directly uses FreeTDS, completely skipping ODBC/ADO and still being platform independent. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] LNet
Am Freitag 11 Juni 2010, 18:50:56 schrieb Felipe Monteiro de Carvalho: And from my tests Get is indeed returning the amount read. I still don't know if half a packet could be received in the OnReceive event or if it only returns an integer amount of packets. That makes difference in the algorithm to separate the packets. IMHO your packets (not the TCP ones, I mean you own protocol) should always account for incomplete packets. Advantages: you can send more than the TCP window allows (which is usually around 60k bytes IIRC), and it doesn't matter if you get more than one packet with your Get - which also can happen. I usually keep a pretty simple binary protocol. A Packet consists of a Packet ID (byte or word or whatever amount of possible packets you need), and if that doesn't imply the size, that one too. So let's say packet IDs 1 to 5 are fixed size, I wouldn't need to supply their size too - would be a waste of bandwidth. Packet ID 6 however contains a text, so right after the packet ID I also send the expected packet size. On Receive, I write all that Get returns into a buffer (a queue to be more precise). Then I loop through that buffer for as long as it contains data and as the size of the buffer is equal or greater than the size of the next packet. Once I'm out of that loop, I get back to the wait-for-more state (i.e. Get, Get, Get :D) I do the same when sending: I put everything to send into a buffer, and then send it in as much chunks as necessary - Send will return how much it actually sent, that's the amount I take out of my send-buffer, and repeat, until the buffer hits zero or until the amount Send returns equals the amount in the buffer (whatever you prefer). If you want to see that implementation, let me know, it's opensource anyway. Best Regards, Andreas. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Crosscompile FPC from Win32 to Linux
I have a stable cgi program running in windows (no libraries - simple writeln). However, our web host is in linux. Is there a simple way for me to cross-compile the app? or is it easier to learn how to use linux and do it there? I saw a page how to crosscompile lazarus, but it seamed very complex. P.S. fp.exe lets you select a linux output, but it doesn't work. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] creating a standalone executable (eg: application installation file)
Hi, that works the same as in Windows and can probably be done with every executable format. Simply append the data to the end of the file and store the offset or length of that data at the end. All you have to do then is to let the program open itself (ParamStr(0)), seek to the end - SizeOf(Integer), read that integer to know the offset of the data, seek to that position, and read all you need from there. So essentially your file looks like: original executableinstall datadata offset (Of course you can also include the data offset hardcoded into the executable, but that's a bit harder to manage ... first compile to know the exe size, then change the constant storing that size, and recompile again ...) Best regards, Andreas. Am Dienstag 12 Januar 2010 13:37:26 schrieb Graeme Geldenhuys: Hi, I have seen a few Linux application that have standalone executables that are installation programs. Once run, it installs the application in the appropriate directory location, can run as root or normal user and creates a desktop and Application menu icon. Similar to Windows's setup.exe idea. An example of such a Linux application is 'installpixel32' from the Pixel32 project, or Kylix 3 installation. * How does one create such a standalone application? * How do you include the application executable and other resources (text, image, sound files etc) inside such an installation executable? I'm trying to create (mainly for our company, but probably open-source in the end) such a standalone setup creation for our projects. This way it will be Linux distro independent. I also don't want to go the route of projects like AutoPackage that first requires a setup runtime to be installed. I want a installation file like what Pixel32 did. One installation executable without any installation runtime etc. and after the installation, I can simply click on 'uninstall' or run 'setup -u' and a graphical uninstaller is launched. I'm going to look at Loki Games's setup program to see if I can port it to fpGUI Toolkit, or at least get some ideas of how to create such a setup application. Basically I'm trying to create a InstallShield Lite but for Linux. :-) The nice thing of Loki Games is that it run run as a console installation or a GUI installation - again, no idea how they managed that, but it was possible (Kylix 3 installation did that). Anybody have pointers or internet links I can read up on the subject? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: creating a standalone executable (eg: application installation file)
I think if digital signing is required, using Windows Resources would be the better way. Now that I think about it, with FPC 2.4 that should even be possible on Linux (and other platforms). Many roads lead to rome :D Am Dienstag 12 Januar 2010 14:17:21 schrieb Milan Marusinec: Andreas Schneider wrote: Hi, that works the same as in Windows and can probably be done with every executable format. Simply append the data to the end of the file and store the offset or length of that data at the end. All you have to do then is to let the program open itself (ParamStr(0)), seek to the end - SizeOf(Integer), read that integer to know the offset of the data, seek to that position, and read all you need from there. So essentially your file looks like: original executableinstall datadata offset Andreas, Will this method work when the exe is digitally signed afterwards (or before) ? (tough, for linux it doesn't matter) Milan ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Forum merger
If I made one, then I'll make it using Powtils (fully CGI) or ExtPascal (fully Ajax) because that's what I know and have been experience with. I myself prefer to use fpWeb since it's provided by FPC's FCL. No third party dependency is good for new comers, and it's also better FPC/Lazarus promotion. I also intend to study fpWeb and would try to combine it with ExtPascal, if possible. I vote for a CGI approach (Then I could help). A sub-vote would go for fpWeb (Just need to find some good documentation for it), but I would accept Powtils. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Forum merger
Yes, this is it. I don't have any experience in building web-applications with Pascal, but if someone registers a new project at Gitorious or somewhere else I would like to help as far as I can. As would I. I will soon need to write a CGI program, and this would be a great way. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Class Operators
Hi, since my reported bug (http://bugs.freepascal.org/view.php?id=15315) seems to turn out to be by design, a question came up: are there any plans to implement class operators? In delphi they are implemented to allow operators to affect instances of classes. This would also enable to write operator overloads that work with generics. A good example of that would be smartpointers. A small snippet from an example in delphi: TSmartPointerT: class = record strict private FValue: T; FLifetime: IInterface; public constructor Create(const AValue: T); overload; class operator Implicit(const AValue: T): TSmartPointerT; property Value: T read FValue; end; There are surely other cases where class operators would fit in nice. They could for example allow to build something like TPersistent.Assign as := operator. Is this already on a todo-list or am I out of luck here? Thanks, Andreas. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Free Pascal created libraries used by other languages
Am Mittwoch 09 Dezember 2009 15:26:11 schrieb Graeme Geldenhuys: But clearly this language relationship is a very one-sided thing. We use their (C/C++) libraries, they don't use ours. :-( Just look at the QT bindings. The LCL can't simply use QT, it has to use a wrapper library that flattens the object oriented structure of QT. You have similar problems with most languages. Writing bindings to foreign language libraries is always problematic. C (i.e. a flat API) is usually the common denominator. Best Regards, Andreas. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Persistent blocks in Lazarus
On Thu, Jul 16, 2009 at 01:36:15PM +0200, Andreas Berger wrote: Out of curiosity (because I never used this feature in any editor), what would you use it for? Persistent blocks and the full Wordstar keyboard shortcuts is why I use the Delphi IDE until today. If you miss wordstar stuff, please list it. Well, maybe I should use the Lazarus IDE again for a bit a jot down what I would like. I may even soon have time to help add some options. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Persistent blocks in Lazarus
- The Keyboard layout/scheme for wordstar ? How different is that from current default, or classic-scheme default? I modified the classic-schema a few years ago to be mostly wordstar correct. What I didn't do at the time was add persistent blocks. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Persistent blocks in Lazarus
Out of curiosity (because I never used this feature in any editor), what would you use it for? Persistent blocks and the full Wordstar keyboard shortcuts is why I use the Delphi IDE until today. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Question about operator overloading and classes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everybody, I'm toying with operator overloading and classes. For example I want have a class that stores a value (of some type) and related to it additional information. For example imagine a class that stores a value and the associated unit: value=10, unit=px, plus whatever. Normally you have than two or more Properties which you will set one after another. In the spirit of the example let us imagine the property will be called left, so left.Value := and left.Unit := have to be called. I also would like to read from this class. I can overload the assignment operator := in order to convert the class to a string s: s:=left; and s would be '100px'. The problem: I can't read the Value directly into an integer i by: i:=left; // instead of i:=left.Value . If I try to overload the := operator a impossible operator overload error is raised. Is this related to the pointer-operator-overload thing? Better would be to declare left.Value as the default property for integer assignments. Either way I don't see why current limitations are useful: integer/pointer to class or default properties only on indexed properties are in my opinion only important if the a unique decision by type is not possible. Especially because a to-string assignment works in every case. Only ordinal types like integer,byte, boolean,char are blocked. I suggest to rethink it. Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) iEYEARECAAYFAkoQRSkACgkQfp5vA04Sl1aJUwCfUOrqMiAv0YTST0mHk5Eq0CdV n5gAoIRGfDgTxxMUzZMBOa/3AcB0BVg9 =GYEf -END PGP SIGNATURE- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] proxy for sql
This isn't really a FPC question, but since the application is being written in FPC I thought I would ask here. I am developing an application that controls machinery. The application will store everything that happens in a SQL database. Some clients (restricted) should have permission to access the database to generate their own reports via some 3rd party report generation software of their choice. However I want to restrict who has access without placing a user password on the SQL server since some clients purchase multiple instances of the SW but not all options. 1) Is it possible to place my app between the 3rd party app and the SQL server? How would I do this. 2) Is it possible to configure the SQL server to query my app to see if a user can log on? 3) Any other ideas? Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] proxy for sql
Martin Friebe wrote: Here is another idea. You would still need a user on the DB, to limit what can be accessed. But to check if access should be granted (allow or deny tcp) you can use your own software. All you need is some sort of Proxy/socket forwarder, that you can implement using FPC. The Tool would run on the users local PC or Server. It would accept connections for the database, and forward the Connection straight to the real DB (or maybe encrypt it, using whatever access control). Of course if the user is not allowed to connect at all, you do not make the forward. The user could have a key(public/private), so if you remove the opposite on the server, the user can no longer connect. However this acts like a tunnel, so you do not get any control on the SQL itself. The SQL server needs to be configured to restrict access to the permitted data. Best Regards Martin Thanks Martin for the idea. Actually I had already thought of this. The problem is that 3rd party report programs connect directly to the SQL server. I would need a password or some other ID to know that THIS 3rd party prog is allowed to enter, so a direct tunnel is not possible. The only way might be for me to capture the user and password handshake, test if the user\password is correct for my app and then substitute it with the real user\password or cut the connection. But for this I would have to interpret the logon sequence and I have no idea how that works. Regards, Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Creating FPC enabled websites
I'm interested to know why no one mentioned powtils yet (other than the original poster). I also am looking into writing a fairly complex CGI program and powtils seems very promising. And comments? Marco van de Voort wrote: In our previous episode, Francisco Reyes said: Marco van de Voort writes: Sorry, old name, nowadays it is fcl-web. See packages/ Don't see it at http://www.freepascal.org/packages Is there where I should look? In the source. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] html and chm help (lcl, fcl) translation in other languages ?
I know, that this this is not a theme yet. But for a lot of people it is interesting to have help in their foreign language. When i have more knowledge about the process of generating and using the helpsystem in fpc way of working, i will use a seperate directory and changed nameschema. THX for your help Felipe Monteiro de Carvalho schrieb: I think you can work on that even if there isn't yet a decision about your question. If it turns out to be different from what you made, just rename the files. I would suggest a new directory. Too many files in the same directory make it hard to find things. Andreas Frieß schrieb: when i search for the lazarus help system with html and the comming chm, i didn't find information about the creating this, for other languages. It is not clear for me, how to handle this. The study of the structure of the svn and the search inside of the wiki and the docs didn't make it clear for me 1st Question: Should this handled by extension of the xml-files like English: actnlist.xml German: actnlist.de.xml or creating a new 'docs-de' (beside the current 'docs')path ? i found only, fpdoc should be able to handle some languages by using an comandlineoption. 2nd Question: Are there more information about this theme available, or a designguide? (I know the source of the fcl/lcl documentaion) It is interesting for me, because i will spend time in documentation (in german for germans) for the project. I see with the LazInfos (in German only) the people want documentation in their native language. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Connecting SQL components to a propriety SQL server
I have a friend that has a product which is composed of an embedded system spread around Brazil and communicating with a central PC. I am convincing him to migrate some of his PC tools to Pascal in order to ease my help for him. The question I have is this: He has his own small SQL server on some of these embedded cards and I would need to establish a connection via the database components in Free Pascal to his SQL. I know nothing about SQL, only that Free Pascal has interfaces to various SQL servers. How hard would it be to make an interface to his SQL servers? It depends very much. Does he have an API to access this SQL server ? If so, it's just a matter of using this API to create an TSQLConnection. If the connection happens on a low level, then it will be a bit harder. By API do you mean an interpreter of the SQL commands, then yes. The connection is made either via Internet/TCP or Modem/PPP. Andreas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal