Re: [fpc-pascal] fcl-web: retrieve URI given TFPWebModule and TFPWebAction instances

2015-05-02 Thread leledumbo
> But you'll have to be prepared that a module can be registered for
different URLs, 
> so the return is a TStringArray (or Strings). 

No problem, nested for is not that slow ;)



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fcl-web-retrieve-URI-given-TFPWebModule-and-TFPWebAction-instances-tp5721650p5721665.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


Re: [fpc-pascal] fcl-web: retrieve URI given TFPWebModule and TFPWebAction instances

2015-05-02 Thread Michael Van Canneyt



On Sat, 2 May 2015, leledumbo wrote:


It is on my todo list, yes.


I'll be waiting.

One more thing (which is actually why I ask my original question), how can I
get registered module name given the module instance or module class? i.e.
if I:

RegisterHTTPModule('m',TModule);

then

Something(TModule); or Something(Module);

shall return 'm'. ModuleFactory doesn't seem to provide such a
functionality. I want to create a listing of what actions are available for
the current module and I want to avoid repeating registered module name.


A good idea. I'll implement it. 
But you'll have to be prepared that a module can be registered for different URLs, 
so the return is a TStringArray (or Strings).


Michael.
___
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

2015-05-02 Thread leledumbo
> It is on my todo list, yes.

I'll be waiting.

One more thing (which is actually why I ask my original question), how can I
get registered module name given the module instance or module class? i.e.
if I:

RegisterHTTPModule('m',TModule);

then

Something(TModule); or Something(Module);

shall return 'm'. ModuleFactory doesn't seem to provide such a
functionality. I want to create a listing of what actions are available for
the current module and I want to avoid repeating registered module name.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fcl-web-retrieve-URI-given-TFPWebModule-and-TFPWebAction-instances-tp5721650p5721663.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


Re: [fpc-pascal] fcl-web: retrieve URI given TFPWebModule and TFPWebAction instances

2015-05-02 Thread Michael Van Canneyt



On Sat, 2 May 2015, leledumbo wrote:


 I have corrected this, they share the same field now. Rev 30760.


Thanks, Michael. It looks like you should start considering unit test for
fcl-web.


It is on my todo list, yes.

I have recently created a TTestRequestApp custapp descendent which can be used 
to test
requests based on some command-line options, and a testcase for testing web 
modules.
I just need to commit them.




PS. You can use the dumprequest routine in webutils to create a relatively
complete dump in HTML of the HTTP environment.


Noted.

Btw, PathInfo and PathTranslated in embedded webserver contains no leading
/, while the other app modes has. OTOH, HeaderLine is empty on other modes
but embedded webserver.


Headerline: That is normal, since headerline is not propagated from the 
webserver.

Pathinfo:

Strange. Probably a side effect of the fix for:

http://bugs.freepascal.org/view.php?id=26462

I will check this.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FreePascal and MySQL

2015-05-02 Thread Marco van de Voort
In our previous episode, Terry A. Haimann said:
> I was kind of unimpressed with the performance of TSqlQuery compared to
> c.  
> 
> I wrote two programs that built the same identical table.  A random set
> of names with addresses.  I found the user time of the program written
> in c was 20% of that which was written in Free Pascal.

Do not measure user time, measure the time within the program. C and Pascal
have differing library architectures, so that might obscure results.

The TSqlQuery is also fully runtime, the returned dataset is a runtime
typed concept. Did you setup your C code equivalent, e.g. by prompting for the
sql text?

Otherwise you are benchmarking runtime vs compiletime performance. Trying to
use the mysql api directly with compiletime typed result set parsing might
be faster from Pascal too.
___
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

2015-05-02 Thread leledumbo
>  I have corrected this, they share the same field now. Rev 30760.

Thanks, Michael. It looks like you should start considering unit test for
fcl-web.

> PS. You can use the dumprequest routine in webutils to create a relatively
> complete dump in HTML of the HTTP environment. 

Noted.

Btw, PathInfo and PathTranslated in embedded webserver contains no leading
/, while the other app modes has. OTOH, HeaderLine is empty on other modes
but embedded webserver.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fcl-web-retrieve-URI-given-TFPWebModule-and-TFPWebAction-instances-tp5721650p5721660.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


Re: [fpc-pascal] fcl-web: retrieve URI given TFPWebModule and TFPWebAction instances

2015-05-02 Thread Michael Van Canneyt



On Fri, 1 May 2015, ABorka wrote:

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.


There has been an extensive reworking of the HTTPDefs structures recently.

There are 2 properties URI and URL which were stored in different fields.
I had not noticed this, since I do not use the URI field (the URL field showed up 
properly in my tests) I have corrected this, they share the same field now.

Rev 30760.

Michael.

PS. You can use the dumprequest routine in webutils to create a relatively 
complete dump in HTML of the HTTP environment.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FreePascal and MySQL

2015-05-02 Thread Michael Van Canneyt



On Fri, 1 May 2015, Terry A. Haimann wrote:


I was kind of unimpressed with the performance of TSqlQuery compared to
c.


That is logical.

Beside the point raised by Jonas, 
if you use a library which is designed to be general and cross-db-engine, 
it will always be somewhat slower than code which is written specifically 
for one engine. You will most likely be using wholly different techniques.



I wrote two programs that built the same identical table.  A random set
of names with addresses.  I found the user time of the program written
in c was 20% of that which was written in Free Pascal.


Without details of the program, it is difficult to say what causes this.
The use of Random may be one cause. Transaction management may be another.
Who knows what else ?



Is there any chance of someone working on this library to improve
performance?


I doubt there is a lot you can do to improve performance, but you are welcome 
to try.

Specifically for MySQL, there is only one thing left to do: use parameter support 
for mysql version>=5.0,
which should significantly improve performance. Currently (since the same code is used for versions of mysql <5.0) 
the parameters are substituted in code in the SQL.


And, as suggested by Adriaan, try to use Postgres or Firebird, which are by far 
better databases.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal