Re: [fpc-pascal] httpdefs.pp multipart/form-data
At the moment, it loads the whole content into a stream for processing line by line. It is possible to create a patch to not do processing (exception, error message, trigger an event handler, etc.) if the ContentLength exceeds a specified size. Leonardo M. Ramé wrote: Hi, I'm looking at httpdefs.pp file from FCL-Web and found that it handles multipart/form-data. I've been using a 3rd party parser for this kind of data, but it lacks of a good method of parsing large file uploads. My question is: ProcessMultipart method, handles the parsing in chunks of data, instead of loading the whole data into memory?. Thanks in advance, Leonardo. ___ 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] Apache Modules without LResources
Not sure about this error, but make sure you are using the latest SVN source code for FPC because recently there were multiple bug fixes done in fcl-web Giovanni Premuda wrote: Joost van der Sluis wrote: Op dinsdag 28-04-2009 om 02:58 uur [tijdzone +0200], schreef Giovanni Premuda: Is it possible to use fclweb without linking LResources and a lazarus resource file? One way is without using modules, select 'File-New-Custom CGI Program' from the lazarus-menu. This seems to produce a simple CGI app, not an apache module. Another way is using the 'normal' web-module, but remove it's resource-file. So you have to create all components at run-time. To do that you can simply remove the LResources from the uses-line, and remove the {$I unit1.lrs} line And this is the first thing I tried but the module fails miserably with error: - *Failed to initialize component: No streaming method available which makes me think the module is actually looking for a resource, especially as the module works when i include a stub webmodule resource. * ___ 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] Apache Modules without LResources
I think all those patches are now applied - with minor changes - by Joost in the latest SVN. Giovanni Premuda wrote: ABorka wrote: Not sure about this error, but make sure you are using the latest SVN source code for FPC because recently there were multiple bug fixes done in fcl-web I've using fpc 2.2.4 but I downloaded fcl-web from subversion and applied some of your unapplied patches I found on Mantis, which improve Delphi compatibility quite a bit. I believe this is more a problem of TDataModule, though. ___ 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
[fpc-pascal] Microsoft to ban Memcpy() :)
Funny... always these problems with C and bounds checkings http://www.theregister.co.uk/2009/05/15/microsoft_banishes_memcpy/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] INDY 10 for FPC
Well, if one checks out the latest Indy SVN sources from svn://svn.atozed.com/indy/indy10/trunk the latest revision is 3778 (last update was in April 2009) there is no way to compile it for FPC/Lazarus. The FPC related README file is the same as for the 2007 10.2.0.3 FPC only version and the steps are not working here because there are no such directories in the trunk. There are some Makefile.fpc in a few directories, but all of them lists 10.2.0.1 in them as a version (in \Lib\System\IdVers.inc it says 10.2.3). There is a \Lib\indymaster-Makefile.fpc but it gives " make -f indymaster-Makefile.fpc all indymaster-Makefile.fpc:1: *** missing separator. Stop. " In short I did not find a way to even compile the latest Indy source for FPC/Lazarus from their SVN. Maybe someone more knowledgeable could make a try at it and suggest some steps that work. As of now, only the old 2007 10.2.0.3 FPC only, non-merged Indy can be compiled for FPC/Lazarus AB Marco van de Voort wrote: In our previous episode, Henrik Genssen said: does someone know where to find a current indy port (or cvs / svn) for INDY10 for FPC / Lazarus? the link http://wiki.lazarus.freepascal.org/index.php/Indy_with_Lazarus points to a version 10.2.0.3 from 11/13/2007. or is this project dead? Yes and no. It is dead because it was succesful, and backmerged into mainline Indy. However Indy merged a big branch (for Tiburon support) back into the mainbranch, so that could have upset minor things, like the Lazarus project files etc. So the rough core is working, but the "polishing" hasn't been redone recently. ___ 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] INDY 10 for FPC
Forgot to mention that I did try that too with not much change in the results: >fpcmake indymaster-Makefile.fpc Processing indymaster-Makefile.fpc i386-win32 requires: rtl,winunits-base,winunits-jedi,fcl-base Writing Makefile >make all make.EXE: *** No rule to make target `indysystemfpc.ppu', needed by `fpc_units'. Stop. Jonas Maebe wrote: On 03 Sep 2009, at 01:19, ABorka wrote: There is a \Lib\indymaster-Makefile.fpc but it gives " make -f indymaster-Makefile.fpc all indymaster-Makefile.fpc:1: *** missing separator. Stop. " Normally, a Makefile.fpc has to be processed first using fpcmake in order to generate an actual Makefile file from it. Try using indymaster-Makefile instead if that file also exists. Jonas ___ 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] INDY 10 for FPC
Thanks, I'll try the Tiburon SVN version of Indy then, but if it doesn't work on both Windows and Linux it'll be not much use for me until it is does. Henrik Genssen wrote: you have to checkout the Tiburon branch - thats what they are working on! svn://svn.atozed.com/indy/indy10/branches/Tiburon but do not expect too much! it only works on windows as they are reinventing the wheel on iconv support so far it does not work at least on MACOSX -- Hinnack reply to message: date: 03.09.2009 01:19:39 from: "ABorka" to: "FPC-Pascal users discussions" subject: Re: [fpc-pascal] INDY 10 for FPC Well, if one checks out the latest Indy SVN sources from svn://svn.atozed.com/indy/indy10/trunk the latest revision is 3778 (last update was in April 2009) there is no way to compile it for FPC/Lazarus. The FPC related README file is the same as for the 2007 10.2.0.3 FPC only version and the steps are not working here because there are no such directories in the trunk. There are some Makefile.fpc in a few directories, but all of them lists 10.2.0.1 in them as a version (in \Lib\System\IdVers.inc it says 10.2.3). There is a \Lib\indymaster-Makefile.fpc but it gives " make -f indymaster-Makefile.fpc all indymaster-Makefile.fpc:1: *** missing separator. Stop. " In short I did not find a way to even compile the latest Indy source for FPC/Lazarus from their SVN. Maybe someone more knowledgeable could make a try at it and suggest some steps that work. As of now, only the old 2007 10.2.0.3 FPC only, non-merged Indy can be compiled for FPC/Lazarus AB Marco van de Voort wrote: In our previous episode, Henrik Genssen said: does someone know where to find a current indy port (or cvs / svn) for INDY10 for FPC / Lazarus? the link http://wiki.lazarus.freepascal.org/index.php/Indy_with_Lazarus points to a version 10.2.0.3 from 11/13/2007. or is this project dead? Yes and no. It is dead because it was succesful, and backmerged into mainline Indy. However Indy merged a big branch (for Tiburon support) back into the mainbranch, so that could have upset minor things, like the Lazarus project files etc. So the rough core is working, but the "polishing" hasn't been redone recently. ___ 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 ___ 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] linker apache linux
This usually comes when you compiled your Apache module with the wrong version of httpdXX directory from fpc/packages/. There are 3 included in fpc: httpd13 httpd20 and httpd22 Delete the two that are not your Apache version and recompile your module (or in Lazarus -> Project -> Compiler Options -> Other unit files enter the path to the right httpdXX directory from fpc/packages/). Alexey Voytsehovich wrote: Hello Jonas, Thursday, October 8, 2009, 1:54:20 PM, you wrote: help again please? Try ld 2.18.50 And also use FPC 2.2.4, not 2.2.2. ok on fpc 2.2.4 and binutil 2.9.91 sources cimpiled and linked but if i load module in apache (on ubuntu) i get this error -- can`t locate API module structure 'test_module' in file .. -- but this module worked in windows xp :( Show you what is necessary to pay attention? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] strtodate on linux
I had a problem like this before. If memory serves right, I had to set all four of these for StrToDate to work under Linux after moving some code from Windows: LongTimeFormat := 'hh:mm:ss'; ShortDateFormat := '/MM/DD'; DateSeparator := '/'; TimeSeparator := ':'; AB On 5/20/2010 19:19, Vannus wrote: I've used strtodate to convert 01/02/2010 on windows ok, but it fails with 'Invalid date format' on linux. anyone got any ideas why this happens? - V ___ 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] CGI file upload
On 5/23/2010 08:57, Vannus wrote: How do you get cgi uploads to work?? Im using TModuledCGIApplication procedure TCGIDatamodule1.DataModuleCGIRequest(Sender: TObject); begin // upload handling writeln('filenamevar: '+application.requestvariables['file']+''); // works when get but post is just blank writeln('filenamefile: '+application.UploadedFileName('file')+''); // doesn't work with get or post, just comes out blank // upload html writeln(''); writeln('Upload File: '); writeln(''); end; TIA - V There is an example project (CGI and Apache mod) in Lazarus under /components/fpweb/demo/fptemplate/fileupload/ you can use. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
On 5/24/2010 09:02, Leonardo M. Ramé wrote: Aldo, I know it has templates, the problem I'm facing now is in Windows Seven 64bits, It can't read environment/GET/POST vars, so the GetVar function doesn't return anything. That's why I had to look elsewere. Leonardo M. Ramé http://leonardorame.blogspot.com Is this a reported problem? Can you create a bug report on this if it is a reproduceable error? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits
On 5/24/2010 09:52, Leonardo M. Ramé wrote: -- On Mon, 5/24/10, ABorka wrote: From: ABorka Subject: Re: [fpc-pascal] Powtils Apache and Windows Seven 64bits To: "FPC-Pascal users discussions" Date: Monday, May 24, 2010, 1:48 PM On 5/24/2010 09:02, Leonardo M. Ramé wrote: Aldo, I know it has templates, the problem I'm facing now is in Windows Seven 64bits, It can't read environment/GET/POST vars, so the GetVar function doesn't return anything. That's why I had to look elsewere. Leonardo M. Ramé http://leonardorame.blogspot.com Is this a reported problem? Can you create a bug report on this if it is a reproduceable error? This is the problem with POWTILS. For fpWeb, this is what I posted in Lazarus mailing list: I created a basic example called 'cgiproject1' consisting of only an TFPWebModule's OnRequest method like this, with no action: procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin AResponse.Content := 'Hello'; Handled := True; end; Without environment vars, the result is this: exception at 00010003B5DC: No REQUEST_METHOD passed from server. If I set the environment var REQUEST_METHOD using "set REQUEST_METHOD=POST", or "GET", the result is this: An unhandled exception occurred at $00010001FC05 : EWriteError : Stream write error $00010001FC05 $000100034C77 $000100037D54 $000100033DCA $000115DE main, line 13 of giproject1.lpr It doesn't matter if I set QUERY_STRING and PATH_INFO, the result is the same. Leonardo M. Ramé I am not sure what the exception problem might be, but you cannot just do a SET command in a command prompt for CGI programs. For CGI programs you need to pass global environment variables with Apache, it is not automatic. For example, in the Apache httpd.conf with a "PassEnv TEMP" or "SetEnv TEMP /pathtotmpdir" line so the web server passes this global environment variable to the CGI programs' local environment variables. Only these "manually" passed ones and the ones Apache sends (the CGI environment variables that are in the CGI standard) are visible from within CGI programs. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpweb tutorial
/lazarus/components/fpweb/demo/fptemplate/*.* has examples of how to use templates and template tags. On 7/13/2010 07:47, Felipe Monteiro de Carvalho wrote: Hello, Thanks, with this blog I seam to be going somewhere and it worked ok with fpc 2.4.0 and the weblaz.lpk package. One thing still: Is there support for templates? I am doing something like this to load my page: procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin AResponse.ContentType := 'text/html;charset=utf-8'; AResponse.Contents.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'mainpage.html'); Handled := True; end; Something like powutils templates would be extremely handy ... all that html mixed with pascal doesn't look very nice. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpweb tutorial
I've added some words on templates that points to the readme files and the example projects now coming with Lazarus demonstrating the usage of templates. AB On 7/16/2010 00:35, Michael Van Canneyt wrote: On Fri, 16 Jul 2010, Felipe Monteiro de Carvalho wrote: I added a small introduction here: http://wiki.lazarus.freepascal.org/fcl-web Having said that, I think that fpWeb worked quite well for my very simple web page and all kinds of web applications could be developed with it. Great work. I have expanded the page with some explanations on multiple modules and actions. Some things that need more work: - Templates - Content producers - Difference between HTML Web module and regular web module Michael. ___ 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
[fpc-pascal] fcl-web webdata example(s) on Windows has some problems
Hi, WinXP 32, FPC and Lazarus latest SVN checkout. I was trying to play a little bit with the promising new fcl-web webdata features to see how JSON/EXTJS works with FPC/Lazarus and came up with the following problems in the first demo example ...fpcdir...\packages\fcl-web\examples\webdata\demo\ 1. The project source files in there contains a line something like: {$IFDEF WINDOWS}{$R somethinghere.rc}{$ENDIF} This gives an error message during compile in Lazarus that the .rc file is not found. When commented out, they compile OK. 2. When loading the extgrid-json.html into my browser, the grid comes up, but only says "No data to display" and the data.xml debug file contains "{ "success" : false, "message" : "Unknown web data input adaptor name: \"\"" }" (the CGI program has access to the users.dbf file, in fact this dbf file is regenerated every time the html page is loaded) 3. When loading the extgrid-xml.html , there is a popup error message with the same 'Unknown web data input adaptor name: ""' message. The data.xml debug file has " false Unknown web data input adaptor name: "" " in it. I could not yet figure out what the problem is due to limited time at the moment (2:00AM), any suggestions would be welcomed to find the solution/fix. Thanks, AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web webdata example(s) on Windows has some problems
WinXP 32, FPC and Lazarus latest SVN checkout. I was trying to play a little bit with the promising new fcl-web webdata features to see how JSON/EXTJS works with FPC/Lazarus and came up with the following problems in the first demo example ...fpcdir...\packages\fcl-web\examples\webdata\demo\ . .snip . I could not yet figure out what the problem is due to limited time at the moment (2:00AM), any suggestions would be welcomed to find the solution/fix. I have fixed the example. Revision 15817. Michael. Hi Michael, Thanks for the fix. I really look forward to use these new features. I was testing a little further and here are the current results. (Sorry if this is a little bit lengthy, but I would really like to see this through and have super demo programs for both Linux/Windows people. Also, to learn how to use these new Lazarus/FPC features, of course.) If I can help with some simple works to get this done - other than these testings - , please let me know how. a; fcl-web, fpweb general 1. It would be really nice to have the fpweb action names generated properly (like Delphi) in Lazarus ( http://bugs.freepascal.org/view.php?id=15820 ) 2. The other demo apps (demo2...demo6) also have the .rc file line in the project .lpr source 3. Demos.txt in the ...examples\webdata\ folder mentions Demo1, but the directories go as Demo, Demo2, Demo3 ... 4. The other fpweb dependent demos (ex: fptemplate) were moved into the \lazarus\components\fpweb\demo\ directory from the fpc\packages\fcl-web. Shouldn't we have these demo programs in one place only? 5. Packages "weblaz" and "lazwebextra" in Lazarus (under fpweb directory) should have somewhat similar name and definitely some description. In the Lazarus fpweb directory the file names and package names need to be organized a little bit. I know this is vague... b; demo (...\examples\webdata\demo) 1. Delete button should maybe have a confirmation dialog and to not have to click on Save after clicking on Delete to actually delete a record. 2. minor, nice to have: Maybe autosave after leaving any cell after editing? Bigot Excel/OpenOffice using customers will expect it to work like that. I know this is just a simple demo... 3. Maybe note for Windows people that they probably need to put the CGI program into their cgi-bin directory after compilation, and copy the .dbf file next to it. Then they need to modify the extgrid*.js files and change the extgrid.cgi to something like "http://127.0.0.1:8080/cgi-bin/extgrid.cgi"; or similar (it works with .cgi on Windows with Apache, there is no need to have the .exe extension). Also, to put the .html and .js files into their DocumentRoot directory under folder "demo" or something. Also, to unzip the downloaded extjs zip file into their DocumentRoot (and there will be an ignorable problem in the docs folder somewhere during unzipping, because it seems extjs uses menu.html and Menu.html files in the same directory in one place /v3.2.1/, which Windows does not support). 4. The JSON html is working now, but the xml one doesn't list anything in the grid. This might be that I did something wrong, will check demo2 and try both there. c; demo2 - demo6 1. "The following package failed to load: lazwebdata" (there are a lazwebdata.pas and reglazwebdata.pp files in the demo directory, so that might be something to use somehow) 2. minor, nice to have: Would be nicer to use different project names than extgrid (extgrid.cgi) for people who only use the cgi-bin directory to put CGI programs on their web server installation and do not overwrite the other demo project CGI programs. Thanks for your time, and nice work guys on this! I'll test and learn further. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web webdata example(s) on Windows has some problems
...snip... c; demo2 - demo6 1. "The following package failed to load: lazwebdata" (there are a lazwebdata.pas and reglazwebdata.pp files in the demo directory, so that might be something to use somehow) No, this is the old package name before it was renamed to lazwebextra. I will check this. It seems this is just in the .lpi file, when removed in Lazarus from the project as dependency and removed the .rc line from the project source, then demo2 compiles OK. However, demo2 does not want to display anything in the grid despite writing out the response into a debug file the data seems to be OK. Not only that, the add/save buttons are working because adding a new record and saving, then refreshing the grid the debug file shows the new record. It just doesn't display anything in the grid here. This is interesting because there are virtually no differences between demo and demo2 .html and .js files. ROUND 2 a; demo 1. xml is working for the first demo, there was no problem, maybe a reboot helped or something. b; demo, demo1...demo6 1. minor: In the *.js files iconCls are used a few times, however, there are no 'icon-add', 'icon-delete' and 'icon-save' css parts included (and those are not included in the extjs release either) so background images are not shown for the toolbar buttons. ex. somewhere there should be a .icon-add { background:url(/images/add.gif) 0 no-repeat !important; } etc. or similar defined to see button images (of course the gifs are also needed) c; demo6 1. in extgrid.ini is that a real user name and password ;) I will play further and try to figure out why the grid in demo2 doesn't show anything despite the data replied seems OK both with JSON and XML. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web webdata example(s) on Windows has some problems
...snip... 4. The JSON html is working now, but the xml one doesn't list anything in the grid. This might be that I did something wrong, will check demo2 and try both there. c; demo2 - demo6 1. "The following package failed to load: lazwebdata" (there are a lazwebdata.pas and reglazwebdata.pp files in the demo directory, so that might be something to use somehow) No, this is the old package name before it was renamed to lazwebextra. I will check this. Also, for demo...demo6 In the *xml.js files the 4th API cgi line has an extra comma at the end, this is one reason the xml ones didn't work I think (the last line doesn't need comma at the end in the lists) AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Apple development tools
On 9/9/2010 06:45, Jonas Maebe wrote: On 09 Sep 2010, at 15:31, Mark Morgan Lloyd wrote: I've just had my attention drawn to this elsewhere, and thought it would be of general interest. "In particular, we are relaxing all restrictions on the development tools used to create iOS apps, as long as the resulting apps do not download any code. This should give developers the flexibility they want, while preserving the security we need. Perfect! FPC-compiled apps are once again allowed by the new SDK agreement: *** 3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. 3.3.2 An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. The only exception to the foregoing is scripts and code downloaded and run by Apple's built-in WebKit framework. *** There's no reference anymore to only using particular languages. Interestingly, just yesterday I received a reply to the feedback I sent to Apple (in April) about how their new SDK agreement locked out FPC-compiled apps. The reply read: "Developers should be testing and developing their apps in line with the iOS Developer Program License Agreement. Should you have any questions or concerns, we request that you review the iOS Developer Program License Agreement details with your own legal counsel. You may view a copy of the latest agreement via the Member Center - Your Account area: " I didn't bother to actually check whether there was a new agreement (I figured it was just a boiler plate for "go away"), but given this development it does seem that it was grouped with all other objections to that change... Jonas This is good news. Are there any plans for releasing the latest and greatest FPC system for iPhone dev? AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: setting variables with DWARF in gdb
On 10/30/2010 04:07, Graeme Geldenhuys wrote: On 30 October 2010 11:26, Jonas Maebe wrote: Reverse execution is a new feature that was added to gdb 7.0, although you probably want to use 7.2 for the extra bug fixes. The supported targets are listed at http://www.gnu.org/software/gdb/news/reversible.html (nobody has added support for Windows yet) and the instructions on how to use it are on the wiki page linked from that page. That's not exactly what I meant. I remember back in Delphi 7 (maybe even as far back as D5), that I changed the execution point, so it can re-execute a procedure but with different values - no need to recompile or restart the application. . .snip . This was there back in Delphi 5 already. All you needed to do is to switch to CPU view, and "Set new CS:IP" and you could re-execute that part of the code. It is one of the things I really really miss (it saved hours of wasted time when debugging of the handling of different conditions in the code) Not to mention to see every variable and object property value I want, without a doctorate in GDB and Lazarus internals. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpWeb and html and uri escaping/unescaping elements
Hello, Does fpWeb have any method/function that escape and un-escape html and URI elements ? Thanks, Ido There are Function HTTPDecode(const AStr: String): String; Function HTTPEncode(const AStr: String): String; in unit httpdefs.pp of fcl-web. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Apache module with fpc 2.4.x on Apache 2.2.x (64bit)
On 5/26/2011 13:36, Takashi Ishikawa wrote: Hello, all I'm writing apache module with fpc. When I compile my program on fpc 2.4.4, Apache terminate immediately. But on fpc 2.2.4, Apache and my module will work fine. Code is compiled with no problem. Apache can load module. But the running has problem. Is there anyone who running a module compiled with fpc 2.4.x on Apache? I tested some envirment: - OS: CentOS 5.5 / Fedora 12 - Apache: 2.2.3 / 2.2.17 - Arch: x86_64 - FPC: 2.2.4 / 2.4.2 / 2.4.4 Test code: - library lib_mod_simple; {$ifdef fpc} {$mode objfpc}{$H+} {$endif} uses SysUtils, httpd, apr; var mod_simple: module; public name 'mod_simple'; exports mod_simple name 'mod_simple'; function DefaultHandler(r: Prequest_rec): Integer; cdecl; begin Result := DECLINED; end; procedure RegisterHooks(p: Papr_pool_t); cdecl; begin ap_hook_handler(@DefaultHandler, nil, nil, APR_HOOK_MIDDLE); end; begin FillChar(mod_simple, SizeOf(mod_simple), 0); STANDARD20_MODULE_STUFF(mod_simple); with mod_simple do begin name := 'mod_simple.so'; register_hooks := @RegisterHooks; end; end. - Compilation options: - fpc -Xs -XX -fPIC -dFPCAPACHE_2_2 -omod_simple.so mod_simple.pas - LoadModule in httpd.conf: - LoadModule mod_simple modules/mod_simple.so - Test#1 with CentOS 5.5, Apache 2.2.3, FPC 2.2.4 - # gdb httpd (gdb) r -X Starting program: /usr/sbin/httpd -X [Thread debugging using libthread_db enabled] Detaching after fork from child process 28066. Detaching after fork from child process 28080. - Test#2 with CentOS 5.5, Apache 2.2.3, FPC 2.4.4 - # gdb httpd (gdb) r -X Starting program: /usr/sbin/httpd -X [Thread debugging using libthread_db enabled] Detaching after fork from child process 28119. Program exited normally. (gdb) - Test with CentOS 5.5, Apache 2.2.3, FPC 2.4.2 Test with CentOS 5.5, Apache 2.2.3, FPC 2.4.4 Test with Fedora 12, Apache 2.2.17, FPC 2.4.4 same as Test#2 In test#1, it seemed to be success. When I access the webserver with browser, apache respond normal page. In test#2, apache shows no error. But process terminate. And when I accessed the webserver, apache didn't respond. It is possible to develop by using FPC 2.2.4. However, the future, I want to compile with a newer version of FPC. Is there any idea to running module with FPC 2.4.x? Thanks, Takashi There were problems with apache modules that were fixed in the latest FPC SVN (bug report 19184). If you do not want to use the SVN versions of FPC/Lazarus, you can just download the latest packages/fcl-web/src/base/ files from SVN into your project directory and recompile your project. Also, make sure you compile with the httpd22 directory and that FPC/Lazarus is not accidentally uses httpd13 or httpd20 . The best if you just delete these two directories from your fpc units directory. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Apache module with fpc 2.4.x on Apache 2.2.x (64bit)
.. >The error that exists in the ticket is not displayed. Seemingly, start > of httpd seems to success. However, the process terminate immediately. > > Is there another possible cause? > > Takashi If you compile with the proper HTTPD directory (httpd22 in this case), it should work. No error message in the apache error.log? Apache always says something when the startup is not successful. Your small example library code is working here (Ubuntu 10.10, FPC 2.5.1 SVN), httpd13 and httpd20 directories are deleted. Compiled with: fpc -Xs -XX -fPIC -omod_simple.so mod_simple.pas Apache starts, runs, pages are served properly with the mod_simple.so loaded . AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Freepascal templating engines with logical structures
You do not need to use javascript. There are examples for fpTemplate on how to do this. See .../packages/fcl-base/texts/fptemplate.txt for details. Examples are in .../packages/fcl-web/examples/fptemplate/... All your logic (loop) can be in your fpc source code for grids. What you seem to want is something php-like, to interpret commands from the html template. But that way the program logic and display template would not be separate. AB On 9/16/2014 21:51, luciano de souza wrote: Hello all, I Know two templating engines for Freepascal: FPTemplate e JTemplate. Both can be successfully used for html construction. But they presents the same aspect: only searches and replaces tags to values. Of course, it's crucial. But to show html grids, obtained from database queries, it would be better if the templating engine had support for logical structures. Something like: <% for row in rows do begin write(''); for cell in cells do writeln('%s', [cell]); write(''); end; %> It's only an example. The engine can use a syntax different from Pascal. But what I really like is not to use Javascript. Yes, in the Pascal side, I could write a JSON and certainly, there would be several Javascript libraries to show a grid from a JSON. However, I would like a pure Pascal solution. Are there templating engines in Pascal with support for logical structures? Regards, ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fptemplate example wrong?
The OnGetParam and OnReplaceTag are two totally different ways to handle templates. The former is the original version found in FPC packages, the latter is the newer, more Delphi-like - although enhanced - way to do templates. The two are mutually exclusive and controlled by the AllowTagParams flag (false -> old way, true -> new way). The fptemplate.txt file under the FPC sources, .../packages/fcl-base/texts/fptemplate.txt might help a little. All the examples should work, BTW, with the new way, under .../packages/fcl-web/examples/fptemplate/... AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web: retrieve URI given TFPWebModule and TFPWebAction instances
ARequest.URI ? There are other properties that can be useful: ARequest.URL ARequest.Location ARequest.PathInfo ARequest.PathTranslated ARequest.ScriptName ARequest.Query On 5/1/2015 07:29, leledumbo wrote: Is there any easy way to retrieve URI given TFPWebModule and TFPWebAction instances? for instance: ... RegisterHTTPModule('m',TAModule); ... from inside an action's request handler: procedure Tm.XXXRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin AResponse.Content := GetURI(Self,Actions.CurrentAction); // will be '/m/xxx' end; -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/fcl-web-retrieve-URI-given-TFPWebModule-and-TFPWebAction-instances-tp5721650.html Sent from the Free Pascal - General mailing list archive at Nabble.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] fcl-web: retrieve URI given TFPWebModule and TFPWebAction instances
Forgot to mention that there is a global Request property which is the same. So Request.URI ... AB On 5/1/2015 08:59, ABorka wrote: ARequest.URI ? There are other properties that can be useful: ARequest.URL ARequest.Location ARequest.PathInfo ARequest.PathTranslated ARequest.ScriptName ARequest.Query On 5/1/2015 07:29, leledumbo wrote: Is there any easy way to retrieve URI given TFPWebModule and TFPWebAction instances? for instance: ... RegisterHTTPModule('m',TAModule); ... from inside an action's request handler: procedure Tm.XXXRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin AResponse.Content := GetURI(Self,Actions.CurrentAction); // will be '/m/xxx' end; -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/fcl-web-retrieve-URI-given-TFPWebModule-and-TFPWebAction-instances-tp5721650.html Sent from the Free Pascal - General mailing list archive at Nabble.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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web: retrieve URI given TFPWebModule and TFPWebAction instances
I am not sure about the Embedded Webserver as I have never used it, but I remember vaguely about some kind of problem we have fixed regarding pathinfo with Apache 2.4 and the mod_proxi_fcgi a few years ago. There was a bug report, let me see if I can find it: ... http://bugs.freepascal.org/view.php?id=23387 In it you can see that with Apache 2.4 you have had to do some tricks in the conf file to even get the pathinfo passed from the web server (in the bug report "Steps To Reproduce" section): #No PATH_INFO with mod_proxy_fcgi unless this is set SetEnvIf Request_URI . proxy-fcgi-pathinfo=1 See also the "Additional Information" section for detailed Apache doc on the issue. So, it is possible, that for the URI we can have the same kind of issue. I am not using the URI parameter myself in my projects - might be because it was never set - it seems the others were sufficient or the URI can be rebuilt from the remaining ones. Michael can probably shed some more light on this issue. AB On 5/1/2015 20:59, leledumbo wrote: ARequest.URI ? Forgot to mention that there is a global Request property which is the same. So Request.URI ... It's empty in CGI/FastCGI/Embedded Webserver. Did I just find another bug? This is the result of dumping [A]Request properties: [CGI, URL = http://localhost/test.fpw/m/helloget] ScriptName /test.fpw PathInfo/m/helloget URI ReturnedPathInfom LocalPathPrefix ../../ CommandLine Command QueryString HeaderLine [FastCGI, URL = http://fpfcgi.local/m/helloget] ScriptName fpfcgi.local PathInfo/m/helloget URI ReturnedPathInfom LocalPathPrefix ../../ CommandLine Command QueryString HeaderLine [Embedded Webserver, URL = http://localhost:2015/m/helloget] PathInfom/helloget URI ReturnedPathInfom LocalPathPrefix ../ CommandLine Command QueryString HeaderLine HTTP/1.1 -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/fcl-web-retrieve-URI-given-TFPWebModule-and-TFPWebAction-instances-tp5721650p5721656.html Sent from the Free Pascal - General mailing list archive at Nabble.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] 3-tier database applications with FPC
On 10/19/2011 07:05, Leonardo M. Ramé wrote: > - Original Message - <...snip...> >>> I created a FastCGI based server that handles JSON requests from a >>> Win32/Linux GUI app, that uses a custom made ORM similar to tiOPF and it >>> works really fast, even on slow-long distance networks. I never had to do >>> this, but as most modern http servers support gzip compression, one >>> alternative to binary formats is to enable compression on server side, and >>> decompress on client side. >>> >>> This approach has the advantage of JSON readability and the small size of >> binary format. >> >> That's exactly what we do also. >> But in the case of large packages (we have datasets of 30.000 records), >> the JSON is really slow. >> >> The browser chokes already on a dataset of 3000 records, when using ExtJS =-) >> >> Michael. >> > In those cases, we use pagination. We allways ask for record 1-100, 101-200, and so on. > > Leonardo M. Ramé Exactly. Also, with ExtJS 4.0 they made a point of significantly speeding up most things. Usually, the problem with ExtJS 3.x is not with the slowness of JSON itself compared to binary communication, but with the thousands of DOM elements you need to create to display such a big set of data using javascript on client browser side. Of course, it is still a 4.0.x version at the moment, so I would wait until 4.1 at least before using it in a production environment. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Premature end of headers using fcl-web and POST
On 10/31/2011 08:56, Felipe Monteiro de Carvalho wrote: Ok, I figured part of it out. I can get past the exception if I use 2.5.1 And the action was necessary, which is really strange because it worked nicely without it when using GET But now my problem is that I cannot get my POST data. I tryed this so far: lData := ARequest.ContentFields.Text; but it is empty. Are you sure your form data is passed properly with POST? You should check the communication in your browser using FireBug or the debug tool in your browser if you use something other than FF (Opera, Chromium, Chrome has also built in debugger with pressing F12), and check if the query string parameters (module, action) as well as your POST fields (form data) are really passed the same way to the server with both GET and POST. The only difference should be the Request Method . I have a feeling that your form data does not come at all from the javascript caller for some reason. AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Premature end of headers using fcl-web and POST
On 10/31/2011 10:14, Felipe Monteiro de Carvalho wrote: There is no form and no form data here. I want to pass raw data via post. And yes, I checked that it is sent correctly. Then your Content-Type header is neither "MULTIPART/FORM-DATA" nor "APPLICATION/X-WWW-FORM-URLENCODED" when you use POST. It must be one of these two. http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] The best approaching for templating
On 11/9/2011 14:27, tcoq wrote: Dear Luciano. I would suggest using the StringReplace function (Sysutiles) in combination with a TStringList. Easy to do and quite powerful. You can also use a second string list to store the values and patterns to replace, using the Names and Values properties, so that you can do multiple successive replacements in your templates. The SaveToFile and LoadFromFile will give you easy storage of your templates. I tend to use patterns like [Name] or (First_Name] that are not confused with the html. Best regards, Thierry - Mail Original - De: "luciano de souza" À: fpc-pascal@lists.freepascal.org Envoyé: Lundi 7 Novembre 2011 14h37:46 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: [fpc-pascal] The best approaching for templating Hello listers, I would like to create some templates. Suppose the following example: %s %s %s %s I can certainly use format to link %s to the respective variables. However, if the number of %s is big, probabily, the reading would be less clearer. But, suppose I have $title in stead of %s and $p1 in stead of %s. In Lua, I have a module called Cosmo taht perform it. my question is: is there something similar in Pascal? Luciano There is a full template handling unit called fpTemplate included in FPC ( readme is found under FPC /packages/fcl-base/texts/fptemplate.txt ). There are also multiple web examples using templates found under FPC /packages/fcl-web/examples/fptemplate/ AB ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] SQL show tables
I think "execsql" never returns any records, you supposed to use "open" for queries returning results. Execsql is for insert, delete, update, etc. David B Copeland wrote: Hi, I am trying to pre-fill a TComboBox with the all the tables in a database, without sucess. I am running Suse 10.3, a recent (within a week) Lazarus 0.9.27 from svn, FPC 2.2.2, 64-bit. The program uses a ODBCConnection to a MySQL database. The code I tried is: FormMyDB.Query.SQL.Clear; FormMyDB.Query.SQL.Add ('show tables;'); try FormMyDB.Query.ExecSQL; if FormMyDB.Datasource.DataSet.EOF then ShowMessage ('There are no tables!'); // This gets displayed while not FormMyDB.Datasource.DataSet.EOF do begin CBTable.Items.Add (FormMyDB.Datasource.DataSet.FieldByName('Tables_in_TRACKER').AsString); FormMyDB.Datasource.DataSet.Next end; FormMyDB.Query.Close; except on e: exception do begin ShowMessage ('Error load table names: ' + e.message); exit; end end The ExecSQL appears to complete normally, but the result dataset is empty. What am I doing wrong? In other parts of the program I successfully both query and update various tables in the database. Any pointers in the right direction will be greatly appreciated. Dave Copeland. ___ 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