[Lazarus] First pas2js public release
Hello fellow Pascal enthousiasts, It is with great pleasure that I can finally announce the first publicly available version of pas2js. A "beta" version, version 0.8.39. The endpoint (for the time being) of nearly 10 years of (slow) development. pas2js is a Object Pascal to Javascript transpiler. It compiles Object pascal, and emits Javascript. The javascript is usable in the browser, and in Node.js. It is open source, and part of FPC/Lazarus. This makes Free Pascal a full-stack development environment for Web Development: You can use it to program the server and the browser alike, all from within the environment you love so much :) What does pas2js include ? -- * On the language level: It supports basically Delphi 7 syntax, interfaces excepted. Naturally, any memory pointer operation is not possible in Javascript. Code that relies on this will not work. This is just the first version, we of course want to add the same language features that exist in Delphi and FPC today. * On the runtime level: Beside the compiler itself, there is a basic Object Pascal RTL, and several units from the FPC Packages are also available: system sysutils Math strutils rtlconst classes contnrs DB (yes, TDataset) fpcunit testsuite custapp restconnection js (javascript system objects) web (browser provided objects) libjquery (jquery is available too) nodejs (basic node runtime environment) typeinfo objpas browserconsole (support for writeln) dateutils browserapp nodejsapp * Debugging: Obviously, the browser debugger can be used to debug the Javascript. But there is more: the compiler can emit a source map, and this means that if the browser finds the source file, it will display the original source file instead of the javascript. You can debug Object pascal in the browser. * Demoes ? The package has several demoes, including FPReport, TDataset, JQuery and Bootstrap. * Documentation ? As befits an open source project, docs are lagging behind :/ But a WIKI page has been started, it will be expanded as time permits: http://wiki.freepascal.org/pas2js * Sources ? The pas2js compiler sources and RTL sources have been checked in in FPC's subversion repository. The page describes where to find it in SVN. * Binaries ? A snapshot is available: http://www.freepascal.org/~michael/pas2js/pas2js-demo-0.8.39.zip * Reporting bugs ? The FPC bugtracker has now a 'pas2js' project, it can be used to report bugs. * Can you help ? Yes, of course. There is still a lot of work to be done. Feel free to contact me or Mattias Gaertner with questions. What about Lazarus ? Lazarus "understands" the extensions to object pascal (for importing Javascript classes) that were borrowed from the JVM version of the compiler, so the code completion will continue to work. Using the pre-compiler command, CTRL-F9 just works. On error, you will be shown the error location etc. Further and deeped integration of pas2js into lazarus is expected. In the first place, IDE integration. Later on, a real widget set for the browser can (and hopefully will) be created. But that is not all ! - In the very near future, a major Delphi component vendor will announce a complete package for RAD web development in the Delphi IDE. The expectation is that later on, the exact same components will be usable in Lazarus. In essence, the component developer has created a complete browser widgetset. More than 100 controls are available. Using this, you can design a web application as you design a desktop app; Fully RAD, as you are used to. But even more, you can bind controls on a form to existing tags in a web page, thus preserving the style in the web page. The first demoes for a selected audience have evoked very positive feedback indeed. All this is based on pas2js. As soon as I receive permission, I will announce here where it becomes available. Lastly! --- On a more personal note, I wish to explicitly thank Mattias Gaertner for finally finishing what has been started a long time ago. Without him, none of this would have been possible. The same is true for Detlef Overbeek, editor of Blaise Pascal magazine, without his moral and financial help, it would have taken many more years to finish this. It is - for me - a long standing dream finally come true. Enjoy ! Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus Release 1.8
On Mon, 11 Dec 2017, Luca Olivetti wrote: El 11/12/17 a les 13:43, Michael Van Canneyt ha escrit: [*] I don't know if freeing a thread in OnTerminate is allowed. FPC documentation here https://www.freepascal.org/docs-html/rtl/classes/tthread.onterminate.html says nothing about it, but the example here (mentioned in the bug report) http://docwiki.embarcadero.com/CodeExamples/Tokyo/en/TThreadYield_(Delphi) seems to imply that it should. It is definitely not allowed in FPC, and I will document it as such. Ouch, that's not delphi compatible then (unless the example is flawed). In any case it's better to be not compatible and clearly documented than vaguely documented and maybe (just maybe) compatible (i.e. I don't really care about delphi compatibility since I don't use it, but sometimes you have to rely on delphi examples/documentation). The following is clearly nonsense: FThread.FreeOnTerminate := False; // Free FThread in the OnTerminate proc. This will set Terminated to true Terminated is already True in OnTerminate. So I think the example is flawed. From the TThread implementation: if (FThreadID = GetCurrentThreadID) then begin if not(FFreeOnTerminate) and not FFinished then raise EThreadDestroyCalled.Create('A thread cannot destroy itself except by setting FreeOnTerminate and leaving!'); I think we cannot be more clear than that :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Lazarus Release 1.8
On Mon, 11 Dec 2017, Luca Olivetti via Lazarus wrote: El 09/12/17 a les 11:57, Luca Olivetti via Lazarus ha escrit: I know I'll have to upgrade to fpc 3 someday, but what worries me about it is my (and other 3rd party units) use of ansistrings as binary buffers. I did some quick tests some time ago an nothing seemed broken, but I'm somewhat reluctant since my software has to run unattended 24/7 (or more like 24/5). I've done some tests with 3.0.4 and it turns out I'm bitten by the extensive changes in tthread: freeing a thread in its OnTerminate[*] randomly (i.e. not every time) produces a sigsev (under win32). With 2.6.4 it didn't happen (though freeing a thread in OnTerminate had another problem undes Linux, see https://bugs.freepascal.org/view.php?id=32759) [*] I don't know if freeing a thread in OnTerminate is allowed. FPC documentation here https://www.freepascal.org/docs-html/rtl/classes/tthread.onterminate.html says nothing about it, but the example here (mentioned in the bug report) http://docwiki.embarcadero.com/CodeExamples/Tokyo/en/TThreadYield_(Delphi) seems to imply that it should. It is definitely not allowed in FPC, and I will document it as such. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fcl-web (WebLaz) - Duplicate Module Error
On Sun, 10 Dec 2017, African Wild Dog via Lazarus wrote: 2017-12-10 16:26 GMT-02:00 Michael Van Canneyt via Lazarus < lazarus@lists.lazarus-ide.org>: The idea was to have some kind of state: - OneShot: no state. a webModule is recreated on every call - pooled: a webmodule is created once and remains in memory during the lifetime of the server application. - Session: a webmodule is created once per session. I never got around to finishing it, it is stil on my todo list. So, should i report a bug for the wkPooled case? You can, yes. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fcl-web (WebLaz) - Duplicate Module Error
On Sun, 10 Dec 2017, African Wild Dog via Lazarus wrote: 2017-12-10 14:34 GMT-02:00 Michael Van Canneyt via Lazarus < lazarus@lists.lazarus-ide.org>: Set the 'Kind' property to wkOneShot. Michael. Done. It worked! What is the function of the "kind" property? The idea was to have some kind of state: - OneShot: no state. a webModule is recreated on every call - pooled: a webmodule is created once and remains in memory during the lifetime of the server application. - Session: a webmodule is created once per session. I never got around to finishing it, it is stil on my todo list. For a CGI, they are of course all the same. Only for standalone, fcgi or apache modules does it make sense to have pooled/session. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fcl-web (WebLaz) - Duplicate Module Error
On Sun, 10 Dec 2017, African Wild Dog via Lazarus wrote: Hello, Please confirm if this is a bug: I have created a HTTP Server Application project and added a module called "test_module" with an action "test_action". When i run my application, when i access " http://localhost:8080/test_module/test_action"; for the first time it works, but in the subsequent requests (like refreshing the page) i get the error '*Duplicate name: A component named "test_module" already exists*'. Environment: Debian Stretch 64 bits - fresh Lazarus 1.8 install Set the 'Kind' property to wkOneShot. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] translation of oss' soundcard.h
On Mon, 27 Nov 2017, Marc Santhoff via Lazarus wrote: Hi, has soundcard.h from OSS API already been translated to Pascal? OSS is used for accessing soundcards and MIDI devices by Linux and FreeBSD. Not that I am aware of. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Quick Video: A Web Application
On Thu, 9 Nov 2017, Michael Schnell wrote: On 08.11.2017 16:39, Michael Van Canneyt wrote: .. I believe that you should embrace the platforms you're using. That means: browser as client, webserver as server, and HTTP or websocket as the transport layer. This depends on who is "you" :) . Everybody wishing to develop for the web or browser. I've already been doing some " Lazarus Community" work (I do have a working draft for an "application" Widget Type that does not do a GUI binding, as an extension to the NoGui Widget Type, but stop working on it due to the complexity of publishing any of it), and so "you" might be the creator of Lazarus means to provide such a framework managing the clint/server communication in some (yet undefined) user friendly way. We are busy creating this framework. But Rome wasn't built in a day. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Quick Video: A Web Application
On Wed, 8 Nov 2017, Michael Schnell via Lazarus wrote: On 08.11.2017 13:12, Michael Van Canneyt via Lazarus wrote: ExtPascal way (or UniGUI for that matter) is the wrong way to do things. Interesting as a toy, but not suitable for a) Large, scalable websites b) serveless applications. Agreed ! But if doing a server based application (ore one that includes the web-server) that mainly does unattended, "embedded" work, and tghe GUI is only used for configuration and monitoring, such a toy-functionality might be useful, nonetheless. Maybe, but since we're aiming for the more general case, this 'toy' is an avenue we're going to skip... From the view of the application programmer, doing a Rich Internet Application with pas2js is a similar endeavor as Microsoft intended by Silverlight (which has been canceled some time ago) : Design an application and define "bridging points" that "somehow" shift the execution between server and browser. With Silverlight, both parts would be compiled to CIL byte code and run an a CIL (aka .NET) framework, with fpc, the server part would be compiled to a native executable while the Browser part would be compiled to JS (or maybe later to WebAssembly). The user source code would not necessarily need to contain much more than appropriate definitions of the bridging points (supposedly some kind of inter-class interface), and the Lazarus infrastructure would take care of the communication. I think you're better off coding it as a real client/server application, which is what it actually is. Trying to hide that aspect is IMO futile and will in the long run lead to problems anyway. I spent too much time fighting such frameworks, and believe that you should embrace the platforms you're using. That means: browser as client, webserver as server, and HTTP or websocket as the transport layer. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] Error when copying to clipboard.
Hi, When doing a copy to the clipboard from the IDE source editor, lazarus adds the terminating NULL. This is wrong and sometimes causes errors. Select text in IDE. Copy to search/address bar of browser. hit enter. Results in following query being executed: https://www.google.be/search?q=TObject%00&oq=TObject%00&ie=UTF-8 Notice the %00... If you position the cursor at the end and press backspace in the search bar/address bar, you'll see that the readable text is not actually becoming shorter, because you are then deleting the terminating null... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Quick Video: A Web Application
On Wed, 8 Nov 2017, Leonardo M. Ramé via Lazarus wrote: El 08/11/17 a las 04:57, Michael Van Canneyt via Lazarus escribió: There is. Normally, early december a RC version of pas2js will be released. pasjs currently is more or less at the level of D7 compatibility (minus interfaces and pointers). There is a web-based compiler (i.e. you can do 'hot reload' as found in many web development systems) etc. Many basic RTL units work, there is access to all browser features or node.js. you can import any javascript library (e.g. jquery is available) using an import unit. TDataset now also works, pas2js will ship with simple REST connection and JSON Dataset components. In short, everything to develop Pascal programs that run in the browser: FPC will be a full development stack for web applications. It will also be fully integrated in Lazarus. Michael. Hi Michael, I wonder how the import unit is created. For example, I use a library called Tabulator (a fantastic grid) I would like to interface with pas2js, should I do the interface by hand or is there an automatic method?. There is a unit that can partially do it for you. It will create an external class definition in pascal based on a javascript object instance. But it is limited in the sense that you will need to provide types and names of arguments to functions. (javascript does not make them available) I did the units web/js/libjquery by hand, from documentation. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Quick Video: A Web Application
On Wed, 8 Nov 2017, Michael Schnell via Lazarus wrote: On 08.11.2017 12:28, Michael Van Canneyt via Lazarus wrote: It is the basic building block. I do agree that it is a very viable building block, but theoretically for "Rich internet Applications" there are alternatives: - WebAssembly (which as far as I understand is considered for fpc, and I suppose it might get started after pas2js is released, as it partly might be based on same. ) - using a 3rd party JS based GUI framework (like EXTJS/EXTPASCAL, which is very expensive/depreciated/dead), or e.g. "React", which might be not decently suited as a target for the Lazarus GUI builder. ExtPascal way (or UniGUI for that matter) is the wrong way to do things. Interesting as a toy, but not suitable for a) Large, scalable websites b) serveless applications. pas2js can use extjs or react or even angular, if you so choose. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Quick Video: A Web Application
On Wed, 8 Nov 2017, Michael Schnell via Lazarus wrote: On 08.11.2017 08:57, Michael Van Canneyt via Lazarus wrote: Normally, early december a RC version of pas2js will be released. I understand that the issue of this thread is using Lazarus to do a server based "Rich Internet" application that shows it's GUI in the browser. So pas2js is only part of the game. It is the basic building block. Without that, no browser development in pascal. All the rest is secondary and will be worked out in due course, but the first no-code Data-Aware applications are already working, so we're on the good track. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Quick Video: A Web Application
On Wed, 8 Nov 2017, Marcello via Lazarus wrote: On 30/04/2017 21:42, Michael Van Canneyt via Lazarus wrote: I'm afraid that the world is still waiting for a good GUI designer for web. We will deliver it :) Can you share with us when? :) Current tentative schedule is september. But no guarantees. It doesn't depend only on me :) But today an important milestone (for me) was reached, so there is hope :) Michael. This news is really interesting. Are there any information about it? There is. Normally, early december a RC version of pas2js will be released. pasjs currently is more or less at the level of D7 compatibility (minus interfaces and pointers). There is a web-based compiler (i.e. you can do 'hot reload' as found in many web development systems) etc. Many basic RTL units work, there is access to all browser features or node.js. you can import any javascript library (e.g. jquery is available) using an import unit. TDataset now also works, pas2js will ship with simple REST connection and JSON Dataset components. In short, everything to develop Pascal programs that run in the browser: FPC will be a full development stack for web applications. It will also be fully integrated in Lazarus. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Howto disable Lazarus IDE using a XFCE dark theme
On Tue, 7 Nov 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-11-06 23:58, R0b0t1 wrote: Integrated theming is a good idea because unless all assets are obtained from the windowing toolkit then there is no way to know they will mesh well with a given color scheme. As the saying goes: “You are preaching to the choir”. ;-) I fully agree with you, hence fpGUI Toolkit supports individual application theming. As standard, every fpGUI application can also switch between the 8 built-in standard themes with the --theme command line parameter. http://geldenhuys.co.uk/~graemeg/themes/start.html GTK can do this out of the box. https://unix.stackexchange.com/questions/14129/gtk-enable-set-dark-theme-on-a-per-application-basis No doubt, so can Qt. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] PlotFunction patch declined?
On Tue, 7 Nov 2017, Werner Pamler via Lazarus wrote: Am 07.11.2017 um 13:42 schrieb Michael Van Canneyt via Lazarus: I don't see why you would need a separate package. fpexprparser is in the FCL since 10 years or so. A separate unit is definitely good so as to minimize the dependencies of the basic tachart unit, but a package ? Seems overkill to me ? Maybe I am paranoid here or oversensitive because it has never been clear to me whether "unused" code is linked into a program or not. When there is designtime or initialization code "unused" code may be called internally although it is never called explicitly by the program itself. To be specific: How much of the otherwise unused fpexprparser is linked into a program if the initialization code of the TExpressionSeries unit adds the series to the list needed by the series editor at designtime? Probably none, but I am not sure... Therefore I follow the strategy to keep packages as slim as possible and I want them to contain only the code they need for their main job. For TAChart, the main job is to plot data, not to evaluate functions. Therefore, the formula parser should stay outside the chart package in this way of thinking. In particular since there are other libraries to parse math expressions, such as "symbolic" which is distributed along with fpc as well. Of course, runtime code should be separated from designtime code in the first place. Well, that was going to be my question. Designtime should be separated from runtime to begin with. Normally you should have 2 packages. One runtime, one designtime... But if you make the expression chart a different component in a different unit, (as I suggested) then it will not link in the fpexprparser unit at all unless you actually use this component. But I know too little about the TAChart architecture to comment further. These values can only be handled in code. Of the three, itFunctionHandler can be handled by using an event handler. But itFunctionCallBack,itFunctionNode make no sense in the designer. This means: If I select itFunctionHandler then the events OnGetFunctionValue and OnGetVariableValue are fired? In this case TPlotExpressionPanel would behave like TPlotFunctionPanel? The event of the collection item will be triggered if you use itFunctionHandler, yes. But obviously only during runtime. BTW I was suprised to see a collection editor here although there is no explicit code defining it. But then I realized that it's just the clever usage of the word "published" and the selection of the specific inherited class which achieves this. It is amazing how seamlessly the design editors of Lazarus are integrated. Hm. I no longer even think about such things. It's just normal. Shows how spoiled I am, I guess ;) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] PlotFunction patch declined?
On Tue, 7 Nov 2017, Werner Pamler via Lazarus wrote: Am 07.11.2017 um 12:50 schrieb Michael Van Canneyt via Lazarus: I see that I missed to commit a patch to plotpanel, because here sin(x) works. I have too many unfinished patches in my source tree :/ Should I still commit it, or it is not necessary any more ? Please commit it. I think we should fix the shortcomings of plotpanel. There were already a few bugs which I fixed - look at the svn commit notes. I'm just against adding too many new features which just will be appetizers for even more new features. OK. In the meantime I put the TExpressionSeries into the standard TAChart package where everything works fine (in order to remove the dependence on fpexprparser, maybe I'll move it to a separate package later once I know how to get the registration for the series editor done). I don't see why you would need a separate package. fpexprparser is in the FCL since 10 years or so. A separate unit is definitely good so as to minimize the dependencies of the basic tachart unit, but a package ? Seems overkill to me ? Here are short instruction how to use it * Add a TChart on the form * Double-click the chart * In the "Edit series" dialog select "+ Add" and "Math expression series" at the very bottom. * In the Object Tree, select the newly added serie, Chart1ExpressionSeries1 * Enter the function term, e.g. 'sin(x)*exp(-0.1x)' * Define the x range for which the function will be plotted: Select "Range", enter the minimum and maximum x values, e.g. XMin = 0, XMax = 50, set UseXMin and UseMax to true in order to apply this axis range. * Set AutoExtentY to true in order to auto-scale the y axis. * Voila - see the attached screenshot (which is taken at designtime, of course). Michael, the expression panel allows to add identifiers at designtime. I do understand this for variables, and, in fact, this is great to parameterize the function or to use natural constants. But the IdentifierType can also be itFunctionCallBack, itFunctionHandler, itFunctionNode. Can you explain how these should be handled in practice? These values can only be handled in code. Of the three, itFunctionHandler can be handled by using an event handler. But itFunctionCallBack,itFunctionNode make no sense in the designer. For simplicity, the plot panel uses the default collection editor, so the other values are exposed as well in the designer. A specialized collection editor would simply hide these possibilities. (and would also disallow editing the X variable) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] PlotFunction patch declined?
On Tue, 7 Nov 2017, Werner Pamler via Lazarus wrote: Am 07.11.2017 um 11:53 schrieb Michael Van Canneyt via Lazarus: Are you going to make sure TAChart can do the plot during design-time ? I am working at it, there are issues with registration of the new TExpressionSeries from a separate package (it's not in trunk, yet). But anyway: why is the designtime argument so important to you? I am _very_ surprised by this question. Because Lazarus is RAD, obviously ? No-code development ? ExpressionPanel cannot plot a function as simple as "sin(x)" at designtime because bcMath is not added to the Builtins of the parser. And if it were, other similarly simple functions such as "tan(x)" would not work because they are not registered. So, the designtime argument has only very limited weight. In your eyes, yes. In my eyes, this is _the_ argument: TDataset has the possibility to show the data at design time. In it's day, this was revolutionary, and still today - 20 years after the introduction there are very little environments that can repeat this. (in fact, I know of none) The same applies for plotpanel. If TAChart cannot show a series in designtime, then that is a huge shortcoming in my eyes. (Never having used TAChart, I don't know if it can or not, this is a hypothetical statement) But of course, there is always the possibility that I am missing some features of the fpexprparser. No, you are not missing it. I see that I missed to commit a patch to plotpanel, because here sin(x) works. I have too many unfinished patches in my source tree :/ Should I still commit it, or it is not necessary any more ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] PlotFunction patch declined?
On Tue, 7 Nov 2017, Werner Pamler via Lazarus wrote: Am 07.11.2017 um 10:55 schrieb Alexey via Lazarus: https://bugs.freepascal.org/view.php?id=32653 wp wrote: >>Sorry I will not fix this one because it opens another Pandora to add features well-established in TAChart. Pls apply the patch. it makes several plots on one panel. What Pandora?? I don't know Pandora, I use Laz and LCL. First: in your patch it is not clear which curve belongs to which function. Therefore, the next thing which will be requested it a legend. I am 100% sure! Second: your patch is valid only for the event panel, not for the expression panel. Next request will be to enter several expressions there; this requires a proper design-time editor. And the more features are added the more requests will come up... In essence, all these patches will add features to the plot funtion panel which are well-established in TAChart. It is a waste of time to bring two charting packages to a comparable level and to maintain them. And in fact, there's even a discussion going on among the developers to move plotfunction out of Lazarus into ccr. Are you going to make sure TAChart can do the plot during design-time ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] DeleteFile
On Tue, 31 Oct 2017, Agustìn Gregorieu via Lazarus wrote: Hi! I have a CGI program that must delete files from a server and it's owned by www-data which allows me to read a file but not to delete it, even though the file has permissions 777. The folder containing the files I want to delete has permissions "drwxrwxrwx" and it's owned by "root:root" and it's files has the same characteristics. You should check the return value of GetLastOSError. If that does not tell you anything, try stracing your program. For a cgi program, what I usually do is create a shell script which I place instead of the actual binary: #!/bin/sh exec strace -o /tmp/cgi.log /path/to/real/cgi/program.bin Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] "Ambiguous unit found" message
On Tue, 31 Oct 2017, Mattias Gaertner via Lazarus wrote: On Tue, 31 Oct 2017 10:01:38 +0100 Werner Pamler via Lazarus wrote: Since all fixed-size message boxes, sooner or later, will run into this problem: Shouldn't message dialogs be resizable by default? +1 Fixed size dialogs came from Windows and some people forced them to other platforms - sad. Hm. Somehow the use of the word 'sad' at the end reminds me of the tweets of the Orange Emperor... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Who is using Object Pascal in production? (fwd)
On Fri, 27 Oct 2017, Marcos Douglas B. Santos wrote: So. For all these reasons, I use Object Pascal. I can take my 10 year old application, recompile, and be reasonably sure it will still work. WOW... Actually, you have good reasons. I liked. I am asking this because sometimes I cannot make a project if I say that will be coded in Object Pascal. I have heard a client saying: We use C# or . We don't have more Pascal programmers to maintain this. To develop desktop apps, it's not a problem. But if it will be a web app, could be. I will use your text, next time. :) About performance, do you believe that FastCGI is good or even better than these other technologies? It is equally good. For quick&dirty stuff I use plain old cgi. I use FastCGI for performance critical external apps. For some internal apps, I use standalone http server. The web stack of FPC is such that it does not matter which one you use. You can simply recompile your app with a different uses clause and it is switched from cgi/fastcgi/standalone. The rest is a matter of configuring your webserver... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Who is using Object Pascal in production?
On Fri, 27 Oct 2017, Marcos Douglas B. Santos via Lazarus wrote: On Fri, Oct 27, 2017 at 11:32 AM, Michael Van Canneyt via Lazarus wrote: I use it almost exclusively on the server. Webservice, REST related stuff. But there are many domains where Object Pascal still works very well. You've been doing a great job on fcl-web (thanks). I have REST services running on Windows IIS with FastCGI. I would like to ask you: Why not use Node.js, Go, or even Java? Is it just because you know more Pascal or, also, because you have some advantages using it on the server? Where to start ? Go is a very nice language, but is very difficult to get to work with external libraries. Writing imports can be next to impossible. Our server needs to do LOTS of things that simply cannot be done in Go, since Go doesn't have the necessary functionality (or libraries, or modules) so we'd need to offload that to C libs, which kind of defeats the purpose. Java would be a possibility, but a) I don't know Java so well. Java is HUGE. b) Then you need to deal with the Java VM and Tomcat and whatnot. Not pleasant. Recently we had a java service completely unresponsive for 30 seconds, it was doing GC... Not acceptable at all. Node.js is nice for some scripting, but IMO Javascript is not suitable for large applications. Complete absence of type checking or any form of compilation is a disaster for large projects. Additionally, when using Node.js, you almost inevitably come into contact with npm. We built some mobile apps using a web runtime, and typical usage for Node.js is packaging of the app. This typically uses npm. npm pulled in 1200+ npm packages (100+mb), to pack an application of 1200 lines of javascript. Not a joke. I actually checked. And to pack an application in essence means: creating a zip. IMO the people using node.js and npm are deluded, to allow such a mess. Suffices that 1 of the 1200 packages for what reason whatsoever is broken, retracted or whatnot: the whole system comes crashing down... (The upcoming pas2js can target node.js, and I am confident you will not need npm.) To make matters worse, javascript developers have no sense of time. They actually think that completely breaking backwards compatibility after 2 years is OK. For example, the change of Angular to Angular 2 (and subsequent changes) made me decide that Angular is unsuitable for development - despite all the nifty features. The average lifetime of applications I make is many many years. So, backwards compatibility is VERY important. So. For all these reasons, I use Object Pascal. I can take my 10 year old application, recompile, and be reasonably sure it will still work. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Who is using Object Pascal in production?
On Fri, 27 Oct 2017, Marcos Douglas B. Santos via Lazarus wrote: On Fri, Oct 27, 2017 at 10:53 AM, Alexey via Lazarus wrote: What do you think? I think, new langs are for other tasks. Go- for web servers; Rust- maybe concurrent or not (used for browser). JS based langs- for web. Kotlin- for Java. 90% of new langs - for other tasks. And Object Pascal is for... desktop? We can do almost everything with Pascal but people don't see in that way. I use it almost exclusively on the server. Webservice, REST related stuff. But there are many domains where Object Pascal still works very well. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Weird object variables access [SOLVED] - Delphi mode bug!
On Wed, 25 Oct 2017, Ondrej Pokorny via Lazarus wrote: On 24.10.2017 23:18, Michael Van Canneyt via Lazarus wrote: On Tue, 24 Oct 2017, Giuliano Colla wrote: Il 24/10/2017 14:10, Michael Van Canneyt via Lazarus ha scritto: A valid method can never be stored in a pointer, since the former is actually 2 pointers (method/data) and the latter is just 1 pointer. That the assignment is valid is Delphi compatible: only the procedure address is copied. I can confirm it as an fpc bug. No, I'm sorry to say that IMO you did not. I looked at your code. It simply works by accident in Delphi, because you are calling a method of the same object as the caller. Yes, the code is wrong. But the reason is that myMethod is assigned in FormCreate. The later "@myMethod := pMethod;" assignment overwrites only half of the myMethod:TProc variable and so correct Self stays in the second half of myMethod. That is what I wanted to indicate :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Weird object variables access [SOLVED] - Delphi mode bug!
On Tue, 24 Oct 2017, Giuliano Colla wrote: Il 24/10/2017 14:10, Michael Van Canneyt via Lazarus ha scritto: A valid method can never be stored in a pointer, since the former is actually 2 pointers (method/data) and the latter is just 1 pointer. That the assignment is valid is Delphi compatible: only the procedure address is copied. I can confirm it as an fpc bug. No, I'm sorry to say that IMO you did not. I looked at your code. It simply works by accident in Delphi, because you are calling a method of the same object as the caller. Try calling a method of another object, and displaying the classname and make sure you trash the registers between the assignment of the method pointer and actually calling it. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Weird object variables access [SOLVED] - Delphi mode bug!
On Tue, 24 Oct 2017, Giuliano Colla via Lazarus wrote: Il 23/10/2017 22:57, Mattias Gaertner via Lazarus ha scritto: Check if 'Self' inside SendMessage is the right instance. The moral of the story is: in Delphi mode you can assign a procedure of object to a pointer, and the compiler doesn't complain, but it is wrong, because when you call your method through this pointer, the method is executed, but it's unaware of the data space of the object it belongs to, even if it's called from another method of the same object! If the method doesn't access variables of the object, everything appears to work, but if it does the program simply crashes. I will try to see if the same occurs also in Delphi, to understand if it's a Delphi bug or an fpc bug. A valid method can never be stored in a pointer, since the former is actually 2 pointers (method/data) and the latter is just 1 pointer. That the assignment is valid is Delphi compatible: only the procedure address is copied. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Weird object variables access - fpc issue?
On Tue, 24 Oct 2017, Mattias Gaertner via Lazarus wrote: On Tue, 24 Oct 2017 11:11:15 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: [...] From memory: The first call to Now is not necessarily thread-safe, because of the initialization of TZ info ? Please add this to the docs. After I've verified that my memory in this correct in this matter :) I know that there is some late TZ initialization, but I'm not 100% sure whether Now() invokes it. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Weird object variables access - fpc issue?
On Tue, 24 Oct 2017, Mattias Gaertner via Lazarus wrote: On Tue, 24 Oct 2017 08:59:36 +0100 el es via Lazarus wrote: On 23/10/17 20:00, Giuliano Colla via Lazarus wrote: [snip] I don't remember if I was hitting AV using Now(), likely I wasn't - but due to 'normal' Now() being not thread safe, I was getting inconsistent timing results, when I used Now() both in main thread and in the thread; AFAIK Now is thread safe. On what platform and how did you test? From memory: The first call to Now is not necessarily thread-safe, because of the initialization of TZ info ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fcl-web capturing called URL
On Fri, 20 Oct 2017, Leonardo M. Ramé wrote: Hi Michael, as I'm using Brookframework I did HttpRequest.URL, but sadly I'm getting an empty string. It depends on whether the server passes it on. If not, in that case you'll have to construct it from: HttpRequest.scriptname+HttpRequest.pathinfo+HttpRequest.query Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fcl-web capturing called URL
On Fri, 20 Oct 2017, Leonardo M. Ramé via Lazarus wrote: Hi, I'm trying (without success) to capture the called URL using fcl-web o Brook. How can I get that info?. In fcl-web, did you try Request.url ? Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Code outline feature of the IDE
On Fri, 20 Oct 2017, Vojtěch Čihák via Lazarus wrote: Hi, I even didn't know this feature, but... so much colors, I almost collapsed :-) :) Personally, I disabled it at once. I find it more disturbing than helpful. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Code outline feature of the IDE
On Fri, 20 Oct 2017, Werner Pamler via Lazarus wrote: The new outline feature of the IDE in Laz 1.8 and trunk is extremely helpful in locating code block inconsistencies. I cannot imagine how I could have lived without it in older versions. In my opinion, however, it is not always working correctly: A "for" loop with a "begin"/"end" block ("for ... do begin end;") is a logical entity of the code; there is only a single semicolon which terminates this sequence. Therefore I'd expect all four keywords to be painted in the same color, no matter of how the code is formatted. The IDE behaves differently, however. Look at screenshot "orig.png" which is taken from the current LCLtranslator.pas of trunk and essentially shows a "for" loop with a "begin"/"end" block. However, the author of this unit likes to put the "begin" into a new line and to indent it with respect to its "for" parent. Note that the IDE now switches color - "for...do" and "begin"/"end" are colored differently. - I think this is wrong This changes if the indentation of "begin" is modified to match that of "for" (screenshot "modif-1.png"), or if "begin" is kept in the same line as "for" (screenshot "modif-2.png"). Now all three keywords are colored equally. - I think this is correct. How can it be that the logical relation between keywords depends on the way of writing? Is this a bug? Or is it just that my understanding of the Pascal block concept is wrong? Interestingly, I had a discussion recently with one of the authors of this functionality (Pascal Riekenberg). He had remarks about exactly this point. He uses the C style of putting "begin" at the end of the for/if/while line, while I use the Object Pascal style of putting begin on a separate line. I suppose that as a result of this discussion, the behaviour may still be fine-tuned. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Installation of 1.8 RC4 fails.
On Thu, 12 Oct 2017, Donald Ziesig via Lazarus wrote: The two fpc 3.0.4 files said that they installed correctly, but all I can find are versions 3.0.0 and 3.0.2 anywhere on my hdd. This makes no sense. How did you install the two deb files? I tried to install the ide but it complained that it was missing fpc 3.0.4. This is on Linux Mint 18.1 (Sarah). Does anyone have any suggestions? Mattias Hi Mattias, I've done this many times over on many machines (all Debian derivatives) in the past and never had a problem like this. I validated the checksums on all three files. I am a bit surprised. The FPC team hasn't created .deb files for the 3.0.4 release yet. So where did you get those ? Maybe they are simply renamed 3.0.2 installers ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Pixels
On Tue, 10 Oct 2017, Larry Dalton via Lazarus wrote: I need a function to get pixels per inch in a Linux application. In an LCL graphical application ? You mean DPI ? Take your pick: TForm.PixelsPerInch Monitor.PixelsPerInch Screen.PixelsPerInch Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] TBufDataset.Filename property in Object Inspector
On Sun, 8 Oct 2017, Graeme Geldenhuys via Lazarus wrote: Hi, Following on from my previous TMemDataset.Filename issue. With TBufDataset, there is no property editor associated with the FileName property. Is this just an oversight or done for a specific reason? Oversight. An the same issue as with TMemDataset.Filename. Clearly it expects a specific file format denoted with a specific file extension. I selected one of Kylix 3's *.cds files... /home/graemeg/apps/kylix3/examples/delphi/db/fishfact/biolife.cds and when I set Active = True, the TBufDataset gave an "unable to open file" error - I assume what it really meant is that it doesn't know the file stream format. Correct. TBufDataset can read the XML format used by TClientDataset, but by default it uses another format. It cannot read the binary cds format. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] TMemDataset.Filename property in Lazarus
On Sun, 8 Oct 2017, Graeme Geldenhuys via Lazarus wrote: Hi, Playing around with TMemDataset, I dropped it on a form, then clicked "..." button of the FileName property in the Object Inspector. The file dialog shows that I can select ANY file, so I selected a PNG file and set Active = True. ;-) NO surprise, that didn't work as expected. Incorrect data stream. Clearly the TMemDataset expects a specific file format, so why doesn't the File Open dialog list the file type and file extension that is expected. Because there is no designated extension. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] App don't appear on taskbar of 2nd monitor
On Fri, 6 Oct 2017, Alexey via Lazarus wrote: Is looks like LCL bug. who can confirm it? https://github.com/Alexey-T/CudaText/issues/1108 Works fine if I do it here with an LCL app. Linux mint 18, cinnamon. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Delphi, Kylix or Lazarus multi-form DB app example
On Thu, 5 Oct 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-10-05 11:10, leledumbo via Lazarus wrote: Because that defeats the purpose of a demo project: A "real world" example (or close to it) would also be a very valuable source of information. Education for the masses. In the tiOPF project we stuck to small-and-to-the-point demos for many years, and was constantly bombarded with requests to make more real-world like examples, so they can see how it all fits together. After all, single or multi form doesn't differ much, it's just the way you structure your project. And that is exactly my issue... What are the best practices? I haven't done "prototype" (aka RAD) style development with Delphi or Lazarus in over 10 years. I've long moved to a more OOP approach where I work with actual business/entity objects. eg: AddressList.Load(), lPerson.Address.Country = xyz etc, and not directly working with raw table data in my applications. Last night I played with the prototype/RAD style development and found in so frustrating - having things hard coded everywhere (eg: fields for a DBGrid) etc and then when I change the data source my whole program bombs out because now the DBGrid is referencing columns that don't exist, and then I have to recreate the DBGrid columns and resize them again to fit the UI etc. The same is true in tiOPF, when using mediators: Listview mediator constructor CreateCustom(AModel: TtiObjectList; AView: TListView; ADisplayNames: string; AIsObserving: Boolean = True); reintroduce; overload; constructor CreateCustom(AModel: TtiObjectList; AView: TListView; AOnBeforeSetupField: TtiOnBeforeSetupField; ADisplayNames: string; AIsObserving: Boolean = True); reintroduce; overload; grid mediator: constructor CreateCustom(AModel: TtiObjectList; AGrid: TStringGrid; ADisplayNames: string; AIsObserving: Boolean = True); reintroduce; overload; If the underlying object changes, and ADisplayNames still contains an old property name, then you get an error as well (or worse, no error, but missing columns) In one case you must change the code, in the other, you use the point-and-click paradigma of RAD to correct things... And then there is the matter of having your User Interface layer chock full of business logic because I hooked into the various events of the DB controls, DataSource, ClientDatset. Business logic should never be in DB controls events, only in field/dataset events. Yes - I've tried to place as much as possible in a Data Module, but it seems I'm fast heading to the same issue I had 15 years ago http://geldenhuys.co.uk/~graemeg/datamodule.png Using only 1 datamodule is of course doomed to fail. I've been using tiOPF for so long, I've forgotten what a pain (nightmare) RAD style development can be. Has nobody to this day come up with a simple set of steps on how to implement more maintainable RAD style projects? I have always been told by others that an OPF framework isn't needed, and you can have clean / maintainable RAD style projects with Delphi/Lazarus I'm looking hard, but I can't find any such examples, or steps to follow. :-/ Any such help would be much appreciated. Not sure if it helps, but see https://www.freepascal.org/~michael/articles/ The series "Large database applications in delphi". The strategy described there is used in a set of applications in which the main one has over 2000 forms. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Documentation in Lazarus
On Mon, 2 Oct 2017, Wolf via Lazarus wrote: Hi, What is the smallest, most compact system for software documentation that can handle text, graphics, and preferably mathematical formulae as well? LaTeX ? I am looking for something that can eventually be presented on a form, documenting not just what my code does, but, more importantly, the "why" arguments that led me to choosing just that algorithm. fpdoc? Delphi-Markdown (https://github.com/grahamegrieve/delphi-markdown)? Delphi markdown is not a documentation system. It just changes markdown to html. AsciiDoc(tor)? OpenDocument format? Same arguments apply. They are just formats for making up text ? Maybe I misunderstood what you mean by 'software documentation'. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Custom component: cannot make Items: TStrings
On Sat, 30 Sep 2017, Alexey via Lazarus wrote: Hi. I added to ATTabs prop Items: TStrings. It has getter/setter. It has registering in IDE. - in designer, OI can set Items and tabs appear - if i run app, tabs dont appear- ?? - if I restart IDE, app's LFM looses Items- ?? https://github.com/alexey-t/attabs Remove the clear statement in the setter ? It clears FTabItems, which you just assigned. That's pointless. Also, if FTabItems equals AValue, it will clear the AValue. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport - can not render pagefooter
Sure. You can add pages to the wiki about fpreport: http://wiki.freepascal.org/FPReport I suggest adding a new page http://wiki.freepascal.org/FPReport_FAQ and linking to it from the main page. But don't add the FAQ directly in the main page itself. Michael. On Sat, 30 Sep 2017, Andreas Frieß via Lazarus wrote: Is it possible to make a FAQ for fpreport ? Regards Andreas Graeme Geldenhuys via Lazarus wrote: On 2017-09-27 09:38, Andreas Frieß via Lazarus wrote: What is my mistake of understanding ? You made a couple of mistakes and highlighted a bug in the PDF exporter. Mistakes: ... Regards, Graeme -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Kitto2 for Rich Internet Applications
On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: On Thu, Sep 28, 2017 at 10:43 AM, Michael Van Canneyt via Lazarus wrote: On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: Hi, I would like to know if anybody here has already used Kitto2 https://github.com/EtheaDev/kitto2 This project used or was based on the old ExtPascal. My question is because this project compiles only in Delphi and maybe somebody here has already ported to FPC or thought on it. I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about this. Kitto2 is a dead end, just as ExtPascal was. They removed ExtPascal from it... but I've never tried Kitto2. What I meant is that I believe the architecture is simply wrong. Nevertheless, now that Embarcadero embraced it, I doubt they will consider porting to FPC. The author have no objections... But if you say that FPC already has something better (December, right?), I'll choose fcl-web, of course. I believe it is better, yes. We managed to convince a major component developer of this, so we're not alone in this belief :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Kitto2 for Rich Internet Applications
On Thu, 28 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: Hi, I would like to know if anybody here has already used Kitto2 https://github.com/EtheaDev/kitto2 This project used or was based on the old ExtPascal. My question is because this project compiles only in Delphi and maybe somebody here has already ported to FPC or thought on it. I opened an issue there https://github.com/EtheaDev/kitto2/issues/2 about this. Kitto2 is a dead end, just as ExtPascal was. Nevertheless, now that Embarcadero embraced it, I doubt they will consider porting to FPC. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] MainMenu dropped to the left, Win bug?
On Thu, 28 Sep 2017, Alexey via Lazarus wrote: User reported this bug here: https://github.com/Alexey-T/CudaText/issues/1101 That can happen if OS decides there is not enough room on the right ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport - can not render pagefooter
On Thu, 28 Sep 2017, Andrea Mauri via Lazarus wrote: Il 28/09/2017 12:15, Michael Van Canneyt via Lazarus ha scritto: Normally you can, but you will need to copy some additional units from the trunk version of the FPC source repo (in particular, fpexprpars, and fcl-pdf) fpReport is in production use with 2.6.4 as the compiler. I downloaded fcl-report, fcl-pdf, fpexprpars from FPC trunk and fpreport. When I try to compile lclfpreport package I got: cfgfpreportimageexport.pp(24,42) Fatal: Cannot find fpreport used by cfgfpreportimageexport of package lclfpreport. Sounds like a misconfigured path. Hard to debug, because there is also the 8.3 filename support that interferes. How I cursed that while developing fpreport !! :/ Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport - can not render pagefooter
On Thu, 28 Sep 2017, Andrea Mauri via Lazarus wrote: Il 27/09/2017 12:50, Graeme Geldenhuys via Lazarus ha scritto: ps: Note that I compiled your project using the latest fpReport from FPC Trunk. I simply set the correct Unit Source Path in the project. You don't need to use FPC Trunk compiler - I used FPC 2.6.4. What are the minimum requirements to use fpreport? Can I use it with laz 1.6.2 and fpc 3.0.0? I downloaded both fcl-report and fpreport. I tried to install fpreport but I failed. Normally you can, but you will need to copy some additional units from the trunk version of the FPC source repo (in particular, fpexprpars, and fcl-pdf) fpReport is in production use with 2.6.4 as the compiler. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport - can not render pagefooter
On Wed, 27 Sep 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-09-27 09:38, Andreas Frieß via Lazarus wrote: What is my mistake of understanding ? You made a couple of mistakes and highlighted a bug in the PDF exporter. Mistakes: 1. You never registered the standard page sizes with: PaperManager.RegisterStandardSizes; 2. Your report used LiberationSans font. Make sure you added the search paths to the font cache. eg: {$IFDEF UNIX} gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/'); gTTFontCache.SearchPath.Add('/data/devel/Wisa/fonts/Liberation/'); {$ENDIF} 3. You positioned a lot of reporting elements overlapping each other. Correct positioning will help you see things better. ;-) Bug: The PDF exporter didn't handle Page.Orientation of Landscape correctly, and rendered such pages from the bottom upwards. I supplied a patch to FPC's Mantis so hopefully Michael or somebody could commit that soon. https://bugs.freepascal.org/view.php?id=32478 After all that, the report renders just fine. Patch Applied, thanks for the fix! Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi
On Sun, 24 Sep 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-09-24 09:02, Graeme Geldenhuys via Lazarus wrote: Of course I would normally agree with that, but if you look at the Java annotations in that article Just curious, I know C# has annotations support too. Does Delphi? Yes. It's called Attributes. FPC has it too, but it is not yet in trunk. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi
On Sat, 23 Sep 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-09-23 12:36, Michael Van Canneyt wrote: FPC doesn't even cover the most basic of things - no decent debugger that can handle all the Object Pascal language features. :-/ > Of course not. FPC is not a debugger, it is a compiler. Strange then that FPC includes many other tools like documentation generators and such. Touché :-) A good debugger is indeed sorely missed. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi
On Sat, 23 Sep 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-09-21 04:06, Marcos Douglas B. Santos via Lazarus wrote: Nah... most of them know nothing about true OOP. They believe that an object is a "record" with getters and setters... anyway. If I understand you correctly... referring to Java developers, then that is a totally wrong generalisation. As you said, each his own style. What is more important is keeping this excellent community united, around that great language called Object Pascal. I love Object Pascal too, and have a real soft spot for it (and always will). But G*D damn, Java is brilliant too. Not just Java the language, but the millions of frameworks and tools built around it too (JPA, Spring Boot, Jenkins, Maven etc). Also the understated Java Annotations are unbelievably powerful and can (and does) reduce the amount of boilerplate code tremendously(*). FPC doesn't even cover the most basic of things - no decent debugger that can handle all the Object Pascal language features. :-/ Of course not. FPC is not a debugger, it is a compiler. But if you put the combined resources of IBM and Oracle at our disposal, we'll quickly catch up. * Take a gander at how much Java Annotations reduced boiler plate code using JPA in EJB 3.0 and later vs EJB 2.1 which didn't use annotations. http://web.archive.org/web/20100731223045/http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html That's actually a step backwards. Because it breaks the separation of object and storage. Good for some quick and dirty prototyping, but a potential disaster in the long run. It suffices that the DBA decides to move (part of) the data for storage, and you're dead... I have to manage an API where the same data can meanwhile come from 1 to 4 different kinds of databases, depending on some (for all practical purposes) random parameter. Luckily, at the start I separated storage and object. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi
On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: On Wed, Sep 20, 2017 at 4:31 PM, Michael Van Canneyt via Lazarus wrote: On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: Hi, I'm working in my new "pet project" called Xavier. Xavier is an object-oriented library for work with XML. I don't understand the 'why' ? Should I understand that you consider the DOM units not object-oriented ? Yes and no. Michael, with all my respect, that depends of your view about Object thinking. Yes, DOM uses classes and objects, but IMO Objects is more than that. Objects are more close to Functional programming than most people think. As I understand it, objects are exactly the opposite of functional programming, in that they encapsulate state, and functional programming wants to avoid state (variables, if you want). If can code classes but if you are implementing (all) in an imperative way, I mean line by line telling the computer how to do something instead of code what you just want, you may not are thinking in terms of Objects. Your class, in these cases, is just a "bucket of data and procedures". Yes. That's what an object is. In a perfect design, we may only connect all objects to work in a "task", call "run", and "they" will know what to do. Ah. You just replace methods by objects. You should be programming Java: https://steve-yegge.blogspot.be/2006/03/execution-in-kingdom-of-nouns.html I prefer imperative programming. (verbs, if you want). It comes more natural. Well, each his own style. But, if you allow me: the post on the lazarus forum and the Xavier page should really explain what you mean by OOP. I guess most people will be confused, as I am. Thanks for explaining. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] [ANN] Xavier for XML — Compatible with FPC and Delphi
On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: Hi, I'm working in my new "pet project" called Xavier. Xavier is an object-oriented library for work with XML. I don't understand the 'why' ? Should I understand that you consider the DOM units not object-oriented ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite?
On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: On Wed, Sep 20, 2017 at 3:02 PM, Michael Van Canneyt via Lazarus wrote: On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus wrote: These units work using UTF8. The DOM units use UnicodeString (UTF16). Given that these units are quite stable in terms of functionality and maturity, it may be a good idea to move them to the FCL. Yes, that is my point. But instead of just moving them, shouldn't they merge as well into a single unit, ie, only one DOM, XMLRead, and XMLWrite unit? I don't think so, because how will you make the difference between the 2 ? And it's not possible to have optimal code for both cases in 1 set of classes; The idea is that there are no conversions necessary. And we will continue having two base code to do the same thing? Don't you think this is confusing for the users? What about having just one code but setting the type of string (XMLString) to use? (even having Unicode... God) This is an option, but you'll still have 2 sets of units. How can I use XPath with laz2_* units then? Currently not, I think. All the more reason to move everything to FCL in a unified codebase. Or use your suggestion and use something like Type {$IFDEF XMLUTF8} XMLString = UTF8String; {$ELSE} XMLString = unicodestring; {$ENDIF} should do the job. I will have a look at this; the only thing that must then be properly checked is the actual reading and writing... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite?
On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: On Wed, Sep 20, 2017 at 12:36 PM, Michael Van Canneyt via Lazarus wrote: These units work using UTF8. The DOM units use UnicodeString (UTF16). Given that these units are quite stable in terms of functionality and maturity, it may be a good idea to move them to the FCL. Yes, that is my point. But instead of just moving them, shouldn't they merge as well into a single unit, ie, only one DOM, XMLRead, and XMLWrite unit? I don't think so, because how will you make the difference between the 2 ? And it's not possible to have optimal code for both cases in 1 set of classes; The idea is that there are no conversions necessary. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Why Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite?
On Wed, 20 Sep 2017, Marcos Douglas B. Santos via Lazarus wrote: Hi, Nowadays we have Unicode and so on. Is there any reason to these units (Laz2_DOM, laz2_XMLRead, and laz2_XMLWrite) still exists? I've always used them, but days ago I needed to use XPath and the xpath unit works using objects from DOM unit, not laz2_DOM, and because that my doubt. These units work using UTF8. The DOM units use UnicodeString (UTF16). Given that these units are quite stable in terms of functionality and maturity, it may be a good idea to move them to the FCL. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: On 13.09.2017 20:33, Graeme Geldenhuys via Lazarus wrote: On 2017-09-13 19:17, Michael Van Canneyt via Lazarus wrote: Similarly, every field in a database I create is always uniquely named. So if I ask "where is field TX_ID' I get exactly 1 field, in 1 table. Graeme Geldenhuys can testify that I use this practice even in very big databases. I can confirm that. :) Huh, that's hardcore :) Just curious: how do you define foreign keys? E.g. Customers.ID Invoices.CustomerID Orders.CustomerID create table customer ( C_ID INT Primary key, C_FIRSTNAME VARCHAR(30), C_LASTNAME VARCHAR(50) ); CREATE table invoice ( I_ID INT PRIMARY KEY, I_CUSTOMER_FK INT, I_DATE DATE ); ALTER TABLE INVOICE ADD CONSTRAINT R_INVOICE_CUSTOMER FOREIGN KEY (I_CUSTOMER_FK) REFERENCES CUSTOMER(C_ID) ON CASCADE DELETE; 3 "rules" : Prefix is always somehow related to table name. Usually 1 or 2 letters. Occasionaly 3 (if you have close to 600 tables, 2 letters doesn't always cut it) Primary key is always Prefix_ID Foreign key is always Prefix_FOREIGNTABLE_FK The SQL you construct like this is always unambiguous, unless you use the same table twice in a single SQL select there is never any need to prefix the fields with the table name. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Ondrej Pokorny wrote: Of course there can be collisions - if it happens you have to resolve them with explicit namespaces. Making the whole point moot. You can understand namespaces and subnamespaces as a concept for folder structure within code. Of course you can have every single file in root D:\ and use endless CamelCase names: D:\MyCompanyAccounting201705Report1.xls D:\MyCompanyAccounting201705Report2.xls or you can have a decent folder structure: D:\MyCompany\Accounting\2017\05\Report1.xls D:\MyCompany\Accounting\2017\05\Report2.xls It's up to you. The -NSxyz is then similar to "use path" concept. If you see advantages in using folders you just have to admit there are also advantages when using namespaces. The equivalent of uses utils; dcc32 /NSos /NSweb myprogram in your example is the same as saying "find me Report1.xls, search in D:\MyCompany\Accounting\2017\05 and D:\MyCompany\Accounting\2016\05" You will get an ambiguous answer. Which is the whole problem as I was trying to explain. That said, I use directory structure only to find files faster and group them logically. I would still name files in it uniquely. Using your example: D:\MyCompany\Accounting\2017\05\MCA-Report-201705-2.xls I will find the file quickly, and the name will still be unique. (within reasonable bounds) Similarly, every field in a database I create is always uniquely named. So if I ask "where is field TX_ID' I get exactly 1 field, in 1 table. Graeme Geldenhuys can testify that I use this practice even in very big databases. For the same reason: to avoid ambiguity. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-09-13 09:44, Michael Van Canneyt via Lazarus wrote: As long as there are no command-line switch and directive for setting namespaces, they are completely useless. Like I said, FPC still needs a bit more work before namespaces become more useful (or workable like Delphi intended). > And even with the command-line switch, the 'namespaces stop unit name > conflicts'argument is of course complete nonsense. It can greatly reduce conflicts. So fpreportexporthtml.pp would become: fpc.fpreport.export.html.pp Please take a good look at what you are writing. You are _seriously_ telling me that the chance of conflicts is "greatly reduced" when I use fpreport.export.html compared to when I use fpreportexporthtml ? Either the world or me has lost its marbles. I'm pretty sure it is not me. At last count, I still had them all. (But then that would be normal if I was going crazy :)) I will not argue about readability; that's a matter of taste: I much prefer FPReportExportHTML over fpreport_export_html or fpreport.export.html. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: On 13.09.2017 12:03, Michael Van Canneyt via Lazarus wrote: On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. You forgot one thing: third-party libraries. E.g. your fpReport could use the "fprep" namespace. In the fpReport package you then define to use the fprep namespace - it means you can use units in fpReport without the "fprep" namespace - and without any collisions. This is demonstrably not correct. It is *Only* correct if there are not 2 namespaces with the same unit in your project. See my example program, it demonstrates exactly that. You didn't understand me. I was talking about a 3rd party library package and not about your/my project. Yes. And the same is true for this package. Of course there can be collisions - if it happens you have to resolve them with explicit namespaces. Making the whole point moot. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Mattias Gaertner wrote: On Wed, 13 Sep 2017 11:28:55 +0200 (CEST) Michael Van Canneyt wrote: [...] The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. It's a little bit better than zero. For example shorter uses clause. Without using a switch to set namespaces ? Please Explain ? Namespaces without the switch are pretty useless. I thought you were talking about namespaces as in Delphi. Sorry for the misunderstanding. They are one and the same. [...] Did you add "uses utils"? Yes, obviously. Here is the test program: I see now that your point was the order of namespaces. Which is an issue with unit paths as well. But with namespaces you can always pass the whole unit name, while with unit paths you cannot. So I'm not sure why the order is an argument against namespaces. Because, as I demonstrated, the order issue forces you to disambiguate the unit names anyway. Writing "uses utils;" is ambiguous if you are using 2 namespaces which both have a "utils" unit, and you use both of them somewhere in your project. We are agreed on that, I hope. So, to avoid this, you must write "uses web.utils" and "uses os.utils" (using my example). So, if you write a class library (using a namespace) with many units, you don't know in what environment it will be used, and what namespaces the end user will use on the command line (or maybe none). So, you must make sure all your code is unambiguous, i.e. write "namespace.unitname" everywhere. The same is true for the end-user. (see my demonstration program). So if you must disambiguate anyway (i.e. write web.utils). the whole point of using a namespace ("shorter names") becomes moot. I am not trying to dissuade anyone from using namespaces. I am trying to debunk a myth, namely that it will avoid unit name clashes. It does not, and in certain circumstances (using /NS switch) makes the problem only worse. The end point - what got all this started - is that whether you use fpreportutils.pp or fpreport.utils.pp is a matter of personal preference only. Using the latter does not avoid the possibility of name clashes. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Ondrej Pokorny via Lazarus wrote: The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. You forgot one thing: third-party libraries. E.g. your fpReport could use the "fprep" namespace. In the fpReport package you then define to use the fprep namespace - it means you can use units in fpReport without the "fprep" namespace - and without any collisions. This is demonstrably not correct. It is *Only* correct if there are not 2 namespaces with the same unit in your project. See my example program, it demonstrates exactly that. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Sven Barth via Lazarus wrote: As long as there are no command-line switch and directive for setting namespaces, they are completely useless. And even with them, the benefit is doubtful. The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. The "." allows for a nicer disambiguation between what's the prefix and what's the remainder. Oh please... Granted, that can be done with "_" as well, but in my personal opinion a "." simply looks nicer. :) It's an extra character. When using CamelCase properly, you don't need _ or . at all. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Mattias Gaertner via Lazarus wrote: On Wed, 13 Sep 2017 10:44:23 +0200 (CEST) Michael Van Canneyt via Lazarus wrote: [...] As long as there are no command-line switch and directive for setting namespaces, they are completely useless. And even with them, the benefit is doubtful. The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. It's a little bit better than zero. For example shorter uses clause. Without using a switch to set namespaces ? Please Explain ? os.utils.pas(14) testns.dpr(6) Error: E2003 Undeclared identifier: 'webfunction' testns.dpr(7) webfunction is in the web.utils.pas unit. Did you add "uses utils"? Yes, obviously. Here is the test program: program testns; uses utils; begin writeln(webfunction); end. unit web.utils; interface function webfunction : string; implementation function webfunction : string; begin Result:='web'; end; end. unit os.utils; interface function osfunction : string; implementation function osfunction : string; begin Result:='os'; end; end. There is no switch to use "web.*" like in Java. In Delphi there is: /NSweb. But as soon as you use 2 namespaces (/NSos /NSWeb), you are stuck. As you see from the output I posted, it compiles first os.utils and uses that to satisfy the "uses utils;". To be complete: it depends on the order of the NS switches, if you reverse the order, it will work - but that doesn't help if you have a big project which has many units using utils from one or the other namespace. The first one wins. So, to disambiguate, that forces me to write uses web.utils; "uses utils" should be enough. As I demonstrated: it clearly is not. I carefully tested everything before posting my remark. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Wed, 13 Sep 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-09-12 19:01, Alexey via Lazarus wrote: It is new. Please rename (it's easy for new component) all files: usually its good with one prefix. E.g. fprep_*.*. hahaha... I had the units like that, using underscores. eg: fpreport_export_aggpas.pas, fpreport_export_fpimage.pas etc. Michael didn't like it, so it got renamed before it went into FPC Trunk. :) The LCL related units could be prefixed though, as Michael mentioned. They should be, since some of the names used in the designer are indeed too generic. Then again, maybe it's time FPC starts making use of namespaces and dotted unit names? Just a thought. In Delphi it is actually pretty useful and also stops unit name conflicts. FPC does need a bit more work though to fully support namespaces - at least the way Delphi uses it. As long as there are no command-line switch and directive for setting namespaces, they are completely useless. And even with them, the benefit is doubtful. The benefit of writing fpreport.exporthtml versus fpreportexporthtml is zero. And even with the command-line switch, the 'namespaces stop unit name conflicts' argument is of course complete nonsense. Whoever originally tossed that argument into the world needs to be ridiculed for either being stupid or not thinking his argument through. because a) I could equally easy decide to use the same namespace as someone else. (Yes, I have a notoriously bad character) b) If you use the namespace param too much, you are in trouble anyway. Imagine: web.utils.pas os.utils.pas and in my project I have (I love to use the namespace param) uses utils; And now I compile with a (hypothetical) /NSweb /NSos -> problem. I tested in Delphi: c:\Temp>dcc32 /NSos /NSweb testns.dpr Embarcadero Delphi for Win32 compiler version 30.0 Copyright (c) 1983,2015 Embarcadero Technologies, Inc. os.utils.pas(14) testns.dpr(6) Error: E2003 Undeclared identifier: 'webfunction' testns.dpr(7) webfunction is in the web.utils.pas unit. So, to disambiguate, that forces me to write uses web.utils; in which case I can just as well have written uses webutils; So we're back to square 1. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Tue, 12 Sep 2017, Alexey via Lazarus wrote: On 12.09.2017 21:25, Michael Van Canneyt via Lazarus wrote: Why would people see filename conflicts ? None of these files exist yet. because files like dlginputcombo.pp, fradbfdata.*, frmresizeelements.* may exist in BIG app. The ones without prefix can indeed be prefixed. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Tue, 12 Sep 2017, Alexey via Lazarus wrote: Definitely not. It is good to do (some users will see filename conflicts in big apps). no big apps ready on FPRep yet. Why would people see filename conflicts ? None of these files exist yet. And there are already apps in production using fpreport. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FPReport file names
On Tue, 12 Sep 2017, Alexey via Lazarus wrote: Hi It is new. Please rename (it's easy for new component) all files: usually its good with one prefix. E.g. fprep_*.*. Definitely not. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Dangers of using Move command to insert data into a TBytes array?
On Wed, 30 Aug 2017, Bo Berglund via Lazarus wrote: I just want to check with you which way is safer when using Move() commands in a procedure to combine two TBytes arrays by inserting one into the other at a specified point. What I need to do is the following: - Increase the size of the Dest array by the length of the Src array - Move the data following the insertion point in the Dest array towards the end starting at Index - Copy the data from the Src array into Dest at Index where the hole has been created Like this: procedure InsertBytes(var Dest: TBytes; Src: TBytes; Index: integer); var LenD, LenS: integer; begin if Length(Src) = 0 then exit; LenD := Length(Dest); LenS := Length(Src); if Index > LenD then Index := LenD; //Make an append instead SetLength(Dest, LenD + LenS); Move(Dest[Index], Dest[Index + LenS], LenD - Index); //Create space Move(Src[0], Dest[Index], LenS); //Insert data end; If the calculation of the number of bytes to move (LenD - Index) for some reason is wrong and results in too many bytes being moved, what will happen then? Will Move() overwrite whatever is following the Dest array in memory? Yes. Would it be safer to use a local intermediate array to combine Dest and Src and then in the end Move the data back into Dest? Not really. If you calculate lengths wrong, the end result is unpredictable in any case. I have tested the above procedure and it looks OK, but I am worried that in some cases the same kind of construct would be wrong and maybe cause unknown side effects. I must use Move() for handling other data of various kinds like packed records and such too... If the packed records contain managed data (ansistrings and the like): Don't use move. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport -> Lazarus reportdsg.lpr
On Mon, 21 Aug 2017, Andreas Frieß via Lazarus wrote: Is is not better to call the standard fonts of the system in TFPReportDesignerForm.FormCreate(Sender: TObject); ? if gTTFontCache.SearchPath.Count=0 then begin gTTFontCache.SearchPath.Add(ExtractFilePath(ParamStr(0))+'../demos/fonts/'); gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/'); {$IFDEF UNIX} gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/ubuntu-font-family/'); gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/dejavu/'); {$ENDIF} end; if (gTTFontCache.Count=0) then gTTFontCache.BuildFontCache; if (gTTFontCache.Count=0) then// <--- gTTFontCache.ReadStandardFonts;// <--- Because the standardfonts are not read in the designer. Yes. A patch for this was already provided by Pascal Riekenberg. It has been applied. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport -> Lazarus reportdsg.lpr
On Mon, 21 Aug 2017, Sven Barth via Lazarus wrote: Am 21.08.2017 11:25 schrieb "Graeme Geldenhuys via Lazarus" < lazarus@lists.lazarus-ide.org>: On 2017-08-21 10:18, Michael Van Canneyt wrote: /usr/local/share/fonts /usr/local/lib/X11/fonts fonts ~/.fonts Should indeed be easy to parse and handle... I'll make it so. I guess the best option would be to add it as an option API call, so if somebody wants it, simply call .AddStandardFontPaths(). For those that don't want those font paths, simply do nothing. Why not dynamically load the fontconfig library and ask that instead of manually parsing its config file? Because I didn't know such a library existed :) Note: fontconfig doesn't have GUI dependencies either. Well, in that case we can try to load it dynamically if it is available, and fall back to parsing if it is not. Many thanks for the tip !! Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport -> Lazarus reportdsg.lpr
On Mon, 21 Aug 2017, Andreas Frieß via Lazarus wrote: It is possible to use a standard font and give a warning instead of fire an exception. Eg. Font not found, using standardfont instead ? That is what I meant with introducing aliases. The problem is of course that you normally do not want this in a reporting engine, where the looks are important. So using aliases should be an option... Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport -> Lazarus reportdsg.lpr
On Mon, 21 Aug 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-08-21 09:54, Michael Van Canneyt via Lazarus wrote: These problems will only occur if you're using non-standard fonts. What if you wanted "self contained reports" eg like the demos in fpReport where we use fonts that are not available on all systems. eg: Windows doesn't come standard with DejaVu. Other Linux distros and FreeBSD doesn't come standard with the Ubuntu font. Then you need to add Location+'fonts/' or so, and distribute the font. If the font isn't there, you can't use it, clearly :) An idea would be to have aliases for substitution. If you recall, I wanted to analyse /etc/fonts/fonts.conf on unix. (not sure if that is used on FreeBSD) Yes, FreeBSD uses that too, but again, it is located in the user-installed apps location... /usr/local/etc/fonts/ Looking at that file here (again, not sure how Linux distro compare or differ), but there are tags in the beginning of the fonts.conf file. Simply adding those to fpTTF's search path should already go a long way. That should be pretty easy to add. /usr/local/share/fonts /usr/local/lib/X11/fonts fonts ~/.fonts Should indeed be easy to parse and handle... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport -> Lazarus reportdsg.lpr
On Mon, 21 Aug 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-08-21 09:18, Michael Van Canneyt via Lazarus wrote: The '../demos/fonts' and other hardcoded values are maybe not really a good idea:) For the life of me, I couldn't think of another solution. eg: you might have a headless reporting CGI app and needs to look for fonts in a specific location, not the general "fonts" directories of the system. But yes, the hard-coded paths like gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/'); isn't ideal. Especially if you consider the inconsistency between Linux distros, and the fact that FreeBSD uses /usr/local/share/fonts/ instead of /usr/share/fonts/ But again, unless we extend the IFDEFs for most used OSes, I couldn't think of a better solution. What if we introduce a global (or user-defined) ~/.config/fpreport/fpreport.ini file that specifies default font search paths for our specific reporting needs - per system? But then again, isn't that what the standardised $HOME/.fonts/ is for? These problems will only occur if you're using non-standard fonts. If you recall, I wanted to analyse /etc/fonts/fonts.conf on unix. (not sure if that is used on FreeBSD) On windows, normally only the windows fonts dir should be needed. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport -> Lazarus reportdsg.lpr
On Mon, 21 Aug 2017, Andreas Frieß via Lazarus wrote: I think there ara som issues with the fonts. frmreportdesignermain.pp around line 395 if gTTFontCache.SearchPath.Count=0 then begin {$IFDEF UNIX} gTTFontCache.SearchPath.Add(ExtractFilePath(ParamStr(0))+'../demos/fonts/'); gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/'); gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/ubuntu-font-family/'); gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/dejavu/'); {$ENDIF} end; if (gTTFontCache.Count=0) then gTTFontCache.BuildFontCache; // calls directly to fpTTF in fpTTF procedure TFPFontCacheList.BuildFontCache; var lPath: String; i: integer; begin if FSearchPath.Count < 1 then raise ETTF.Create(rsNoSearchPathDefined); // here is the exception raised I think in windows is no searchpath definded by default. The lines in should: because its also true for windows. if gTTFontCache.SearchPath.Count=0 then begin gTTFontCache.SearchPath.Add(ExtractFilePath(ParamStr(0))+'../demos/fonts/'); gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/'); {$IFDEF UNIX} gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/ubuntu-font-family/'); gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/dejavu/'); {$ENDIF} end; - I will look at this. The '../demos/fonts' and other hardcoded values are maybe not really a good idea :) If i say create a new report, another issue is, the DPI settings in Ruler are not initialised or set. So you get un runtimeerror here procedure TDrawRuler.RecalcParams; var I:Integer; begin FPPU:=PixelsPerUnit(DPI,FUnits);// DPI is zero FMajorTicks:=(DPI/FPPU); //<- FFPPU is zero -> divison by zero! I:=Trunc(FMajorTicks); case I of Fix: constructor TDrawRuler.Create(ACanvas: TCanvas); begin FCanvas:=ACanvas; FFont:=TFont.Create; Color:=clWhite; FTickColor:=cldkGray; FType:=rtTop; FUnits:=ruCm; FZeroOffset:=0; FDPI:=96;//<--- should be an basic value RecalcParams; end; VERY strange, I never had this error. I patched the code. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport released
On Mon, 21 Aug 2017, Ondrej Pokorny via Lazarus wrote: On 21.08.2017 1:38, Graeme Geldenhuys via Lazarus wrote: On 2017-08-20 21:16, Andreas Frieß via Lazarus wrote: The freetype dll searched by the fpreport was freetype-6.dll, but the actual freetype-2.3.5-1-bin.zip has only a freetype6.dll. (Renaming is not a problem for me) It seems FreeType has some inconsistencies with its releases and naming of the DLL. I have copies of freetype-6.dll, freetype6.dll and freetype.dll - all version 6 and all downloaded from somewhere on the Internet. I guess the one good thing is that there is a fpReport TODO item to remove the freetype*.dll dependencies for Windows in the future. That is already possible with the AggPas exporter, but in that specific case I prefer the freetype usage as it generates better text via AggPas and has more features that the Windows Font API supports. I use my own reporting engine - very similar to fpReport (no GUI dependency, no DB dependency, XML-template based). I use fpTTF for getting font information for rendering. Can't you use it as well? It is already used. For LCL bitmap output (preview), I use EasyLazFreeType / TIntfFreeTypeDrawer directly to get a TLazIntfImage. No need for AggPas or other libraries. Only if you use the LCL. What do you need freetype for? If you use the HTML or PDF rendering, you don't need it. If you want fpImage rendering, it is needed to actually render text. I'm working on having this dependency on freetype removed. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport released
On Mon, 21 Aug 2017, Andreas Frieß via Lazarus wrote: I'm on Win10 Pro/64 1703. The needed fonts are not found by the program, because they are not in my system (%windir%/fonts). In fpTTF only the WinDir is added to the searchlist. So an Exception is raised and the execution of the lcldemo stops here. The fonts are in the fcl-report/demos/fonts. The demos are normally adding the current dir+fonts to the search path. udapp line 241. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport released
On Sun, 20 Aug 2017, Andreas Frieß via Lazarus wrote: Thx Michael & Graeme for the fcl-report. But is there a fcl-report package for Lazarus, because the web-demo asked me for ? Or should be an extra package for Lazarus planned ? This is an old package from when the sources were in a separate repo. It is no longer needed. I removed the dependency. BTW. All code should definitely compile with 3.0.2 or later, and if you collect all sources that make up the various parts, the core engine and exporters should work even with 2.6.4. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] fpReport released
On Sun, 20 Aug 2017, Michael W. Vogel via Lazarus wrote: Am 20.08.2017 um 20:35 schrieb Michael Van Canneyt via Lazarus: fpreport has been committed to FPC SVN: packages/fcl-report. It should compile on windows, linux, freebsd and darwin. I just tried to compile a clean fpc: fpreportdb.pp(22,32) Fatal: Can't find unit db used by fpreportdb Fatal: Compilation aborted Missing dependency. I added it, please update and try again. No idea why this always happens to me. I do a "make clean all" and it just works :/ Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] fpReport released
Hello, A long time wait. But it finally made it: fpreport has been committed to FPC SVN: packages/fcl-report. It should compile on windows, linux, freebsd and darwin. Features and architecture are described on: http://wiki.freepascal.org/FPReport Short highlights: - Banded report design. - Streaming to JSON, streaming XML is on TODO. - Expressions using fpexprpars. - No GUI Dependencies. - Unit tested. - Standard support for Memo (with HTML tags embedded), image, shape and checkbox elements - Data loop for Dataset, JSON data, collections, lists, event driven. - Framework for extending with other elements (demo contains polygon). - Export out of the box to following format: - Pure HTML. (TOC pages, optional use of frames, highly configurable) - Images (with option to generate HTML container pages. Currently requires FreeType on windows) - PDF (using fcl-pdf) There are 11 demo reports in a command-line. There is also a standalone webdemo with the same demos, which shows that fpreport can be used very easily in a headless webserver. The LCL support has been committed to lazarus: components/fpreport. It contains: - Preview (export to LCL canvas) - Printing. - Design-time support for a report. - Stand-alone designer, with support for accessing data from: CSV, DBF, SQLDB, JSON File, any REST service that exports JSON. Allows preview and export to all known formats. - LCL demo program. Todo: - XML - Remove freetype dependency. - subreport. - crosstab. - chart support. Exporters for FPGUI and AggPas are also available, I expect that Graeme Geldenhuys will commit them soon. Please remember, this is a first release. There are some known bugs and shortcomings. Feel free to report anything you find in the bugtracker, suggestions are also welcome. Enjoy, Michael. [5~ -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Reporting engine - What it's state?
On Sat, 19 Aug 2017, Andreas Frieß via Lazarus wrote: and the week goes by :-) It's not yet over. Any news about the report-engine ? Or had i miss this in the (fpc) trunk ? No, it is planned for tomorrow. I have other things on my plate as well :) Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] GlobalMemoryStatus is Windows only, how to get installed RAM on Linux ?
On Wed, 16 Aug 2017, Landmesser John via Lazarus wrote: googled in vain ... ... and "TsmBios" ( -> Win/Linux https://github.com/RRUZ/tsmbios ) won't compile :-( So how to get Information about installed RAM on Linux for example? Ok, i could grep "hwinfo" or such in a terminal but thats not what i'm looking for. Your best options is most likely to read /proc/meminfo and parse the result. It contains a wealth of information. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] String vs WideString
On Wed, 16 Aug 2017, Michael Schnell via Lazarus wrote: On 15.08.2017 22:45, Graeme Geldenhuys via Lazarus wrote: How is that not "abuse"??? IMHO it's a major shortcoming to define "string" as "printable text". On the contrary. That is exactly what it means. Anything else is just a collection of bytes. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] String vs WideString
On Tue, 15 Aug 2017, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 14:26:34 +0200 Michael Schnell via Lazarus wrote: On 15.08.2017 11:15, Tony Whyman via Lazarus wrote: > Why shouldn't there be a single char type that intuitively represents > a single character regardless of how many bytes are used to represent it. I suppose by "char" you mean "single printable thingy" with Unicode it's rather debatable what such a thingy is. Hence a Unicode singe char would need to be just be a Unicode string. Do you mean a 'char' is a string in your proposal? That would be a neat recursive definition :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] String vs WideString
On Tue, 15 Aug 2017, Michael Schnell via Lazarus wrote: On 15.08.2017 12:15, Michael Van Canneyt via Lazarus wrote: What does S[2] mean in your proposal ? Is it 1, 2, 4 or even 8 bytes ? Regarding the users' appreciation, the S[x] notation is decently incompatible between the different string types and compiler versions. Of course not. It's 1 byte for ansistring, 2 bytes for widestring. The point is that the compiler knows how many bytes it is based on the declaration of S. In your proposal, it is dynamic, if I understand it correctly. There were hundreds of complains in all the appropriate forums and mailing list. Complaints about what exactly ? So not much additional harm can be done, anyway. I suggest that it should be according to the character_size definition stored S, and the operation c := S[x] should transfer the appropriate count of bits, provided the type of c allows for taking them. As far as I understand your proposal, this currently cannot be done ? The compiler needs to know the S[X] size at compile time. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] String vs WideString
On Tue, 15 Aug 2017, Mattias Gaertner via Lazarus wrote: On Tue, 15 Aug 2017 12:02:28 +0200 Michael Schnell via Lazarus wrote: On 15.08.2017 11:52, Michael Van Canneyt via Lazarus wrote: > This cannot be solved properly except by duplicating the classes unit. Sorry to disagree, but IMHO this can only be solved properly by defining an additional fully dynamically encoded string type and use same for TStrings (see -> http://wiki.freepascal.org/not_Delphi_compatible_enhancement_for_Unicode_Support ) It does not explain what the characters of DynamicString are, does it? I was just going to write that. The problem of the element size is circumvented by simply not digging into it. What does S[2] mean in your proposal ? Is it 1, 2, 4 or even 8 bytes ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] String vs WideString
On Tue, 15 Aug 2017, Michael Schnell via Lazarus wrote: On 15.08.2017 11:25, Michael Van Canneyt via Lazarus wrote: WideString/UnicodeString for those that want 2-byte characters. A codepage-aware single-byte string for those that want 1-byte characters. The shortstring is even still available. IM (often stated) O, this does not help as long as TStrings does not without forced auto-conversion support the string type the user is inclined to choose. Please check TStrings in trunk. This exists. procedure LoadFromFile(const FileName: string; AEncoding: TEncoding); overload; virtual; procedure LoadFromStream(Stream: TStream; AEncoding: TEncoding); overload; virtual; The only 'problem' is that TStrings uses a single-byte string. This cannot be solved properly except by duplicating the classes unit. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] String vs WideString
On Tue, 15 Aug 2017, Mattias Gaertner via Lazarus wrote: On Mon, 14 Aug 2017 18:47:58 +0200 Sven Barth via Lazarus wrote: [...] The main problem of such a dynamic type would be the inability to do fast indexing as the compiler would need to insert runtime checks for the size of a character. I had already thought the same, but then had to discard the idea due to this. IMHO the main problem of adding a new string type is https://xkcd.com/927/ Exactly. I don't think we should add even more. As it is now, FPC offers a way out for all cases: WideString/UnicodeString for those that want 2-byte characters. A codepage-aware single-byte string for those that want 1-byte characters. The shortstring is even still available. Attempting to store binary data in a string is not advisable. Dynamic arrays, TBytes and - in the worst case - TBytesStream are powerful enough to cover most use-cases in this area. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Reporting engine - What it's state?
Hi, I will commit the code to FPC svn the coming week. Michael. On Fri, 11 Aug 2017, Andreas Frieß via Lazarus wrote: Hi, pls, where can the actual 'unstable ?' Code found ? fpc trunk, where ? Thanks Andreas Am 24.07.2017 um 08:54 schrieb Michael Van Canneyt via Lazarus: On Mon, 24 Jul 2017, Gabor Boros via Lazarus wrote: Hi All, 2015. 07. 09. 21:45 keltezéssel, Michael Van Canneyt írta: Just an opinion: I am working with Graeme Geldenhuys to create a reporting engine from scratch. I think Lazreport's design contains some fundamental flaws, which can only be remedied by re-implementing a reporting engine from scratch. Two years gone. Any news? I see "In progress" on the Foundation's page, but want to know more detailed informations. https://foundation.freepascal.org/projects/reporting-engine It's ready and waiting for release. I'm waiting for 2 small fixes still: - Some strange error when exporting a custom element to PDF - Removing a dependency on freetype.dll on windows. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] High DPI ?
On Sat, 5 Aug 2017, Ondrej Pokorny via Lazarus wrote: On 05.08.2017 15:39, Michael Van Canneyt via Lazarus wrote: Since I have the same setup as the reporter I have applied the patch provided in this bugreport, and then HighDPI works on Linux. The buttons and images have a reasonable size, font looks normal... So, from my point of view, that patch can be applied ASAP :) Thanks for the feedback - sometimes it's quite hard to get feedback from the reporters. I applied the patch. Thank you, it's a huge improvement ! Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] High DPI ?
On Sat, 5 Aug 2017, Ondrej Pokorny via Lazarus wrote: On 05.08.2017 14:16, Michael Van Canneyt via Lazarus wrote: How can I check that the IDE has actually enabled/activated HDPI and uses big icons/button images? Check for Application.Scaled := True in lazarus.pp. This enables Hi-DPI features. I know that, I meant more 'how to verify the effects of this setting' :) Maybe I should have been more clear. Another problem could be that the widgetset sends wrong PPI value to LCL. So check for Screen.PixelsPerInch (96 = 100%). If you build Lazarus with Gtk2, you could be affected by this WS-bug: https://mantis.freepascal.org/view.php?id=31199 Thank you for the tip ! Since I have the same setup as the reporter I have applied the patch provided in this bugreport, and then HighDPI works on Linux. The buttons and images have a reasonable size, font looks normal... So, from my point of view, that patch can be applied ASAP :) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] High DPI ?
Hello, I'm running lazarus on a high-dpi laptop. The laptop has a dual-boot Linux mint and Mac OS. I run Lazarus on both OS-es but I seriously doubt it has enabled HighDPI, because the icon buttons are still very small. How can I check that the IDE has actually enabled/activated HDPI and uses big icons/button images? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Optimize SwapEndian for widestring?
On Tue, 1 Aug 2017, Alexey via Lazarus wrote: Pls tell can I optimize this func? E.g. calc each char's PWord and read/write word. Probably this will be faster: function SSwapEndian(const S: UnicodeString): UnicodeString; var i: integer; p :pwidechar; begin Result:= S; UniqueString(Result); P:=PWideChar(Result[1])); for i:= 1 to Length(Result) do begin P^:= WideChar(SwapEndian(P^)); Inc(P); end; end; -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FCL DOM [vs] laz2_DOM, and more
On Sun, 30 Jul 2017, Michalis Kamburelis via Lazarus wrote: 2017-07-30 10:00 GMT+02:00 Michael Van Canneyt via Lazarus : On Sat, 29 Jul 2017, Marcos Douglas B. Santos via Lazarus wrote: Hi, Nowadays, we have full Unicode support in FPC. So, my question is: The units bellow is still necessary to use XML with Lazarus or we can use just the original provided by FCL? laz2_DOM laz2_XMLRead laz2_XMLWrite laz2_XMLCfg laz2_XMLUtils laz_XMLStreaming The FPC units use UnicodeString (UTF16), the lazarus units use UTF8. If the end result is used excluively in UTF8 strings, the lazarus version may be faster as there will be less conversions. I wonder if we can move the UTF8-based XML units to FPC, to be available in the main FPC distribution too? (Possibly renamed like Utf8_XMLXxx or such, instead of LazX_XMLXxx.) The reason I ask: This requirement (wanting to have XML units based on AnsiStrings, not WideStrings, because your data is almost always in UTF8 and you're fine storing it in AnsiString ) is not really specific to Lazarus, or applications build on top of Lazarus. E.g. in Castle Game Engine I would prefer using UTF8-based XML units too, I often read UTF8 XML files (like X3D, Collada 3D models). But I don't want the "core" CGE to depend on LCL (this makes the process of building and testing simpler -- you can use CGE components in Lazarus, but you can also use CGE with our own minimalistic window management without Lazarus). That is up to the Lazarus people. If they are fine with that: no problem for FPC. I do think that it probably uses some utility functions/units which then also need to be included in FPC. It also means there are 2 codebases. An alternative approach would be to do what we do in other units as well, use 1 codebase for 2 kinds of strings: unit dom; Type DOMString = UnicodeString; {$DEFINE USEUNICODESTRING} {$i DOMh.inc} and unit domutf8; Type DOMString = UTF8String; {$DEFINE USEUTF8STRING} {$i DOMh.inc} etc. Combined with some macro magic, I think this should be doable too. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] FCL DOM [vs] laz2_DOM, and more
On Sat, 29 Jul 2017, Marcos Douglas B. Santos via Lazarus wrote: Hi, Nowadays, we have full Unicode support in FPC. So, my question is: The units bellow is still necessary to use XML with Lazarus or we can use just the original provided by FCL? laz2_DOM laz2_XMLRead laz2_XMLWrite laz2_XMLCfg laz2_XMLUtils laz_XMLStreaming The FPC units use UnicodeString (UTF16), the lazarus units use UTF8. If the end result is used excluively in UTF8 strings, the lazarus version may be faster as there will be less conversions. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] ComparePoints func
On Wed, 26 Jul 2017, Reimar Grabowski via Lazarus wrote: On Wed, 26 Jul 2017 18:53:34 +0100 Graeme Geldenhuys via Lazarus wrote: On 2017-07-26 17:27, Alexey via Lazarus wrote: > Hm, in my app Int makes sense: i need to compare Points in binary > search, and see: >, <, =. Ever heard of Manhatten Length? That would be a more logical approach. If a metric would be more logical (I don't know why exactly it should be but whatever) the euclidean metric would be even more logical, wouldn't it? It is a commonly used length calculation for points. That sounds horrible. Is length really used like this? The length of two points??? Metrics are distance functions. http://en.wikipedia.org/wiki/Taxicab_geometry Any 2 dimensional metric can be used. But it may totally not be the thing the TC needs as the metric conditions may not be desirable in his context. The point is (and Michael made it already) that there is no definition of how to compare points. You have quite a lot of options and the current problem determines which function to use. Therefore it makes no sense to introduce a general ComparePoints-function. Exactly. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] ComparePoints func
On Wed, 26 Jul 2017, Alexey via Lazarus wrote: First start by defining what ComparePoints is supposed to measure or compare. yes, of course: compare source editor x/y positions. Ie, it is CompareCoords. In that case you need some enumerated. TRelativePosition = (rpEqual, rpNorth,rpEast,rpSouth,rpWest, rpNorthEast,rpSouthEast,rpSouthWest,rpNorhWest); +1, 0, -1 does not tell you enough. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] ComparePoints func
On Wed, 26 Jul 2017, Alexey via Lazarus wrote: On 26.07.2017 18:11, Graeme Geldenhuys via Lazarus wrote: ComparePoints() returning a Integer is not a very friendly return type either, Hm, in my app Int makes sense: i need to compare Points in binary search, and see: >, <, =. This compare is very specific to your application. I don't think it would be a good idea to generalize this. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] ComparePoints func
On Wed, 26 Jul 2017, Graeme Geldenhuys via Lazarus wrote: On 2017-07-26 14:54, Alexey via Lazarus wrote: I think LCL has many Compare funcs, but misses func for TPoint. Here it's comparing x/y screen coordinates Why not extend TPoint with an IsEquals() method, so you can do something like var p1: TPoint; p2: TPoint; begin // ... populate p1 & p2 if p1.IsEquals(p2) then // do something. ComparePoints() returning a Integer is not a very friendly return type either, whereas Boolean makes more sense. First start by defining what ComparePoints is supposed to measure or compare. If "equals" is needed, why not simply use p1=p2 ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Reporting engine - What it's state?
On Mon, 24 Jul 2017, Gabor Boros via Lazarus wrote: Hi All, 2015. 07. 09. 21:45 keltezéssel, Michael Van Canneyt írta: Just an opinion: I am working with Graeme Geldenhuys to create a reporting engine from scratch. I think Lazreport's design contains some fundamental flaws, which can only be remedied by re-implementing a reporting engine from scratch. Two years gone. Any news? I see "In progress" on the Foundation's page, but want to know more detailed informations. https://foundation.freepascal.org/projects/reporting-engine It's ready and waiting for release. I'm waiting for 2 small fixes still: - Some strange error when exporting a custom element to PDF - Removing a dependency on freetype.dll on windows. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus