[fpc-pascal] Use OpenDocument (.odt) files as templates
Does someone knows a component to use OpenDocument (.odt) files as templates to generate a .odt output file given some data? Something like https://github.com/opensagres/xdocreport but for pascal. A c library exported as a dll could work also Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JavaScript versions of pascal RTL functions (FormatFloat, DateToStr etc)
2017-10-15 8:25 GMT-02:00 Michael Van Canneyt: > > > Hello, > > If you want the latest preview and demos to play with: > > https://www.freepascal.org/~michael/pas2js-demo-0.8.28.zip Thanks, but i'm getting 404 error Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JavaScript versions of pascal RTL functions (FormatFloat, DateToStr etc)
Em 13 de out de 2017 19:23, "Michael Van Canneyt" <mich...@freepascal.org> escreveu: On Fri, 13 Oct 2017, Luiz Americo Pereira Camara wrote > > > Do you know any implementation of such functions, with similar signatures, > in JavaScript? > In december, you will be able to use pascal for your client app, using pas2js Fantastic I have ported already sysutils, classes, dateutils, strutils, contnrs and DB units. If you want, I can send you the Javascript versions of these files now. I would be glad if you send sysutils and dateutils Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] JavaScript versions of pascal RTL functions (FormatFloat, DateToStr etc)
Hi, I'm developing an app were the client is written in Javascript + HTML and the backend in pascal (fpc) I'd like to use my pascal knowledge of RTL functions, mostly utils (FormatFloat, DateToStr etc) in the client app Do you know any implementation of such functions, with similar signatures, in JavaScript? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] class property accessor static
2017-02-07 23:17 GMT-03:00 Paul Ishenin: > 07.02.2017 18:10, Mattias Gaertner wrote: > >> The getter/setter of a class-property must be "static" (Delphi >> compatible). >> If I understand "static" correctly, then "static" simply omits passing >> the class as parameter. So a static class procedure is just a dumber >> version of a normal class procedure. >> >> What is the advantage of using "static" for class property accessors? >> Aka: Why did Delphi choose static here? >> > Class properties has apperared together with class constants and class > variables (which are static by their nature). They were introduced (as I > understand) to give access to private/protected static elements. > For the record, there was a discussion about the topic years ago: https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg30511.html Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PascalScript broken by FPC 3.0 ?
2017-01-14 21:44 GMT-03:00 Kapibara Pas: > Hi there, > > > What has happened? Is it possible to get it to work again without going > back to Lazarus 1.4 and fpc 2.6.4? > A bug report with a sample project showing the crash would be helpful Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to split file of whitespace separated numbers?
2016-12-31 8:18 GMT-03:00 Bo Berglund: > On Sat, 31 Dec 2016 11:27:53 +0100, greim > > The Readln approach followed by splitting in a stringlist is enough of > an improvement that I can use it. > > Did you look at StrUtils.ExtractSubStr ? Should be faster than TStrings; PosWord := 1; Word := ExtractSubstr(Line, PosWord, [' ']); while (Word <> '') do begin //do work Word := ExtractSubstr(Line, PosWord, [' ']); end; Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to split file of whitespace separated numbers?
2016-12-23 15:27 GMT-03:00 Marco van de Voort: > In our previous episode, Graeme Geldenhuys said: > > For many other things, plain code could be faster, but often a lot more > > effort and time consuming to implement. Where as you could have written > > a regex expression in under 10 seconds and accomplish the same task 8 > > lines of code or less - very little effort required. > > Writing or even worse, reading/debugging regex is about the most intensive > effort there is IMHO. > Agree that Regex carries an extra mental overhead. This is why i kept away from it for a long time. Early this year i needed to use it in one of my projects, so i decided to bite the bullet and read Mastering Regular Expressions book. Once you understand the reasoning behind regex, it's a lot less intimidating. These days i use eventually For coincidence, yesterday, i was writing code to parse raw text to extract some data. Initially i did manually but when i needed to extract a new field i realized things would get even worse. Than rewrote with regex. See diff here: https://www.diffchecker.com/NDDa9gpH IMO much better. Not saying that is easy or should be used at will. But once you learn the basics, regex is a valuable tool. For debugging i use http://regexr.com/ and rely on unit tests to ensure correctness Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to split file of whitespace separated numbers?
Em 23 de dez de 2016 05:15, "Bo Berglund"escreveu: Is there a quick way to split a string of whitespace separated values into the separate members? Unir strutils Wordcount + extractword Or Extractsubstr in loop http://www.freepascal.org/docs-html/rtl/strutils/extractsubstr.html Luiz I have to create a function to process a number of big data files where numbers are stored in lines of 4-6 values using whitespace inbetween. First I got a sample looking like this: {code} 0.41670.3636-14.1483227.2260 {code} Here the separators were 4 spaces so on each line I used (slDecode is a TStringList): {code} sLine := StringReplace(sLine, '', #13, [rfReplaceAll]); slDecode.Text := sLine; {code} Worked fine if a bit slow... The stringlist items are then passed to a string to float function and stored into a dynamic array. But then it failed on a file containing lines like this: {code} 0.0000.0007.0000.000 29.6628 {code} Here there are 3 leading spaces plus one separator is only 2 spaces wide. So I had to modify the code: {code} sLine := Trim(sLine); sLine := StringReplace(sLine, '', #13, [rfReplaceAll]); sLine := StringReplace(sLine, ' ', #13, [rfReplaceAll]); slDecode.Text := sLine; {code} This works in this case but now I realize I need something better, which can deal with varying number of whitespace chars inbetween numbers. The test files are very big, like half a million lines and up, so I cannot introduce a lot of code in the loop since processing time will increase. Is there any good and quick way to extract real data from a space separated list without knowing beforehand the size of the whitespace separators? I guess that my next sample problem will be a file with TAB rather than space or even mixed TAB and space... -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Install gdb on MacOSX to debug fpc applications
2016-12-10 7:34 GMT-03:00 C Western: > I think you have to compile gdb yourself - see posts on the gdb mailing > lists: > > https://sourceware.org/ml/gdb/2016-11/msg00011.html > > https://sourceware.org/ml/gdb/2016-11/msg4.html > > When I last looked, macports had not been updated. I think the > com.apple.taskgated.plist info does not apply to Sierra > Many thanks Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Install gdb on MacOSX to debug fpc applications
I'm following the article below to install fpc in MascOSX (Sierra): http://www.freepascal.org/~michael/articles/lazonmac/lazonmac.pdf I managed to install gdb from macports. The article points that to gdb work properly is necessary to edit com.apple.taskgated.plist file But in recent versions of OSX this file is protected from edit due to SIP: http://stackoverflow.com/questions/30768087/restricted-folder-files-in-os-x-el-capitan Is there any another way to get gdb working? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMS Aurelius Free today
2016-11-10 12:27 GMT-03:00 Dennis: > From Facebook, I just found this ORM became FREE today. > > http://www.tmssoftware.com/site/aureliusfree.asp > > I don't know whether it is better than mormot but might just download > first. > No source code: Aurelius Free Edition is only available for Delphi 10.1 Berlin, and binaries are generated using the latest updates applied. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Could someone explain me which the correct triggering of the BeforeDestruction method?
Seems that Delphi considers that the object is already created at the time AfterConstruction is called, so it understands that when it gets into AfterConstruction is sucessfully created. Semantically makes sense. The counter proof is see if AfterConstruction is called when a exception occurs in constructor Luiz Em 3 de set de 2016 11:50 PM, "silvioprog"escreveu: > Hello, > > My question at title seems stupid, but the reason why I've get this doubt > is just because it get different results between Free Pascal and Delphi in > the following example: > > === begin code === > > program project1; > > {$IFDEF FPC} > {$MODE DELPHI} > {$ENDIF} > {$IFDEF MSWINDOWS} > {$APPTYPE CONSOLE} > {$ENDIF} > > uses SysUtils; > > type > TSomeClass = class > public > procedure LoadSomething; > end; > > TA = class > private > FSomeObject: TSomeClass; > public > constructor Create; virtual; > destructor Destroy; override; > procedure AfterConstruction; override; > procedure BeforeDestruction; override; > property SomeObject: TSomeClass read FSomeObject; > end; > > procedure TSomeClass.LoadSomething; > begin > raise Exception.Create('An exception loading something'); > end; > > constructor TA.Create; > begin > WriteLn(1); > inherited Create; > end; > > destructor TA.Destroy; > begin > WriteLn(2); > inherited Destroy; > end; > > procedure TA.AfterConstruction; > begin > WriteLn(3); > FSomeObject := TSomeClass.Create; > FSomeObject.LoadSomething; > end; > > procedure TA.BeforeDestruction; > begin > WriteLn(4); > FSomeObject.Free; > end; > > var > VA: TA; > begin > VA := TA.Create; > try > finally > VA.Free; > end; > end. > > === end code === > > I've compiled it in Free Pascal from trunk (version 3.1.1 [2016/08/26] for > x86_64) installed on a Xubuntu 16.04 64 bits, and got the following log: > > $ ./project1 > 1 > 3 > 2 > An unhandled exception occurred at $004001CD: > Exception: An exception loading something > $004001CD LOADSOMETHING, line 30 of project1.lpr > $0040045A AFTERCONSTRUCTION, line 50 of project1.lpr > $004002CC CREATE, line 38 of project1.lpr > $004004FA main, line 62 of project1.lpr > > and I've compiled the same code in an original version of Delphi Pro > (version 10.1 Berlin 24.0.22858.6822), on a Windows 10 64 bits, and I got > the log below and a critical exception (notice the result numbers, they are > different from similar test compiled in Free Pascal): > > Win32\Debug>Project1.exe > 1 > 3 > 4 > 2 > ^C > > (I need to kill the app by Ctrl+C within terminal) > > the critical exception was the known: > > [Main Instruction] > Project1.exe has stopped working > > [Content] > Windows is checking for a solution to the problem... > > So, is it a bug? If so, in which compiler?! Even after reading some > documents about BeforeDestruction I still have doubt about which is the > correct triggering of this method, and I would be glad if someone could > help me to solve it. > > -- > Silvio Clécio > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
2016-07-11 16:23 GMT-03:00 Graeme Geldenhuys: > On 2016-07-11 19:32, Michael Van Canneyt wrote: > > Maybe switching to git alone may make a checkout less painful > > I have no doubts. ;-) > > Regarding the checkout it would be slower than the svn checkout since git retrieves all the revision history. In a project with such long history, it will take a while to complete the checkout. In the other side, IMO git has advantages that outweight this drawback. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Best way / tool to create resource files (*.res) for fpc projects
For Lazarus projects, the IDE comes with an integrated resource editor that uses fcl-res to create the resource file In my case, i want to create a standalone resource to be used in a package so can't use Lazarus IDE editor Is there any tool that uses fcl-res to manipulate resource files? (GLazRes uses the old lrs format) Another solution is to create resource files with third party tool ( http://www.resedit.net https://stefansundin.github.io/xn_resource_editor or even manually with windres) Is there any drawback of using third party tools to create resource files to be used with fpc? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMaskUtils.ValidateInput function: how is it supposed to behave?
2016-04-18 13:47 GMT-03:00 Bart: [..] > The internal processing of the (edit)mask is the same as TMaskEdit. > If that is broken somehow, it is also broken in TMaskEdit. > > The only functions that may need adjustments are > > * function FormatMaskText(const EditMask: string; const AValue: string): > string; > * function FormatMaskInput(const EditMask: string): string; > * function MaskDoFormatText(const EditMask: string; const AValue: string; >ASpaceChar: Char): string; > * function TMaskUtils.TryValidateInput(out ValidatedString: String): > Boolean; > > But since there is no real documentation and there is no test suite, > it's hard to tell if they do not function as they should or introduce > regressions. > > I propose to write a test suite first with the desired output, based on Delphi. Given that the implementation becomes a detail, subject to changes in future. I can take the duty of starting, just need to know the format. fpcunit or plain tests like most fpc tests? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] try..finally vs interfaces performance
2016-04-14 10:58 GMT-03:00 Graeme Geldenhuys: > On 2016-04-14 14:15, Marcos Douglas wrote: > > because you gain more than just automatic memory release. > > It is also worth noting that not all Interface usage means “automatic > memory release”. If you use COM-style Interfaces, then yes you get > memory management. Not necessarily, you can use COM interfaces with TComponent or other class that implements addref method but does not automatically frees the instance when refcount is zero Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Sqldb - How to pass an array of values as a param to be used with SQL IN operator?
2016-04-10 16:29 GMT-03:00 Tony Caduto: > What about using a stored procedure to do it ? You could pass the list > for the in as a string and handle it in the stored procedure. Of course > that's no help if using sqlite or other that does not support stored > procedures. > I'm working with multiple DB engines, so i try to avoid non standard syntax/features. My workaround is working fine, so no need to break this rule Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Sqldb - How to pass an array of values as a param to be used with SQL IN operator?
2016-04-10 15:39 GMT-03:00 Stephen Chrzanowski: > Due to the nature of the bind mechanism, you won't be able to do it this > way. The only way you'll be able to do that is with your program doing > string substitution instead of doing the bind. Since you're dealing with > integers only, you'll just need to make sure that every entry you're > substituting for is actually an integer. > > I'm afraid is really not possible. Some months ago i searched for a delphi solution and the proposed is the same as yours. I hoped that would exist some solution in fpc side. As a workaround, I just implemented pre processing the SQL with a regular expression to detect param binding inside in expression and replace the binding with the string without the quotes before passing to the query. The remaining issue is that open doors for SQL injection attacks. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Sqldb - How to pass an array of values as a param to be used with SQL IN operator?
2016-04-10 11:01 GMT-03:00 Tony Caduto: > Did you try putting quotes around the param ID in the sql query? > in(":myparam") > I am guessing it's the commas that are the problem. > Its the other way around the problem is the quotes See the attached app. When using Select * from Test where Id in (1,3) it works but using Select * from Test where Id in (:idlist) and doing the param binding does not work because is translated into: Select * from Test where Id in ('1,3') Luiz project1.lpr Description: Binary data ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Sqldb - How to pass an array of values as a param to be used with SQL IN operator?
I switched most of my SQL queries to use Params instead of formatting directly the SQL. But until now i havent figured a way to pass an array of values (mostly integers) to be used with IN operators. Example: SQL: Select * from Customer where Id in (:idlist) I need to query customers with Ids 1, 2 and 3 If i do ParamByName('idlist').AsString := '1,2,3'; will not work. Is there a way to accomplish this? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Create dynamic SQL according to available params
Thanks for all the responses The Marcos' one is particular interesting since goes in a direction a did not think earlier Luiz 2016-04-07 12:06 GMT-03:00 Graeme Geldenhuys: > On 2016-04-07 13:47, Michael Thompson wrote: > > This moves it up that list... > > I can give you many more reason to move it up even further. ;-) tiOPF is > a treasure trove of goodies (for DB and non-DB projects). > > Regards, > - Graeme - > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Create dynamic SQL according to available params
2016-04-07 9:03 GMT-03:00 Michael Van Canneyt <mich...@freepascal.org>: > > > On Thu, 7 Apr 2016, Luiz Americo Pereira Camara wrote: > > >> Is there any code that given a SQL Template would generate the second >> filter when paramy is available and keep blank when not available? >> >> >> > I have not found such code. I rolled my own. > > Any chance sharing the code or at least the syntax? Thanks in advance Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Create dynamic SQL according to available params
I enconter the following pattern frequently (simplified): SQL: Select * From Customers Where FieldX = 1 Later i need a similar query that uses a different filter like Select * From Customers Where FieldX = 1 and FieldY = :paramy Is there any code that given a SQL Template would generate the second filter when paramy is available and keep blank when not available? Like Select * From Customers Where FieldX = 1 ${paramtemplate paramy} The param not necessarily have to be in TParams, in my case the param is both in a JSON object and in TParams If there's not in pascal, someone knows such templating in another languages? The hard part is getting a flexible and functional syntax Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Recovering info from a backtrace with an external debug file
2016-02-11 0:12 GMT-03:00 Martin: > > Lazarus has "Leaks and Traces" in the view menu. Paste the trace, and then > use the Button "Resolve" to load the exe with symbols. That should do. > > It uses a copy of the code found in infodwrf and "whatever the name of the > unit reading stabs". Both of them (afaik) dont do dbg files. If someone has > info how to add that, well > > > as for gdb, you can open your exe (and if gdb finds the dbg file, then > that should be fine.) > if gdb loaded your dbg info, then you can do something (not tested/from > memory) > > info symbol 0x54320 > > and it prints what is at that address. Do that for each address in the trace. > > Thanks. Much helpful Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Recovering info from a backtrace with an external debug file
2016-02-11 0:06 GMT-03:00 Luiz Americo Pereira Camara < luizameri...@gmail.com>: > > > 2016-02-10 23:59 GMT-03:00 <wkitt...@windstream.net>: > >> On 02/10/2016 09:47 PM, Luiz Americo Pereira Camara wrote: >> >>> >>> How to get the line number, method names of the backtrace using the >>> external >>> debug file? >>> >> >> my first eWAG gut response is to distribute the DBG file with the >> executable... >> >> > Thanks > > But that will not help, the backtrace will still be generated without > info, just address > > My apologies. After some testing, i found that when the dbg file is in the same dir as the executable, the calltrace is show with lineinfo. Seems that fpc generates code to find the debug info. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Recovering info from a backtrace with an external debug file
Hi, I compiled a program with -Xg (generating an external debug info file *.dbg) And deployed the executable without the debug info When an exception occurs i get a backtrace with only addresses How to get the line number, method names of the backtrace using the external debug file? Thanks in advance Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Recovering info from a backtrace with an external debug file
2016-02-10 23:59 GMT-03:00 <wkitt...@windstream.net>: > On 02/10/2016 09:47 PM, Luiz Americo Pereira Camara wrote: > >> >> How to get the line number, method names of the backtrace using the >> external >> debug file? >> > > my first eWAG gut response is to distribute the DBG file with the > executable... > > Thanks But that will not help, the backtrace will still be generated without info, just address Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
Em 24/09/2015 18:02, "Mattias Gaertner"escreveu: > > On Thu, 24 Sep 2015 16:21:31 +0100 > Graeme Geldenhuys wrote: > > > On 2015-09-24 16:14, Michael Van Canneyt wrote: > > Is lazbuild a pure console application? > > Yes. > > > If so, no problem, but my guess > > is that it still uses the LCL somewhere (ie: NoGUI widget type). > > Yes, it (still) needs some LCL units, but no gui libs. > Good to know One issue i found while trying to use lazbuild in a headless server is that there's no standalone lazbuild debian package. To use it i have to install the complete lazarus package that depends on gtk lib which is not needed / undesirable in this setting Btw the enviroment i needed lazbuild is cloud9 IDE. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Persistent list to store objects
TCollection with fpjsonrtti unit See examples in packages/fcl-json folder Luiz Em 17/08/2015 14:06, luciano de souza luchya...@gmail.com escreveu: Hello all, There are several classes which manages lists. TCollection, TObjectlist, TFPGObjectlist... Does someone know if one of then can be saved as a file and reloaded again to an object? Regards, -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] record helpers how they effect records
I'd like to extend the question to class helpers, i.e., declaring and using the helper is equivalent to declaring and using a function that takes the class instance as a parameter? Luiz Em 08/06/2015 17:52, David Emerson dle...@angelbase.com escreveu: using a simple record, e.g. some_record_type = record a, b : longint; end; If I declare a record helper, does this change the record in any way? i.e. does the record take any more space when passed as a function parameter? Does it become somehow like an object, and need to be allocated? Or is the helper more like a language shortcut/convenience, where the compiler still treats the record the same way, and declaring and using the helper is equivalent to declaring and using a function that takes the record as a parameter? I'm using mode objfpc Thanks! ~David ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Google Code closing down
2015-03-14 17:16 GMT-03:00 Graeme Geldenhuys mailingli...@geldenhuys.co.uk : On 2015-03-14 19:44, vfclists . wrote: Google Code now has an Export to Github version on the repository pages. I've just noticed that too. That should make saving valuable open source projects much easier (way less effort). I've anybody wants to help collaborate in saving some or all FPC, Lazarus and Pascal projects please let me know. We can put our heads together and come up with a plan and work off a list of projects. I've just briefly scanned through some projects. There are projects like the FPC LLVM backend compiler (not sure if FPC developers know about this), Transmission GUI Frontend, FBLib (though I have my own fork on Github already), Luipack, LuiPack is active (although there's not a release in the last years). I'll do the migration on my own. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] AWS Lib - Object Pascal library for the Amazon Web Services
Good work. Currently i dont use AWS but if i need in future i will give a try. As a tip, i suggest to add GUID to interface declarations this will allow to query them. In Lazarus put the cursor after interface keyword and press Ctrl+Shift+G Luiz Em 27/12/2014 22:42, Marcos Douglas m...@delfire.net escreveu: Hi, I'm glad to announce the 0.2 release of AWS Lib, a minimalistic Object Pascal implementation for the Amazon Web Services. The project has been completely rewritten using OOP. It is extensible, fully object-oriented, interface-based and all objects are immutable objects. https://github.com/mdbs99/AWS Operations such authentication, create/delete buckets, upload/download objects (files and folders), work perfectly. There are Unit tests for all code. Synapse is used for HTTP protocol, but all classes work by contract (interfaces) then you can use lNet, fphttpclient or whatever you want, just implement the interfaces. The classes are sealed to encourage decorator pattern, not inheritance. Improvements will come and comments are welcome. Thank you. Regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Brook Framework and Template Engines
2014-12-12 10:14 GMT-03:00 silvioprog silviop...@gmail.com: On Fri, Nov 14, 2014 at 11:18 AM, Fabrício Srdic fabricio.sr...@gmail.com wrote: Hello, What's the current status of the Brook Server Pages project? What's the recommended template engine to use with Brook Framework? Best regards Hello, Just waiting someone to fix this leak problem: Not more. https://github.com/remobjects/pascalscript/pull/95 Luiz https://github.com/remobjects/pascalscript/issues/61 -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Mapping Cairo pixmap to FPC Bitmap and back
https://code.google.com/p/luipack/source/browse/trunk/cairo/lcl/cairolcl.pas#152 https://code.google.com/p/luipack/source/browse/trunk/cairo/lcl/include/win32/cairolcl.inc#4 Direct bitmap data access (possible also with LCL.TBitmap in some cases) https://code.google.com/p/luipack/source/browse/trunk/cairo/imaging/cairoimaging.pas#116 Luiz 2014-09-21 19:10 GMT-03:00 Giuliano Colla giuliano.co...@fastwebnet.it: Could anyone more knowledgeable than me point me in the right direction to find how a Cairo pixmap maps into a FPC Bitmap, and possibly to some existing code for doing the trick of converting from the one to the other, thus saving me hours of searching? Thanks in advance for any hint. Giuliano ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Fast HTML Parser
2014-08-08 8:28 GMT-03:00 Marco van de Voort mar...@stack.nl: In our previous episode, luiz americo pereira camara said: You can try http://www.benibela.de/sources_en.html#internettools That seems more something like sax_html fromt the fcl-xml package. It's not a simple parser. It has the ability to extract part of html through templates. See http://videlibri.sourceforge.net/cgi-bin/xidelcgi Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Fast HTML Parser
You can try http://www.benibela.de/sources_en.html#internettools Luiz 2014-08-07 10:20 GMT-03:00 Marco van de Voort mar...@stack.nl: In our previous episode, Marcos Douglas said: It has (or at least had) a very simple to use HTML parser that was very fast. If you don't come write with the above URL, I have some release archives I know contains the code. Just let me know and I can make it available. But the fasthtmlparser, your tip before, is a powtils' source, don't? I have the code -- for many years -- but I did not know about fasthtmlparser. It's very simple. I did not found everything I want but it is a good start. Yes it is. The CHM parser is also based on it, but there z505 is not listed as author but as contributor: AUTHOR : James Azarja http://www.jazarsoft.com/ CONTRIBUTORS : L505 http://z505.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to use generics and meta class?
2014-02-27 18:43 GMT-03:00 Joao Morais l...@joaomorais.com.br: Correct. The feature I was talking about is something like: generic TMyGenericT: TMyType And TMyType is a class. In this case the compiler knows I am talking about a generic for a class type and a generic as Java becomes possible. Seems that you are looking to class type constraints: http://docwiki.embarcadero.com/RADStudio/XE4/en/Constraints_in_Generics http://blogs.teamb.com/craigstuntz/2008/08/29/37832 Not sure if will allows to do what you are looking for Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Placing binary data (resources) in object files?
2013/6/4 Anthony Walter sys...@gmail.com: I came with a nice solution to all this and thought I'd share... I wrote a tool named makeres. Is it open source? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Difference between fpc 2.6.2 rc1 and fpc 2.6.2 final
Somehow i missed the final release of 2.6.2 So i'm still using fpc 2.6.2rc1 Are there any difference between those two versions? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Difference between fpc 2.6.2 rc1 and fpc 2.6.2 final
2013/4/11 Jonas Maebe jonas.ma...@elis.ugent.be: On 11 Apr 2013, at 13:18, luiz americo pereira camara wrote: Are there any difference between those two versions? Yes, all commits later than r22844 in svn log http://svn.freepascal.org/svn/fpc/tags/release_2_6_2 | less Thanks Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] File Association and opening with already running app
2013/4/5 Graeme Geldenhuys gra...@geldenhuys.co.uk: On 2013-04-04 16:34, Dennis wrote: In windows, you can create Mutex. That's how I ensure no other instance of the same program is running. Yes I know that bit, and that is what I did for my old VB6 and Delphi 5 projects. The question here was not only about a single instance application, but also how to pass information to the first instance (eg: please open this new file in a tab) before the second instance terminates. The uniqueinstance componente does all this Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPJSON and float values.
2013/2/28 Michael Van Canneyt mich...@freepascal.org: On Thu, 28 Feb 2013, silvioprog wrote: Hello, Please see: http://bugs.freepascal.org/view.php?id=23970 Fixed. Seems that you committed by accident code to make AsJSON output more compact. This may lead to compatibility problems. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Strings - suggestions
Em 22/12/2012 09:55, Michael Van Canneyt mich...@freepascal.org escreveu: Because of the requirement for backwards compatibility with FPC itself, we'll make 2 RTLs: one backwards compatible, one with the new unicode string. It will be possible to compile a utf8 rtl? There will be a RtlString ? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Requirement of {$M+} to add RTTI info
2012/12/12 Sven Barth pascaldra...@googlemail.com: Am 12.12.2012 01:15 schrieb luiz americo pereira camara luiz...@oi.com.br: Some time ago, i was getting an error while trying to use RTTI functions in a class descending directly of TObject Later i discovered that i needed to descend from TPersistent due to $M+ directive (http://www.freepascal.org/docs-html/prog/progsu44.html), so i did. Now, i decided to go back and descend directly from TObject. To allow RTTI usage i would put M+ around my own class I tested again and using RTTI functions (SetOrdProp, GetPropInfo) worked even without declaring {$M+} Can you check whether your unit was really recompiled? Remove the .ppu and .o files for the unit to be on the save side. I already did that Also it could be that the switch was declared somewhere before your class and not disabled again with {$M-} Maybe. I also think of a compiler option being passed in Lazarus package but could not find such option So, is it really necessary to put $M+ to use RTTI? Yes. Thanks. I 'll put M+ it anyway Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Requirement of {$M+} to add RTTI info
Some time ago, i was getting an error while trying to use RTTI functions in a class descending directly of TObject Later i discovered that i needed to descend from TPersistent due to $M+ directive (http://www.freepascal.org/docs-html/prog/progsu44.html), so i did. Now, i decided to go back and descend directly from TObject. To allow RTTI usage i would put M+ around my own class I tested again and using RTTI functions (SetOrdProp, GetPropInfo) worked even without declaring {$M+} So, is it really necessary to put $M+ to use RTTI? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Help translate .SAVENV x86-64 assembly directive
Hi, I'm translating porting a Delphi component that uses x86-64 assembly. So far, most of the asm code compiles and works fine. The only thing that i could not translate is the .SAVENV directive. See http://blogs.embarcadero.com/abauer/2011/10/10/38940 and http://docwiki.embarcadero.com/RADStudio/en/Assembly_Procedures_and_Functions Seems that is necessary to save and restore the register with a specific alignment. I would appreciate any help The procedure is below. The component is VirtualTreeView and full source can be found at http://virtual-treeview.googlecode.com/svn/trunk/Source/VirtualTrees.pas procedure AlphaBlendLineMaster(Source, Destination: Pointer; Count: Integer; ConstantAlpha, Bias: Integer); // Blends a line of Count pixels from Source to Destination using the source pixel and a constant alpha value. // The layout of a pixel must be BGRA. // ConstantAlpha must be in the range 0..255. // Bias is an additional value which gets added to every component and must be in the range -128..127 asm {$ifdef CPU64} // RCX contains Source // RDX contains Destination // R8D contains Count // R9D contains ConstantAlpha // Bias is on the stack .SAVENV XMM6 //todo see how implement in fpc // Load XMM3 with the constant alpha value (replicate it for every component). // Expand it to word size. MOVDXMM3, R9D// ConstantAlpha PUNPCKLWD XMM3, XMM3 PUNPCKLDQ XMM3, XMM3 // Load XMM5 with the bias value. MOV R10D, [Bias] MOVDXMM5, R10D PUNPCKLWD XMM5, XMM5 PUNPCKLDQ XMM5, XMM5 // Load XMM4 with 128 to allow for saturated biasing. MOV R10D, 128 MOVDXMM4, R10D PUNPCKLWD XMM4, XMM4 PUNPCKLDQ XMM4, XMM4 @1: // The pixel loop calculates an entire pixel in one run. // Note: The pixel byte values are expanded into the higher bytes of a word due // to the way unpacking works. We compensate for this with an extra shift. MOVDXMM1, DWORD PTR [RCX] // data is unaligned MOVDXMM2, DWORD PTR [RDX] // data is unaligned PXORXMM0, XMM0// clear source pixel register for unpacking PUNPCKLBW XMM0, XMM1{[RCX]} // unpack source pixel byte values into words PSRLW XMM0, 8 // move higher bytes to lower bytes PXORXMM1, XMM1// clear target pixel register for unpacking PUNPCKLBW XMM1, XMM2{[RCX]} // unpack target pixel byte values into words MOVQXMM2, XMM1// make a copy of the shifted values, we need them again PSRLW XMM1, 8 // move higher bytes to lower bytes // Load XMM6 with the source alpha value (replicate it for every component). // Expand it to word size. MOVQXMM6, XMM0 PUNPCKHWD XMM6, XMM6 PUNPCKHDQ XMM6, XMM6 PMULLW XMM6, XMM3// source alpha * master alpha PSRLW XMM6, 8 // divide by 256 // calculation is: target = (alpha * master alpha * (source - target) + 256 * target) / 256 PSUBW XMM0, XMM1// source - target PMULLW XMM0, XMM6// alpha * (source - target) PADDW XMM0, XMM2// add target (in shifted form) PSRLW XMM0, 8 // divide by 256 // Bias is accounted for by conversion of range 0..255 to -128..127, // doing a saturated add and convert back to 0..255. PSUBW XMM0, XMM4 PADDSW XMM0, XMM5 PADDW XMM0, XMM4 PACKUSWBXMM0, XMM0// convert words to bytes with saturation MOVDDWORD PTR [RDX], XMM0 // store the result @3: ADD RCX, 4 ADD RDX, 4 DEC R8D JNZ @1 {$endif} end; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Editing XMP data in images
2012/10/1 Mattias Gaertner nc-gaert...@netcologne.de Hi, I need to edit XMP data in images (at least tif, jpg). Maybe someone has already done it and can give me a hint? This? https://delphihaven.wordpress.com/ccr-exif/ Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic messaging in Delphi
Em 24/7/2012 11:13, Ryan Joseph escreveu: I was asking on the Mac Pascal list if Delphi had any ways to invoke methods on objects which the class was unknown at compile time (like a class that invokes a user defined delegate commonly used in Cocoa Mac programming and I assume Delphi not knowing) and one user told me interfaces will work for this. Btw, I'm aware you can use strings to invoke methods with a single argument but I wanted something better since this has been a real drawback in Pascal for me in recent years. The idea is Main.pas has a delegate class which implements IMyInterface and MyInterface.pas declares the interface and can invoke its methods using a generic delegate object (typed TObject). This is really typical of UI elements like a button that wants to tell a receiver an action occurred but doesn't know the class of the receiving object. Providing this example works it's sort of a workaround to multiple inheritence but I don't see that Pascal would be capable of this, i.e. simply type casting an object and forcing it to call a method that may or may not exist (I feel like I tried this before and got crashing). He swears this works and no one else answered otherwise but I'm getting Error: Class or Object types TObject and IMyInterface are not related errors at the line shown below. if delegate.GetInterface(IMyInterface, intfDelegate) then intfDelegate.DoThis Luiz Any ideas? Thanks. {$mode delphi} {$interfaces corba} unit MyInterface; interface type IMyInterface = interface procedure DoThis (value: integer); end; procedure InvokeDelegate (delegate: TObject); implementation procedure InvokeDelegate (delegate: TObject); var intfDelegate: IMyInterface; begin ERROR intfDelegate := IMyInterface(delegate); intfDelegate.DoThis(1); end; end. {$mode delphi} {$interfaces corba} program Main; uses MyInterface; type TMyDelegate = class (TInterfacedObject, IMyDelegate) procedure DoThis (value: integer); end; procedure TMyDelegate.DoThis (value: integer); begin writeln('did this ', value); end; var delegate: TMyDelegate; begin delegate := TMyDelegate.Create; TestDelegate(delegate); end. Regards, Ryan Joseph thealchemistguild.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic messaging in Delphi
Em 24/7/2012 20:17, Ryan Joseph escreveu: I never heard of this syntax, is it Delphi only? Trying this I got Error: Interface type IMyInterface has no valid GUID. What else do I need to do? The sintaxe i posted is for COM interfaces. For CORBA interfaces do IMyInterface = interface ['myintf'] procedure DoThis (value: integer); end; if delegate.GetInterface('myintf', intfDelegate) then intfDelegate.DoThis Luiz Thanks. On Jul 24, 2012, at 4:26 PM, Luiz Americo Pereira Camara wrote: if delegate.GetInterface(IMyInterface, intfDelegate) then intfDelegate.DoThis Regards, Ryan Joseph thealchemistguild.com http://thealchemistguild.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Nginx, FastCGI and /module/action vs ?module=moduleaction=action
Em 22/7/2012 18:49, leledumbo escreveu: It's indeed nginx fastcgi configuration issue, I've managed to make it work somehow by reading its documentation. Thanks :) Can you post your config here so we can also learn how to configure nginx? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] JSON and UTF8
Em 10/7/2012 23:19, waldo kitty escreveu: On 7/10/2012 07:00, Luiz Americo Pereira Camara wrote: With the old behavior, in an system with a system code page UTF8, if i try to show the parsed value of \u4E01 in e.g. a LCL app will get garbage. I would expect to work correctly in any enviroment this means that some environments will end up with garbage for those UTF-8 characters that cannot be translated back to the local codepage... i've been running headlong into this with another project and needing to convert from UTF-8 back to at least CP437... there are more than 255 characters in UTF-8 and there's no way i know of to translate them all back to 255 characters... even with trying to use multiples like ae for æ ( alt-145 in CP437 i think realizing that this editor can do whatever it wants to :/ )... the doublet and the character i typed the ones i was thinking of for this example, though... In the previous behavior (conversion UTF16 - system code page) you will get a meaningless character anyway, i.e., those unicode characters are not correctly translated to the system code page correctly since is impossible. BTW: the original issue is already fixed. Thanks Michael Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] JSON and UTF8
Em 10/7/2012 04:32, Ludo Brands escreveu: Following up on bug 22310 http://bugs.freepascal.org/view.php?id=22310 I enabled the use of UTF8 in the FPC JSON support. The constructors of the JSON parser/scanner now accept an extra argument UseUTF8 which tells them to convert JSON strings to UTF8, not the system codepage. I don't understand why you want to keep buggy behavior for backwards compatibility. I explain: StringToJSONString doesn't do any character conversion except for some special characters. The json spec rfc4627 par 3 says: JSON text SHALL be encoded in Unicode. The default encoding is UTF-8. Since no conversion is done logic says that fpjson expects unicode. Since TJSONStringType = AnsiString, UTF-8 is the only unicode encoding possible. So I don't understand why writing a TJSONStringType has to be utf8 to be compliant with the spec and with the outside world and when reading the same string back it is converted in system encoding. If system encoding support is needed then StringToJSONString should do also a system to utf8 encoding. Agree with Ludo Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] JSON and UTF8
Em 10/7/2012 04:59, Michael Van Canneyt escreveu: On Tue, 10 Jul 2012, Ludo Brands wrote: Following up on bug 22310 http://bugs.freepascal.org/view.php?id=22310 I enabled the use of UTF8 in the FPC JSON support. The constructors of the JSON parser/scanner now accept an extra argument UseUTF8 which tells them to convert JSON strings to UTF8, not the system codepage. I don't understand why you want to keep buggy behavior for backwards compatibility. Because the old behaviour is not buggy. It's. With the old behavior, in an system with a system code page UTF8, if i try to show the parsed value of \u4E01 in e.g. a LCL app will get garbage. I would expect to work correctly in any enviroment Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] UTF8 JSON library: was: [Lazarus] UTF-8 XML
Em 24/6/2012 07:58, Reinier Olislagers escreveu: Related: With the help of Ludo Brands - as usual ;) - I've converted the FPC fpjson library to return UTF8 data. I use it for my twitter/Oauthv1 library/program; you can find it incorporated there at https://bitbucket.org/reiniero/fpctwit/src See e.g. fpjsonreadme.TXT I've renamed the units so they shouldn't conflict with the FPC ones. Note: I've only had to convert JSON strings to objects, not the other way round; haven't tested that. No idea whether the RTTI stuff works, haven't used it. As usual, comments/patches welcome ;) Hi, Thanks for your work. I plan to look at OAuth library soon About fpjson and UTF8, can you post an example showing the problem? Maybe i can help. Are you using fpc 2.7.1? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: UTF8 JSON library: was: [Lazarus] UTF-8 XML
Em 24/6/2012 12:22, Reinier Olislagers escreveu: On 24-6-2012 17:05, Luiz Americo Pereira Camara wrote: Hi, Thanks for your work. I plan to look at OAuth library soon No problems, if you have questions, please feel free to ask. I will About fpjson and UTF8, can you post an example showing the problem? The symptom is that the tweets, which are UTF8, get converted to my ANSI codepage on Windows. This means e.g. Greek or Japanese tweets can't be displayed or stored correctly. As mentioned in https://bitbucket.org/reiniero/fpctwit/src/efde73d5b1b3/fpjsonreadme.TXT I applied your patch from bug 22197. I already read but got curious since that change was not supposed to handle this kind of situation Then, adapted line jsonscannerutf8.pp line 244 (FPC 2.7.1 jsonscanner.pp line 238/239), function DoFetchToken to convert incoming json string data to UTF8 instead of system codepage: e.g. from: // Takes care of conversion... S:=WideChar(StrToInt('$'+S)); to: // Convert from Unicode codepoint in hex to UTF8... via UTF16: S:=Utf8Encode(WideString(WideChar(StrToInt('$'+S; This seems correct Maybe i can help. It's working for me right now ;) Just wanted to note that I haven't tested converting objects to JSON output, just JSON strings to objects. Of course, if you have improvement suggestions, they're very welcome. I isolated the problem and reported the issue. See http://bugs.freepascal.org/view.php?id=22310 Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: RE : [fpc-pascal] Re: Variant vs Pointer
On 3/3/2012 10:08, Marcos Douglas wrote: Think in my class like a Business Object. The struct is very similar with TParams it has many TParam. The data, in a TParam, is save in a Variant type. I need something like: u := TmyBO.Create; // the name does matter u.Attr['name'].Value := 'Marcos'; // an instance is created and the name is 'name' and the type is string TJSONObject (unit fpjson) does exactly that I use this way extensively Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Class reference doubt
On 25/11/2011 07:50, Dimitri Smits wrote: so you have: type TMyObject=class(TObject) ... constructor Create; end; Yes TMyClass = class of TMyObject; //-- important I guess Not important or necessary. I was using TClass from RTL = class of TObject ... procedure processSomething(AClass: TClass); var someInstance: TObject; begin someInstance := AClass.Create(); //-- always the one from TClass/TObject? end; Yes ... begin processSomething(TMyObject); end; class methods (and the constructors and destructor) are in Delphi part of the TClass memorystructure. I believe even the TObject default Create. For your trick to work, you need one of 2 things: - declare the class-reference for a type explicitly (class of T...) - make a virtual constructor in a subtype of TObject and declare a class-reference. Then you derive from that subtype. I know all of this. I even already use this approach in one of my libraries where i have a base class and a reference to class of this type. What i needed this time was more generic: the ability to instantiate any TObject without the need to change interface of the classes I don't think (did not test) it finds a TMyClass in Delphi as well if you do not declare the type, so in effect it always takes TClass. The other scenario's I've used before in classfactory pattern before. It has nothing and everything to do with RTTI. No, the new D2010+ RTTI does not give access to the default constructor (I think), Yes, it does see example at http://code.google.com/p/emballo/source/browse/trunk/Src/Emballo.DI.Instantiator.pas#152 Anyway, i already found a solution, so there's no fuzz in my part Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Class reference doubt
On 24/11/2011 08:02, Jonas Maebe wrote: On 24 Nov 2011, at 02:58, Luiz Americo Pereira Camara wrote: On 23/11/2011 18:48, Jesus Reyes wrote: in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create I also hit this problem recently Found that this is one limitation of fpc. Under newer delphi it's possible to get the expected behavior without forcing programmer to create a virtual constructor by using the new RTTI I find it very hard to believe that the behaviour of existing code like that would suddenly change (and hence potentially break programs) simply because extra RTTI is added. It does not change. The task is accomplished by other means See http://code.google.com/p/emballo/source/browse/trunk/Src/Emballo.DI.Instantiator.pas#152 Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Class reference doubt
On 24/11/2011 05:47, Graeme Geldenhuys wrote: On 2011-11-24 03:58, Luiz Americo Pereira Camara wrote: possible to get the expected behavior without forcing programmer to create a virtual constructor by using the new RTTI What has the new RTTI got to do with anything? Simply define TObj.Create as virtual, and TFoo.Create as overridden. This is rather normal coding practise with classes. Nothing special. This solution is not quite generic because is necessary to descend from an specific class and also needs to change an interface declaration. So to use in old code / classes it would be necessary to change the hierarchy and the interface. Also it would not work with classes that i cant change the hierarchy like rtl ones or third party With Delphi is possible to call a constructor even if has a different name from Create and with parameters without changing interface or hierarchy It seems useful for me Luiz 8-8-8-8-8 program test; {$mode ObjFpc}{$H+} type TObj = class public constructor create; virtual; end; TObjClass=class of TObj; TFoo = class(TObj) public constructor create; override; end; constructor TObj.Create; begin inherited create; WriteLn('TObj.create'); end; constructor TFoo.create; begin inherited Create; WriteLn('TFoo.Create'); end; var cls: TObjClass; obj: TObj; begin cls := TFoo; WriteLn('cls class is ',cls.ClassName); Obj := cls.Create; Obj.Free; end. 8-8-8-8-8 And here is the output... $ ./test cls class is TFoo TObj.create TFoo.Create Regards, - Graeme - ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Class reference doubt
On 24/11/2011 19:34, Jonas Maebe wrote: In that case, you did not hit the same problem as the original poster (your I also hit this problem recently is what triggered my response). His problem was that if you call a non-virtual constructor on a class reference variable, that the constructor is determined based on the static type of the class reference rather than on the dynamic type. It does not matter much but i hit the same problem. Just replace class of TObj by class of TObject (TClass) I stored a class (TMyClass) in a class variable (AClass: TClass). I was expecting that calling AClass.Create would call TMyClass.Create. Just like him i found that is not the case. To be clear: i'm not saying that is a bug or asking for changing the behavior The task is accomplished by other means See http://code.google.com/p/emballo/source/browse/trunk/Src/Emballo.DI.Instantiator.pas#152 That's indeed a completely different technique to dynamically instantiate classes (and if you don't really need that kind of flexibility, I would recommend virtual constructors instead since they're much simpler and faster). I will do in a third way, that keeps flexibility (and is also fast) but requires more typing. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Class reference doubt
On 23/11/2011 18:48, Jesus Reyes wrote: in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create I also hit this problem recently Found that this is one limitation of fpc. Under newer delphi it's possible to get the expected behavior without forcing programmer to create a virtual constructor by using the new RTTI Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
On 7/11/2011 07:28, Martin Schreiber wrote: One reason is to make it easy for FPC users to reuse existing Delphi code that is out there without having to rewrite it in an FPC- compatible way. Is there a big demand? Examples? I speak only for myself. This is a component that i'd like to see compiled with fpc http://code.google.com/p/emballo/ The problems - generic support: bugs.freepascal.org/view.php?id=20503 . Can be workaround by type casting - reflection/rtti support to call constructor of a given TClass. Can be work around by registering a function that returns an instance or using AfterConstruction to setup object instead of the constructor directly BTW: i will take the old version version of emballo and rewrite it in an FPC compatible way to get things done in the meantime. Looking also to http://code.google.com/p/delphi-spring-framework/ and http://code.google.com/p/delphi-orm/ Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Free Pascal 2.6.0rc1 released
On 5/11/2011 20:27, Marco van de Voort wrote: Downloads are available at the FTP server at: ftp://freepascal.stack.nl/pub/fpc/beta/2.6.0-rc1/ Cant download 550 /pub/fpc/beta/2.6.0-rc1/: Permission denied. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpWeb REST support (asking about features)
On 7/6/2011 04:22, ik wrote: Hello, One of the thing that I find really missing in fpWeb is the ability to have support for REST. That is, to place different callbacks to GET, POST, UPDATE, DELETE, HEAD and PUT. Let's say that I create a support for the following PATH_INFO: I started something at http://code.google.com/p/luipack/source/browse/#svn%2Ftrunk%2Fluirest It very initial. Did not get the time to finish. Maybe in september when i get more time... Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Minimal Sylpheed plugin in FreePascal
On 17/5/2011 17:03, Anton Shepelev wrote: Jonas Maebe: One likely potential cause is the fact that released FPC versions enable all floating point exceptions. Since libc does not do that, many C programs and frameworks contain invalid floating point operations. Is masking such exceptions a common practice in C? Will it be politically correct to ask the developer to fix the prob- lem? It's the default option for c compilers Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and GetDataLineStart
On 21/4/2011 06:41, Marco van de Voort wrote: In our previous episode, Sven Barth said: Am 20.04.2011 22:20, schrieb Leonardo M. Ram?: Hi, I need to write a function that replaces TLazIntfImage by using fpImage, and I can't find an alternative to GetDataLineStart. How can I replace it?. Maybe I get your intention wrong, but TLazIntfImage is already using fpImage and it derives from a TFPCustomImage itself. True, but TFPCustomImage is abstact wrt memory layout and doens't provide row level access, only pixel level access. Only TFPMemoryImage adds the memory access, but IIRC only 64-bit pixels. (16-bit RGBA) While these abstractions make it easy to make fp/fcl-image somewhat complete, they are also very memory hungry and slow. Besides that there's not a uniform correlation between 16bit and 8bit. See thread http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg16506.html the Lazarus implementation does the following to convert TColor (each color channel with 8bit) to TFPColor (16bit channels): 8bit to 16bit : set low and high memory of each 16bit channel to the 8bit counterpart if 8bit Red channel is $0F the 16bit Red will be $0F0F 16bit to 8bit: get the high memory of each 16bit channel 16 16bit Red is $001F the 8bit red will be $00 IMO is just wasting memory at least in the current implementation that takes no advantage of the wider color range. Luiz IIRC I accelerated loading/saving simple 8-bit BMP images 20 to 50 times in my work code. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Classes and class methods
On 9/2/2011 07:58, Mark Morgan Lloyd wrote: Is it possible to put a class (not an instance) in a variable or array element, and to use this to call a class method? I'm defining a hierarchy of classes and it would be convenient if it were possible to register the fact that a class had a particular subclass, such that the information was available before instantiation. I'm assuming that the code that inspects the array has imported all units so is aware of the relevant class declarations, but I am still having problems with calling class methods and/or casting to a class (as distinct from an instance). Are you looking for something like this?: http://code.google.com/p/luipack/source/browse/trunk/luicontrols/wizardcontrols.pas#266 Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JSON Parser to tree view
ik escreveu: Hello, I wish to use the JSON parser to create some sort of TreeView of my JSON (it's more then 500 lines of data). Before I'll write such code, do you know of any existed code that does such thing, or at least most of the work ? http://code.google.com/p/luipack/source/browse/trunk/vtvextras/vtvutils/vtjson.pas See demos folder Requires VTV from http://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/virtualtreeview-new and LCLExtensioins from http://code.google.com/p/luipack http://code.google.com/p/luipack/source/browse/trunk/vtvextras/vtvutils/vtjson.pas Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
Juha Manninen (gmail) escreveu: Hi In Lazarus project jcf2 component has an IntList class which is poorly implemented. It depends on integer and pointer being the same size. I will later suggest to replace it. I have a better IntList. See: http://github.com/JuhaManninen/Pascal/blob/master/IntList/intlist.pas It is similar to TStringList except that it works with integers. It is well tested. Question: can this class be added to FCL? Clearly such class is needed sometimes and people must make their own versions of it. Generics can solve it in the future but it is not ready yet. Yes it's ready in fpc 240: uses Fgl; type TIntegerList = specialize TFPGList Integer; Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Nesting
Juha Manninen (gmail) escreveu: A new Lazarus review : http://delphimax.wordpress.com/2010/09/13/freepascal-and-lazarus-success-or- failure/ has this comment about Lazarus source: --- Abundant use of the Exit() command instead of nesting code in If/then/else. It has been proven (last time in Delphi Informant Magazine) that allowing a method to nest itself out makes faster code. It is also easier to read and study. Exit should of course be used (it must be used in many situations) but prudently. --- Does nesting really create faster code? If i understand right what you mean by nesting, the produced code is equal at least in my simple test. See attached. I dont know for more complex situations Luiz program template; {$Mode ObjFpc} procedure DoIt; begin WriteLn('DoIt'); end; procedure UseExit(i: Integer); begin if i = 0 then Exit; DoIt; end; procedure DontUseExit(i: Integer); begin if i 0 then DoIt; end; begin //Main UseExit(1); DontUseExit(1); end..file asmExit.pas .section .text .section .text .balign 4 .balign 4 # [asmExit.pas] # [5] begin .globl P$TEMPLATE_DOIT P$TEMPLATE_DOIT: # Temps allocated between ebp-4 and ebp+0 pushl %ebp movl%esp,%ebp subl$4,%esp movl%ebx,-4(%ebp) # [6] WriteLn('DoIt'); callfpc_get_output movl%eax,%ebx movl$_$PROGRAM$_L10,%ecx movl%ebx,%edx movl$0,%eax callfpc_write_text_shortstr callFPC_IOCHECK movl%ebx,%eax callfpc_writeln_end callFPC_IOCHECK # [7] end; movl-4(%ebp),%ebx leave ret .section .text .balign 4 .balign 4 # [10] begin .globl P$TEMPLATE_USEEXIT$LONGINT P$TEMPLATE_USEEXIT$LONGINT: # Temps allocated between ebp-4 and ebp-4 pushl %ebp movl%esp,%ebp subl$4,%esp # Var i located at ebp-4 movl%eax,-4(%ebp) # [11] if i = 0 then Exit; testl %eax,%eax je .L22 # [12] DoIt; callP$TEMPLATE_DOIT # [13] DoIt; callP$TEMPLATE_DOIT # [14] DoIt; callP$TEMPLATE_DOIT # [15] DoIt; callP$TEMPLATE_DOIT # [16] DoIt; callP$TEMPLATE_DOIT # [17] DoIt; callP$TEMPLATE_DOIT # [18] DoIt; callP$TEMPLATE_DOIT # [19] DoIt; callP$TEMPLATE_DOIT # [20] DoIt; callP$TEMPLATE_DOIT # [21] DoIt; callP$TEMPLATE_DOIT .L22: # [22] end; leave ret .section .text .balign 4 .balign 4 # [25] begin .globl P$TEMPLATE_DONTUSEEXIT$LONGINT P$TEMPLATE_DONTUSEEXIT$LONGINT: # Temps allocated between ebp-4 and ebp-4 pushl %ebp movl%esp,%ebp subl$4,%esp # Var i located at ebp-4 movl%eax,-4(%ebp) # [26] if i 0 then testl %eax,%eax je .L34 # [28] DoIt; callP$TEMPLATE_DOIT # [29] DoIt; callP$TEMPLATE_DOIT # [30] DoIt; callP$TEMPLATE_DOIT # [31] DoIt; callP$TEMPLATE_DOIT # [32] DoIt; callP$TEMPLATE_DOIT # [33] DoIt; callP$TEMPLATE_DOIT # [34] DoIt; callP$TEMPLATE_DOIT # [35] DoIt; callP$TEMPLATE_DOIT # [36] DoIt; callP$TEMPLATE_DOIT # [37] DoIt; callP$TEMPLATE_DOIT .L34: # [39] end; leave ret .section .text .balign 4 .balign 4 # [41] begin //Main .globl PASCALMAIN PASCALMAIN: .globl _main _main: # Temps allocated between ebp+0 and ebp+0 pushl %ebp movl%esp,%ebp callFPC_INITIALIZEUNITS # [42] UseExit(1); movl$1,%eax callP$TEMPLATE_USEEXIT$LONGINT # [43] DontUseExit(1); movl$1,%eax callP$TEMPLATE_DONTUSEEXIT$LONGINT # [44] end. callFPC_DO_EXIT leave ret .balign 4 .section .data .ascii FPC 2.0.4 [2006/08/21] for i386 - Win32 .balign 16 .balign 16 .globl THREADVARLIST_P$TEMPLATE THREADVARLIST_P$TEMPLATE: .long 0 .balign 4 .globl FPC_THREADVARTABLES FPC_THREADVARTABLES: .long 3 .long THREADVARLIST_SYSTEM .long THREADVARLIST_OBJPAS .long THREADVARLIST_P$TEMPLATE .balign 4 .globl FPC_RESOURCESTRINGTABLES FPC_RESOURCESTRINGTABLES: .long 0 .balign 4 .globl INITFINAL INITFINAL: .long 2,0 .long INIT$_SYSTEM .long FINALIZE$_SYSTEM .long INIT$_OBJPAS .long FINALIZE$_OBJPAS .section .data .balign 4 .globl __stklen __stklen: .long 262144 .section .data .balign 4 .globl __heapsize __heapsize: .long 0 .section .data .section .data .balign 4 .globl _$PROGRAM$_L10 _$PROGRAM$_L10: .ascii \004DoIt\000 .section .data .section .data .section .bss ___
Re: [fpc-pascal] How to download fpc242 rc1 (to test a possible bug)
Marco van de Voort escreveu: In our previous episode, Luiz Americo Pereira Camara said: And it did compile with 2.4.0? Yes. Also with 251 Hmm, I think I know what that is. A wrong merge that should have been reverted. http://bugs.freepascal.org/view.php?id=16121 I'll see if I can squeeze that in. The 2.5.1 breakage is a different question though. Sorry not being clear. 251 also works Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] How to download fpc242 rc1 (to test a possible bug)
Hi, I noticed that there's a folder for fpc242 rc1 in ftp://ftp.freepascal.org/pub/fpc/beta/ Trying to access gives an error 550 The reason to get the 242 version is to test an bug reported by a user of the fpc243 snapshot provided at http://www.hu.freepascal.org/lazarus/ Basically it would not compile the attached file Luiz program testGeneric; {$Mode ObjFpc} {$H+} uses Fgl; type TIntegerList = specialize TFPGList Integer; var List: TIntegerList; i, j: Integer; begin List := TIntegerList.Create; i := 1; List.Add(i); i := 2; List.Add(i); for j := 0 to List.Count - 1 do WriteLn(List[j]); List.Delete(0); for j := 0 to List.Count - 1 do WriteLn(List[j]); List.Destroy; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to download fpc242 rc1 (to test a possible bug)
Marco van de Voort escreveu: In our previous episode, Luiz Americo Pereira Camara said: I noticed that there's a folder for fpc242 rc1 in ftp://ftp.freepascal.org/pub/fpc/beta/ Trying to access gives an error 550 The reason to get the 242 version is to test an bug reported by a user of the fpc243 snapshot provided at http://www.hu.freepascal.org/lazarus/ 242 branched of in may. So unless it is a recent regression in the 2.4.x family, it will behave the same. Basically it would not compile the attached file And it did compile with 2.4.0? Yes. Also with 251 Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] How to set a CORBA interface property (tkInterfaceRaw) through RTTI
Hi, I've managed to set a COM interface property (tkInterface) through RTTI using SetInterfaceProp. But i could not find a way to set a CORBA interface property (tkInterfaceRaw) since SetInterfaceProp expects IUnknown. In the attached example, when i try to use SetInterfaceProp i get the message Incompatible type for arg no. 3: Got IMyIntf, expected IUnknown. Is there a way to set a CORBA interface property through RTTI? Luiz program bugIntfRTTI; {$mode objfpc}{$H+} {$Define USE_CORBA} uses Classes, typinfo; type {$ifdef USE_CORBA} {$INTERFACES CORBA} {$endif} IMyIntf = interface procedure DoIt; end; {$ifdef USE_CORBA} TMyIntfImpl = class(TObject, IMyIntf) procedure DoIt; end; {$else} TMyIntfImpl = class(TInterfacedObject, IMyIntf) procedure DoIt; end; {$endif} TMyObj = class(TComponent) private FIntf: IMyIntf; procedure SetIntf(const Value: IMyIntf); published property Intf: IMyIntf read FIntf write SetIntf; end; procedure TMyObj.SetIntf(const Value: IMyIntf); begin FIntf := Value; WriteLn('SetIntf: ' + hexStr(FIntf)); end; procedure TMyIntfImpl.DoIt; begin WriteLn('DoIt - ', {$ifdef USE_CORBA}'CORBA'{$else}'COM'{$endif}); end; var Obj: TMyObj; Impl: IMyIntf; PropInfo: PPropInfo; begin Impl := TMyIntfImpl.Create; Obj := TMyObj.Create(nil); PropInfo := GetPropInfo(PTypeInfo(Obj.ClassInfo), 'Intf'); if PropInfo nil then begin WriteLn('PropInfo Found: ' + GetEnumName(TypeInfo(TTypeKind), Integer(PropInfo^.PropType^.Kind))); SetInterfaceProp(Obj, PropInfo, Impl); Obj.Intf.DoIt; end else WriteLn('PropInfo NOT Found'); Obj.Destroy; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpweb tutorial
Felipe Monteiro de Carvalho escreveu: Hello, Does anyone know where I can find documentation or a tutorial about fpweb? http://blog.silvioprog.com.br/2010/06/criando-um-aplicativo-cgi-com_27.html It's in portuguese Luiz Also, is the version included in FPC 2.4.0 very old and I should really use the FPC SVN code or can I use the units that come with FPC 2.4.0? I want to make a simple page which converts hexadecimal to a string. I found some, but they were really crappy. Plain CGI should be the prefered format, as apache modules are too much for this simple task. thanks, ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] methods of an object to create others objects
Marcos Douglas escreveu: Better: obj1 := nil; obj2 := nil; Try obj1 := TMyObject.Create; obj2 := TMyObject.Create; obj1.DoSomething1; obj2.DoSomething2; finally obj1.Free; obj2.Free; end; The objectcs are protected. But is boring... :) Everybody codify like that, afraid if resources are not available? An article from today: http://www.monien.net/blog/index.php/2010/07/creating-multiple-objects-using-try-finally/ Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FastCGI and FpWeb
I've created some CGI applications with fpWeb with success. I tried to create a FastCGI application (a simple hello world) but when a request is done the program start, Application.Initialize and Application.Run is called. TCustomWebApplication.HandleRequest (I've monitored OnGetModule) is not called. WebModule is not created. The application consumes all cpu. Using fpc 2.4.0, windows xp, apache 2.2.15, mod_fcgid 2.3.5 Any hints on what going wrong? It was there any fix in fastcgi/fpweb after 2.4.0? my apache fcgi specific configuration: ScriptAlias /fcgi-bin D:/work/fcgi-bin Directory D:/work/fcgi-bin SetHandler fcgid-script AllowOverride All Options Indexes FollowSymLinks ExecCGI Order allow,deny Allow from all /Directory Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FastCGI and FpWeb
Michael Van Canneyt escreveu: On Sat, 3 Jul 2010, Luiz Americo Pereira Camara wrote: I've created some CGI applications with fpWeb with success. I tried to create a FastCGI application (a simple hello world) but when a request is done the program start, Application.Initialize and Application.Run is called. TCustomWebApplication.HandleRequest (I've monitored OnGetModule) is not called. WebModule is not created. The application consumes all cpu. Using fpc 2.4.0, windows xp, apache 2.2.15, mod_fcgid 2.3.5 Any hints on what going wrong? It was there any fix in fastcgi/fpweb after 2.4.0? Many, but they are all in trunk, I don't know if any fixes have been merged. Maybe you can try to copy the fastcgi units over from trunk, and use those to compile your application. Compiled fastcgi plus fclweb from trunk. Unfortunately it also does not worked (Attached patch to compile with fpc240). Does anybody has experience using fpWeb with FastCGI? Luiz Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Index: src/base/custweb.pp === --- src/base/custweb.pp (revision 15519) +++ src/base/custweb.pp (working copy) @@ -89,8 +89,10 @@ FHandleGetOnPost : Boolean; FRedirectOnError : Boolean; FRedirectOnErrorURL : String; -FEventLog: TEventLog; +{$ifndef VER2_4} + FEventLog: TEventLog; function GetEventLog: TEventLog; + {$endif} protected Function GetModuleName(Arequest : TRequest) : string; function WaitForRequest(out ARequest : TRequest; out AResponse : TResponse) : boolean; virtual; abstract; @@ -110,7 +112,9 @@ Procedure ShowException(E: Exception);override; Procedure DoHandleRequest(ARequest : TRequest; AResponse : TResponse); Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); virtual; + {$ifndef VER2_4} Procedure Log(EventType: TEventType; Msg: String); override; + {$endif} Property HandleGetOnPost : Boolean Read FHandleGetOnPost Write FHandleGetOnPost; Property RedirectOnError : boolean Read FRedirectOnError Write FRedirectOnError; Property RedirectOnErrorURL : string Read FRedirectOnErrorURL Write FRedirectOnErrorURL; @@ -122,7 +126,9 @@ Property Email : String Read GetEmail Write FEmail; Property Administrator : String Read GetAdministrator Write FAdministrator; property OnShowRequestException: TOnShowRequestException read FOnShowRequestException write FOnShowRequestException; + {$ifndef VER2_4} Property EventLog: TEventLog read GetEventLog; + {$endif} end; EFPWebError = Class(Exception); @@ -282,10 +288,12 @@ end; end; +{$ifndef VER2_4} procedure TCustomWebApplication.Log(EventType: TEventType; Msg: String); begin EventLog.log(EventType,Msg); end; +{$endif} Procedure TCustomWebApplication.Initialize; @@ -294,12 +302,14 @@ Inherited; end; +{$ifndef VER2_4} function TCustomWebApplication.GetEventLog: TEventLog; begin if not assigned(FEventLog) then FEventLog := TEventLog.Create(self); Result := FEventLog; end; +{$endif} function TCustomWebApplication.GetApplicationURL(ARequest: TRequest): String; begin @@ -399,8 +409,9 @@ destructor TCustomWebApplication.Destroy; begin - if assigned(FEventLog) then -FEventLog.Free; + {$ifndef VER2_4} + FEventLog.Free; + {$endif} inherited Destroy; end; Index: src/base/fpcgi.pp === --- src/base/fpcgi.pp (revision 15519) +++ src/base/fpcgi.pp (working copy) @@ -38,7 +38,9 @@ begin Application:=TCGIApplication.Create(Nil); + {$ifndef VER2_4} CustomApplication:=Application; + {$endif} end; Procedure DoneCGI; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Mozilla XPCOM
Marcos Douglas escreveu: Hi Luiz, On Mon, Jun 7, 2010 at 10:35 PM, Luiz Americo Pereira Camara luiz...@oi.com.br wrote: Take a look at http://lazarusroad.blogspot.com/2008/11/effect-of-using-constant-parameter-for.html Then, this continue true how I said in other mail: On Mon, Jun 7, 2010 at 11:59 AM, Marcos Douglas m...@delfire.net wrote: Always use 'const' for 'strings' because this is faster. Strings will be passed by reference. And about not string types, is more faster too? eg: foo (const i: Integer) No. I did this test too. Double should also benefit but the generated assembler is equal with or without const. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Mozilla XPCOM
Marcos Douglas escreveu: Well... just to I will know. A long time ago (Delphi 4) I learned: Always use 'const' for 'strings' because this is faster. Strings will be passed by reference. This remains true? eg: var str: string; procedure Foo1(const s: string); procedure Foo2(s: string); Take a look at http://lazarusroad.blogspot.com/2008/11/effect-of-using-constant-parameter-for.html Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] VirtualTreeview Mac (Carbon)
CA Gorski escreveu: Lazarus/LCL has added most of the needed functions, but it's not released yet. I am using the daily snapshot anyway. Are they in there? Yes And if so, what is to do? Remove the dependencies on lclextensions from your port? Yes Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] VirtualTreeview Mac (Carbon)
CA Gorski escreveu: And if so, what is to do? Remove the dependencies on lclextensions from your port? Yes Ok, I will try... Meantime I tried to compile lclextensions against gtk2 What messages do you get when compile lclextensions for carbon? I ask that so i can add the missing function headers SearchPaths IncludeFiles Value=include/$(LCLWidgetType)// UnitOutputDirectory Value=lib/$(TargetCPU)-$(TargetOS)-$(LCLWidgetType)/ LCLWidgetType Value=gtk2/ /SearchPaths but the compiler still uses includes from include/carbon sub-folder. What message do you get? The config seems OK I think is a good idea to move to http://lists.lazarus.freepascal.org/mailman/listinfo or private mail Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] VirtualTreeview Mac (Carbon)
CA Gorski escreveu: Has anybody tried to compile the new VT port which requires lclextensions (Luipack) on Mac OS with target widget Carbon? It's a know issue. See http://forum.lazarus.freepascal.org/index.php/topic,8601.0.html I don't have a mac, so i need patches. I did and wasn't succesfull. Problem is, you can't compile lclextensions. Since I am pretty new to FPC my question is, is it the right way to generate a package (like lclextensions) which implements the missing Windows functions which are used by another package (here VirtualTreeview) for all widgets Yes. or should one change the later (VT) to use FCL/LCL functions so that it does not rely on Windows functions anymore? Later BTW: use lazarus mail list Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] VirtualTreeview Mac (Carbon)
CA Gorski escreveu: or should one change the later (VT) to use FCL/LCL functions so that it does not rely on Windows functions anymore? Later Why later and not immediately? It's a lot of work. It's easier to maintain sync with Delphi version Lazarus/LCL has added most of the needed functions, but it's not released yet. BTW: use lazarus mail list How to? http://lists.lazarus.freepascal.org/mailman/listinfo Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC + 64bit Windows = anybody?
Lukas Gradl escreveu: Thanks. BTW: are you using the latest DCPCrypt? Recently I applied a lot of 64-bit fixes for DCPCrypt - extensively tested under 64-bit Linux. Once I get a 64-bit Windows FPC going, I'll test on that platform too. Latest DCPCrypt is in Lazarus-CCR git repository at SourceForge. Or released version v2.0.4.1 in downloads section. Could'nt find a version number in my copy - but there is some Mr. Geldenhuys in the Changelog, so I think I've one of your versions. You can try http://donaldshimoda.blogspot.com/2010/02/dcpcrypt-for-64-bits-is-here.html Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] XML Iteration
Lee Jenkins escreveu: Frank Church wrote: I am having some problems with XPath. EvaluateXPathExpression raises exceptions with some search strings and I am not sure if it is my limited knowledge of XPath, or a buggy XPath implementation. The attached demo uses the example from http://www.w3schools.com/xpath/xpath_examples.asp and I am running 0.9.28.2 beta on Windows I'm trying to put together a simple test application for xpath now and I've noticed, there doesn't seem to be a way in fpc xml implementation to simply save to a string, an xml document or node. ReadXML() ReadXMLFile() All have no implementation to write a value to a string, only Text, Stream and File. I have to create an intermediary stream, save it to that and then convert that to string or use TStringStream in order to convert them to a string. Odd. Also the wiki page: http://wiki.freepascal.org/XML_Tutorial#Create_a_TXMLDocument_from_a_string May be this can help you: procedure Str2XmlFile(var XmlTree: TXMLDocument; const S: String); var Stream: TStringStream; begin Stream := TStringStream.Create(S); try ReadXmlFile(XmlTree, Stream); finally Stream.Destroy; end; end; Luiz Is incorrect. The example will error out because the string passed in is interpreted as a file path, not as a string representation of an xml document. -- Warm Regards, Lee ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] XML Iteration
Lee Jenkins escreveu: Luiz Americo Pereira Camara wrote: Frank Church escreveu: I am glad to see someone with an interest in FPCs XML. Do you have some experience with XPath usage in PFC/Lazarus? Luiz, In Unit1.pas: XPathResult := EvaluateXPathExpression('//Descricao', XmlTree.DocumentElement); if (XPathResult nil) then begin for i := 0 to XPathResult.AsNodeSet.Count - 1 do begin Node := TDOMNode(XPathResult.AsNodeSet[i]); if Node.FirstChild nil then Memo1.Lines.Add(UTF8Encode(Node.FirstChild.NodeValue)); end; XPathResult.Destroy; end; XmlTree.Free; Why the call to XPathResult.Destroy ? Is it for reference counting? Just seems something else to remember (use destroy instead of free)... No special reason. Free is redundant in this case since i already knows that XPathResult nil Luiz Thanks -- Warm Regards, Lee ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] XML Iteration
Frank Church escreveu: I am glad to see someone with an interest in FPCs XML. Do you have some experience with XPath usage in PFC/Lazarus? In this program: http://www.silvioprog.com.br/downloads/Cliente_SOAP_SAH.zip?attredirects=0d=1 you can find a simple usage of XPath + WST Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] XML Iteration
Frank Church escreveu: Thanks for the link. What is WST? My searches turn up something related to eclipse. Web Services Toolkit: http://wiki.lazarus.freepascal.org/Web_Service_Toolkit Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to convert ISO format string in FreePascal
Frank Church escreveu: I want to convert a time stamp in -mm-dd hh:mm:ss format to a TDatetime in FPC but can't find but haven't found a way yet. A very simple function i use: function XMLDateTime2DateTime(const XMLDateTime: String): TDateTime; var DateOnly: String; TPos: Integer; begin TPos := Pos('T', XMLDateTime); if TPos 0 then DateOnly := Copy(XMLDateTime, 1, TPos - 1) else DateOnly := XMLDateTime; Result := ScanDateTime('-mm-dd', DateOnly); end; Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Apple forbids fpc applications on iPhone
According to http://daringfireball.net/2010/04/iphone_agreement_bans_flash_compiler , in the new SDK programs compiled with fpc are not allowed anymore. A quote Applications must be originally written in Objective-C, C, C++ Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] CLX is returning to Delphi 2011
Marco van de Voort escreveu: In our previous episode, dmitry boyarintsev said: Does Embarcadero offer 2 different way of cross-platform development. Delphi Prism (XDelphi?) with its Mono .Net based development and Does Prism explicitely target Mono, or is it merely possible to DIY? Take a look at http://blogs.remobjects.com/blogs/sebastiang/2010/03/29/p1289 Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sql server embedded: sqlite the only solution?
JoshyFun escreveu: Hello FPC-Pascal, Tuesday, December 22, 2009, 12:55:07 AM, you wrote: ZD I think you talk about Firebird embedded version 1.0, SQlite3 best than it ZD I have Point of Sale application use Firebird 2.1 in desktop PC and ZD Sqlite3 in Wince, the same project with same SQL statements (with a ZD little directive for special queries). SQLite is faster than Firebird, but take care that SQLite does not enforce foreign keys, so data integrity must be handled by the programmer manually. Not anymore. See http://www.sqlite.org/releaselog/3_6_19.html Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] sql server embedded: sqlite the only solution?
Michael Van Canneyt escreveu: On Tue, 22 Dec 2009, JoshyFun wrote: SQLite is faster than Firebird, but take care that SQLite does not enforce foreign keys, so data integrity must be handled by the programmer manually. About the sqlite is faster: This depends highly on the kind of queries you are using. In my tests, sqlite was significantly slower than firebird. I compared speeds of 4 different embedded engines, and sqlite was definitely not the fastest one. Can you provide such tests? Sqlite, due to it's nature (small), is know to have a query optimizer less powerful than other (bigger) RDMS. Most of the time those sql can be manually optimized. Anyway recent versions have improved performance. Secondly, I would never recommend sqlite for use with Pascal applications, since sqlite does not even enforce the data to be of the correct type, which creates problems if a field of type INT contains e.g. textual data, causing a pascal application to crash. It's true if trying to load a data file created outside of the pascal application. Databases created and handled by TDataset descendants (Zeos, TSqlite3Dataset, Sqldb) has no such problems. (last time I checked, they called this a feature) One point not cited in thread was the availability of Firebird embedded that AFAIK is only for Windows. Not to say that sqlite is probably the most used embedded database: http://www.sqlite.org/mostdeployed.html Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Generate RTF file with UTF-8 encoded data
I need to create a RTF file from UTF-8 encoded strings. Does someone has an example on how to save UTF-8 strings in a RTF file? Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc and Sqlite UDF
Nataraj S Narayan escreveu: Hi Luiz Getting this:- /software/fpc-uclibc/lib/fpc/2.5.1/ppcrossarm -MObjFPC -TLinux -Parmv5 -gl -Xd -Xs -l -darm -XParm-linux-uclibcgnueabi- -CfSOFT -CaEABI -darm -gl -O- -CpARMV5 -uUSE_LOCALIZE -Fu/software/fpc-arm/units/arm-linux/ testfunction.pas Free Pascal Compiler version 2.5.1 [2009/10/23] for arm Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Linux for ARM Compiling testfunction.pas testfunction.pas(25,66) Error: Identifier not found sqlite3_value_int testfunction.pas(42,21) Error: Identifier not found sqlite3_result_int testfunction.pas(59,23) Error: Identifier not found sqlite3_result_int testfunction.pas(62,25) Error: Identifier not found sqlite3_result_int testfunction.pas(65,27) Error: Identifier not found sqlite3_result_int testfunction.pas(124) Fatal: There were 5 errors compiling module, stopping Fatal: Compilation aborted Any Sqlite version problem? On SQLite version 3.4.2 It's compiling here both with fpc224 and 251 but for win32. It seems a problem in the sqlite3 header for arm Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc and Sqlite UDF
Nataraj S Narayan escreveu: Hi Anybody has written custom UDF for Sqlite 3 using fpc? If so kindly help me with some hints to get started. See the attached files. It implements a custom format date function Luiz program testfunction; {$Mode ObjFpc} {$H+} {$define DEBUGHEAP} uses {$ifdef DEBUGHEAP} Heaptrc, {$endif} {$ifdef Linux} cmem, {$endif} sqlite3ds, sqlite3, sysutils, db, inifiles; procedure CustomFunction(context: PSqlite3_Context; argc: LongInt; argv: PPSqlite3_Value); cdecl; procedure DumpVariable(Index: Integer); begin case sqlite3_value_type(argv[Index]) of SQLITE_INTEGER: WriteLn('Type: SQLITE_INTEGER - Value: ', sqlite3_value_int(argv[Index]),' ' ,sqlite3_value_double(argv[Index])); SQLITE_NULL: WriteLn('Type: SQLITE_NULL - Value: NULL'); SQLITE_FLOAT: writeln('Type: SQLITE_FLOAT - Value: ', sqlite3_value_double(argv[Index])); SQLITE_TEXT: writeln('Type: SQLITE_TEXT - Value: ', sqlite3_value_text(argv[Index])); else WriteLn('Type: Unknown - Value: ', sqlite3_value_text(argv[Index])); end; end; var i: Integer; begin WriteLn('argc: ', argc); for i := 0 to argc - 1 do DumpVariable(i); sqlite3_result_int(context, 13); end; procedure StrFTime(context: PSqlite3_Context; argc: LongInt; argv: PPSqlite3_Value); cdecl; var Year, Month, Day: word; FormatStr: String; begin if (sqlite3_value_type(argv[1]) SQLITE_INTEGER) and (sqlite3_value_type(argv[1]) SQLITE_FLOAT) then begin sqlite3_result_null(context); Exit; end; FormatStr := UpperCase(sqlite3_value_text(argv[0])); DecodeDate(sqlite3_value_double(argv[1]), Year, Month, Day); if FormatStr = '%Y' then sqlite3_result_int(context, Year) else if FormatStr = '%M' then sqlite3_result_int(context, Month) else if FormatStr = '%D' then sqlite3_result_int(context, Day) else sqlite3_result_null(context); end; const SQLITEDS_TESTS_INI_FILE = 'sqlitedstests.ini'; DEFAULT_TABLENAME = 'tabletest'; DEFAULT_FILENAME = 'test.db'; var dsTest:TSqlite3Dataset; ini: TIniFile; begin {$ifdef DEBUGHEAP} SetHeapTraceOutput(ExtractFileName(ParamStr(0))+'.heap.log'); {$endif} dsTest := TSqlite3Dataset.Create(nil); with dsTest do begin //Load Database properties from a inifile ini := TIniFile.Create(SQLITEDS_TESTS_INI_FILE); FileName := ini.ReadString('testinfo', 'filename', DEFAULT_FILENAME); TableName := ini.ReadString('testinfo', 'tablename', DEFAULT_TABLENAME); ini.Destroy; if not TableExists then begin with FieldDefs do begin Clear; Add('Integer', ftAutoInc); Add('String', ftString); Add('DateTime', ftDateTime); Add('Date', ftDate); Add('Time', ftTime); end; CreateTable; end; writeln('ReturnString after CreateTable: ', ReturnString); Open; sqlite3_create_function(SqliteHandle, 'strftime', 2, sqlite_any, nil, @strftime, nil, nil); Append; FieldByName('DateTime').AsDateTime := Now; FieldByName('Date').AsDateTime := Date; FieldByName('Time').AsDateTime := Time; WriteLn('Date: ',FieldByName('Date').AsDateTime); WriteLn('Time: ',FieldByName('Time').AsDateTime); WriteLn('DateTime: ',FieldByName('DateTime').AsDateTime); Post; ApplyUpdates; WriteLn(QuickQuery('Select strftime(''%Y'',Date) as mydate from '+ tablename +' limit 1;')); WriteLn(QuickQuery('Select strftime(''%M'',Date) as mydate from '+ tablename +' limit 1;')); WriteLn(QuickQuery('Select strftime(''%D'',DateTime) as mydate from '+ tablename +' limit 1;')); Destroy; end; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Licencing software made in Free Pascal
wht244 escreveu: So, when I want to use libmysql.dll library - I have to make my application run on a GPL licence. Is that right? And what about sqlite3? Sqlite is public domain. Use as you want Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Status of fpc on Nokia n810
Jonas Maebe escreveu: http://www.google.com/search?q=nokia+n810hl=en - first hit: http://en.wikipedia.org/wiki/Nokia_N810 - The Nokia N810 features the Maemo Linux distribution Yes. Nokia n810 runs the Maemo platform on top of Linux OS. The maemo platform will be used in the Nokia flagship phones, replacing S60, starting with the upcoming N900 (http://www.mobile-review.com/review/nokia-rx51-n900-en.shtml). Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal