[fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
Hello, I am trying to send data from javascript and read data back from my cgi module with this: SendSyncRequest = function(RequestURL, RequestContent) { var request = new XMLHttpRequest(); request.open('GET', RequestURL, false); request.setRequestHeader('Content-Type',

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: Hello, I am trying to send data from javascript and read data back from my cgi module with this: SendSyncRequest = function(RequestURL, RequestContent) { var request = new XMLHttpRequest(); request.open('GET', RequestURL,

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 3:55 PM, Michael Van Canneyt mich...@freepascal.org wrote: As far as I know, this will always be empty, for the simple reason that the request is executed asynchronously. You must attach a callback which is executed once the request is ready, and read ResponseText after

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 3:55 PM, Michael Van Canneyt mich...@freepascal.org wrote: As far as I know, this will always be empty, for the simple reason that the request is executed asynchronously. You must attach a callback which is

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 4:01 PM, Michael Van Canneyt mich...@freepascal.org wrote: ? AFAIK xhttprequest is never synchronous... It is synchronous if the third parameter of open is set to false: http://www.w3.org/TR/XMLHttpRequest/#the-open-method client . open(method, url, async, user,

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 4:01 PM, Michael Van Canneyt mich...@freepascal.org wrote: ? AFAIK xhttprequest is never synchronous... It is synchronous if the third parameter of open is set to false:

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 4:11 PM, Michael Van Canneyt mich...@freepascal.org wrote: Ehm. I think that the problem is elsewhere. Content is only accepted with the POST method. Why? Is this a limitation from HTTP? If I change to POST then I can no longer select my module, neither ?module=MainPage

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 4:11 PM, Michael Van Canneyt mich...@freepascal.org wrote: Ehm. I think that the problem is elsewhere. Content is only accepted with the POST method. Why? Is this a limitation from HTTP? Yes. If I change

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Felipe Monteiro de Carvalho
On Mon, Oct 17, 2011 at 4:33 PM, Michael Van Canneyt mich...@freepascal.org wrote: Yes. I see ... simply encoding the data differently from what I originally wanted and feeding it to a GET field worked fine. You must specify an action. A single path component is treated as an action.

[fpc-pascal] fpweb and custom debug log

2011-10-17 Thread Felipe Monteiro de Carvalho
Hello, I see that when my CGI raises an exception we get a nice error message with a stack trace as a response. Is it possible to put some logging messages into this error response too? I know I can simply put logging info into log files in the server, but it looks like it would be handy to be

Re: [fpc-pascal] fpweb and reading the contents of a request

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: On Mon, Oct 17, 2011 at 4:33 PM, Michael Van Canneyt mich...@freepascal.org wrote: Yes. I see ... simply encoding the data differently from what I originally wanted and feeding it to a GET field worked fine. Also a solution :-)

Re: [fpc-pascal] fpweb and custom debug log

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote: Hello, I see that when my CGI raises an exception we get a nice error message with a stack trace as a response. Is it possible to put some logging messages into this error response too? With some custom coding, it should be possible,

[fpc-pascal] Reopen issue 20500: TSQLParser cant Parse Statements containing as

2011-10-17 Thread Reinier Olislagers
The issue reporter gave this example: select ORDERNO as OrderNo from ORDERS as Orders; It does parse AS, but only for a field. Michael Van Canneyt replied: TSQLParser implements SQL syntax as used in Firebird, and firebird does not allow AS for a tablename, just append the alias. The correct

Re: [fpc-pascal] Reopen issue 20500: TSQLParser cant Parse Statements containing as

2011-10-17 Thread Michael Van Canneyt
On Mon, 17 Oct 2011, Reinier Olislagers wrote: The issue reporter gave this example: select ORDERNO as OrderNo from ORDERS as Orders; It does parse AS, but only for a field. Michael Van Canneyt replied: TSQLParser implements SQL syntax as used in Firebird, and firebird does not allow AS for

[fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-17 Thread Andrew Pennebaker
Haskell lets you define functions like thrice, which accepts an element of type a and returns a list of the element repeated three times, for any data type a. thrice :: a - [a] thrice x = [x, x, x] I know the answer involves generics, but the docs don't offer examples using Free Pascal's

[fpc-pascal] Delphi's anonymous functions in Free Pascal

2011-10-17 Thread Andrew Pennebaker
Does Free Pascal have anonymous functions that you can pass around, e.g. to a sort(compare : function, arr : array) function? If not, does anyone know any hacks to accomplish this? Cheers, Andrew Pennebaker www.yellosoft.us ___ fpc-pascal maillist -

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-17 Thread Marco van de Voort
In our previous episode, Andrew Pennebaker said: thrice :: a - [a] thrice x = [x, x, x] I know the answer involves generics, but the docs don't offer examples using Free Pascal's built-in generic types. There is no built in list type, generic or not, and no way to define new operators. All

Re: [fpc-pascal] How can I implement thrice in Free Pascal?

2011-10-17 Thread Andrew Pennebaker
Can this be done with arrays? I didn't mean to be too specific; I'd be happy with any generic collection that could do this. Cheers, Andrew Pennebaker www.yellosoft.us On Mon, Oct 17, 2011 at 6:08 PM, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Andrew Pennebaker said:

[fpc-pascal] fpc has trouble with array types

2011-10-17 Thread Andrew Pennebaker
But, but, the docs imply that this is the syntax for a function that returns an array of bytes. fpc ios7crypt.pas ios7crypt.pas(3,25) Error: Type identifier expected ios7crypt.pas(3,25) Fatal: Syntax error, ; expected but ARRAY found Fatal: Compilation aborted $ cat ios7crypt.pas program

Re: [fpc-pascal] Reopen issue 20500: TSQLParser cant Parse Statements containing as

2011-10-17 Thread Reinier Olislagers
On 17-10-2011 20:57, Michael Van Canneyt wrote: Would it make sense to reopen this bug? ? Eh ? If indeed it is accepted, then yes please. Quite strange, because I implemented the SQL parser based on the official Firebird server docs. And it definitely was not allowed. But I'll test on

Re: [fpc-pascal] fpc has trouble with array types

2011-10-17 Thread Vincent Snijders
2011/10/18 Andrew Pennebaker andrew.penneba...@gmail.com: But, but, the docs imply that this is the syntax for a function that returns an array of bytes. Where in the docs did you read this? Vincent ___ fpc-pascal maillist -