Re: [fpc-pascal] CGI/FastCGI and WS request with a max time response

2018-01-04 Thread Marcos Douglas B. Santos
On Thu, Jan 4, 2018 at 10:33 PM, leledumbo via fpc-pascal
 wrote:
>> The problem is that the WS could take so long time that the entire request
> will broke with a "time out".
>
> I suggest making the request handling asynchronous instead. So request will
> only register and return some unique id to the requester, then do call to
> the WS in background thread. An endpoint shall be provided that when given a
> unique id will check whether the corresponding thread has finished executing
> or not, returning 200 + response data when done, and 202 if still in
> progress. This endpoint shall be called in regular interval by the
> requester, until it finishes processing or your server dies (500).

Interesting, but I can't do this way.
It should be just one call from client (desktop app and website) to my
REST service.
My service encapsulates the WS.
As I wrote previously to Michael, if the WS do not respond in "X
seconds", my service should forget it and return a "code Y".

Best,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] CGI/FastCGI and WS request with a max time response

2018-01-04 Thread Marcos Douglas B. Santos
On Thu, Jan 4, 2018 at 6:33 PM, Michael Van Canneyt
 wrote:
>
> If you use a thread to consume it, yes.
>
> Without more info on how you consume this webservice, it's difficult to
> answer this.

Yes, sorry. I should explained more.
I'm using WST -> http://svn.code.sf.net/p/lazarus-ccr/svn/wst (rev.
5836) to consume WS.
Until now, I didn't find how to set a timeout in WST objects — is this possible?
As you already said, I thought to use a thread, but I may need to
control this manually... ideas how to do this as simple as possible?

My requirement is: If WS do not respond in "X seconds", forget it and
return the "code Y".

Regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] CGI/FastCGI and WS request with a max time response

2018-01-04 Thread leledumbo via fpc-pascal
> The problem is that the WS could take so long time that the entire request
will broke with a "time out".

I suggest making the request handling asynchronous instead. So request will
only register and return some unique id to the requester, then do call to
the WS in background thread. An endpoint shall be provided that when given a
unique id will check whether the corresponding thread has finished executing
or not, returning 200 + response data when done, and 202 if still in
progress. This endpoint shall be called in regular interval by the
requester, until it finishes processing or your server dies (500).




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] CGI/FastCGI and WS request with a max time response

2018-01-04 Thread Michael Van Canneyt



On Thu, 4 Jan 2018, Marcos Douglas B. Santos wrote:


Hi,

I have a FastCGI application which needs to receive an user request but, in
some cases, the app should consume a WebService(WS) before make the
response to the user.
The problem is that the WS could take so long time that the entire request
will broke with a "time out".

My question is: Can I consume this WS with a max time to wait?


If you use a thread to consume it, yes.

Without more info on how you consume this webservice, it's difficult to
answer this.

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

Re: [fpc-pascal] Get user ID for name on Linux

2018-01-04 Thread Graeme Geldenhuys

On 2018-01-04 15:17, Marco van de Voort wrote:

FreeBSD is mostly supported,  though two units (shadow and crypth) and some 
calls
relating to shadow passwords in users are not.


Thanks for the information Marco. I'll take a look.

Regards,
  Graeme

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

[fpc-pascal] CGI/FastCGI and WS request with a max time response

2018-01-04 Thread Marcos Douglas B. Santos
Hi,

I have a FastCGI application which needs to receive an user request but, in
some cases, the app should consume a WebService(WS) before make the
response to the user.
The problem is that the WS could take so long time that the entire request
will broke with a "time out".

My question is: Can I consume this WS with a max time to wait?
Would be better doing this in the code instead of change parameters in the
webserver. But, if there is no (simple) way to do that in the code, the
webserver more used to this app is Microsoft IIS.

Best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Get user ID for name on Linux

2018-01-04 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> As Marco said, you can use the "users" unit. Here is an example of how I 
> use in in fpGUI, and it supports 32-bit and 64-bit systems.
> 
>  
> https://github.com/graemeg/fpGUI/blob/develop/src/corelib/x11/fpg_x11.pas#L4010-L4044
> 
> Note though that it only works for Linux. So other UNIX-type systems 
> like FreeBSD and Solaris are not supported.

FreeBSD is mostly supported,  though two units (shadow and crypth) and some 
calls
relating to shadow passwords in users are not.

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

Re: [fpc-pascal] Get user ID for name on Linux

2018-01-04 Thread leledumbo via fpc-pascal
> Is there a complete list of packages available somewhere? 

$ svn co https://svn.freepascal.org/svn/fpc/trunk fpc
$ cd fpc/packages
$ ls

tadaaa...




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Modern Compiler Construction using Pascal

2018-01-04 Thread leledumbo via fpc-pascal
I used to play with this a bit: https://github.com/lysee/lysee
It's written by a Chinese programmer and I remember reading his page about
the language using google translate :p
The github page is without documentation, but its older google code page is
still accessible (just hope he didn't break anything lately):
https://code.google.com/archive/p/lysee/



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Modern Compiler Construction using Pascal

2018-01-04 Thread Yves Cloutier
Wow, these are all amazing links!  Thanks so much. This should keep me busy
for a while!

On Tue, Jan 2, 2018 at 10:49 AM, Santiago A.  wrote:

> El 01/01/2018 a las 19:17, Yves Cloutier escribió:
> > Hi there,
> >
> > I'd be interested to know if any modern compilers have been written in
> > Pascal (other than the Pascal Compiler).
> >
> > It's unfortunate that that most Pascal books out there are rather
> > dated.  I did recently purchase
>
> The first version of nim language  https://nim-lang.org/ was written in
> Pascal. Here are the sources
> https://github.com/nim-lang/Nim/tree/ea1f1ec6d4d6c776eb0f81c2bebdd4
> cb4c817ebe/nim
>
> Many times, when compiler is mature, the compiler is re-written in the
> target language itself. Freepascal compiler is written in Freepascal.
>
> First version of compiler must be written in other language, (of course,
> the are not compilers for the language ), usually a language that
> generates binary, compiling is very demanding to rely on virtual
> machines Probably that is why there are not Java compilers written in
> Java, or Python or Perl compilers written in Python or Perl . As usual,
> the most popular language will be most used language: C, C++
>
>
> --
> Saludos
>
> Santiago A.
>
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal