Re: [fpc-pascal] Using areq.getnextpathinfo in a CGI module

2011-11-01 Thread silvioprog
Please send your "main" unit (or your small project compacted in zip). 2011/11/1 Luciano de Souza : [..] -- Silvio Clécio === Blog - Twitter - Facebook - LazSolutions - Lazarus-BR - ===    * Conheça noss

[fpc-pascal] Using areq.getnextpathinfo in a CGI module

2011-11-01 Thread Luciano de Souza
Hello listers, I am trying to understand how to create some code using Custcgi. However, the following peace is not clear for me concerning to "getnextpathinfo". Let's see: program cgiproject1; {$mode objfpc}{$H+} uses HTTPDefs, custweb, custcgi, main; type { TMyCGIHandler } TMyCGI

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Florian Klämpfl
Am 01.11.2011 10:30, schrieb Juha Manninen: > WriteStr (S, N); > > > Thanks guys! > WriteStr() was the function I was looking for. > I found some places in Lazarus code where it is used but not > many. Martin's debugger code has some. > I think many lookup string arrays in Lazarus code could

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Jonas Maebe
On 01 Nov 2011, at 10:30, Juha Manninen wrote: >> WriteStr (S, N); >> > > Thanks guys! > WriteStr() was the function I was looking for. You can also use the plain str() procedure. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org h

Re: RE : RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Michael Van Canneyt
On Tue, 1 Nov 2011, Ludo Brands wrote: On Tue, Nov 1, 2011 at 9:04 AM, Ludo Brands wrote: Note the "per the HTML specs". HTTP specs aren't that strict. But what exaxtly do these specs ban? Because I am sending via XMLHttpRequest in JavaScript, and there you can specify any mime-type that y

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Vincent Snijders
2011/11/1 Juha Manninen : >>  WriteStr (S, N); > > Thanks guys! > WriteStr() was the function I was looking for. > I found some places in Lazarus code where it is used but not many. Martin's > debugger code has some. > I think many lookup string arrays in Lazarus code could be replaces > with Write

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Juha Manninen
> > WriteStr (S, N); > Thanks guys! WriteStr() was the function I was looking for. I found some places in Lazarus code where it is used but not many. Martin's debugger code has some. I think many lookup string arrays in Lazarus code could be replaces with WriteStr. It would reduce code size and i

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Felipe Monteiro de Carvalho
On Tue, Nov 1, 2011 at 8:39 AM, Felipe Monteiro de Carvalho wrote: >    begin >      SetLength(DataStr, M.Size); >      M.ReadBuffer(DataStr[1], M.Size); >      ContentFields.Text := DataStr; >    end; Actually this code is wrong, for it to be proper it would need to first check if the mime-type

RE : RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Ludo Brands
> On Tue, Nov 1, 2011 at 9:04 AM, Ludo Brands > wrote: > > Note the "per the HTML specs". HTTP specs aren't that strict. > > But what exaxtly do these specs ban? Because I am sending via > XMLHttpRequest in JavaScript, and there you can specify any > mime-type that you want. You can send any d

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Thomas Young
Hi, This is code I wrote for converting 1, 2 or 3 digit numbers to string. function NumtoString(N:integer):string; var c1, c2, c3: char; begin if (N<10) then NumtoString := chr(N+48) else if (N > 9) an

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Tomas Hajny
On Tue, November 1, 2011 08:41, Juha Manninen wrote: Hi, > I remember there is a way to get a string representation of an enumerated > type directly without using a lookup string array, but I forgot the > syntax. > Lazarus uses only lookup arrays, maybe because the other syntax is new. > > How i

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Yann Bat
You can directly write enums with Write or WriteLn and convert enums to strings with WriteStr. program EnumStr; {$mode objfpc}{$H+} type TColor = (cRed, cGreen, cBlue, cYellow); function ColorToStr(C: TColor) : String; begin WriteStr(Result, C); end; var Color : TColor; begin for Color

Re: RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Felipe Monteiro de Carvalho
On Tue, Nov 1, 2011 at 9:04 AM, Ludo Brands wrote: > Note the "per the HTML specs". HTTP specs aren't that strict. But what exaxtly do these specs ban? Because I am sending via XMLHttpRequest in JavaScript, and there you can specify any mime-type that you want. You can send any data and I haven't

RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Ludo Brands
> >> So it seems that you MUST set the contenttype either to > >> MULTIPART/FORM-DATA or APPLICATION/X-WWW-FORM-URLENCODED. > > > > Yes, this is as per the HTML specs. > > They actually prohibit sending arbitrary data? oh, boy, these > people like rules and inneficiency =D But there must be > s

Re: [fpc-pascal] EnumToString

2011-11-01 Thread Felipe Monteiro de Carvalho
One option is RTTI: http://wiki.lazarus.freepascal.org/Runtime_Type_Information_(RTTI)#Converting_a_enumerated_type_to_a_string -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailm

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Felipe Monteiro de Carvalho
Hello, Ok, it seams that I found a workaround. It works correctly if I use this: lData := ARequest.Content; instead of lData := ARequest.ContentFields.Text; It seams that the string is filled correctly, even if the TStringList isn't filled. I think this could be improved by adding this cod

[fpc-pascal] EnumToString

2011-11-01 Thread Juha Manninen
Hi I remember there is a way to get a string representation of an enumerated type directly without using a lookup string array, but I forgot the syntax. Lazarus uses only lookup arrays, maybe because the other syntax is new. How is the syntax? Juha ___