Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-04

TCgiApplication in cgiapp unit - mostly deprecated

32 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

Hi all,

Michael Van Canneyt wrote 13 lines
> On Fri, 27 Nov 2009, Graeme Geldenhuys wrote: > Hi, > > Most of the methods in TCgiApplication (located in cgiapp unit) is > marked as deprecated. There is no documentation for this unit, so I do > not know much about it. > > If all those methods are marked deprecated, what is replacing them? The whole cgiapp unit is deprecated, you should use the TCGIApplication from fpCGI. Lazarus has a package to create web applications with the fcl-web units. Michael.

What about FastCGI, is there an implementation default in FPC?

I want codify a web app and I think use FreePascal. You recommend that? Or is better use another language like Java or Python? I prefer Pascal, but exists good Libs for that?

Thanks,
Marcos Douglas

Reply by email

Graeme Geldenhuys
to Marcos Douglas
Marcos Douglas wrote
What about FastCGI, is there an implementation default in FPC?

I haven't used FastCGI yet, but there seems to be an implementation included with FPC.

<fpc_src>/packages/fastcgi/*

I want codify a web app and I think use FreePascal. You recommend that?

Free Pascal is a very good choice for CGI web applications. You have the full RTL and FCL at your disposal. I even use a OPF (Object Persistent Framework) with our CGI apps.

Best of all, I didn't have to learn a new language like PHP, Java, Python etc. :-)

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Marcos Douglas
to Graeme Geldenhuys

Hi Graeme,

Graeme Geldenhuys wrote 6 lines
I haven't used FastCGI yet, but there seems to be an implementation included with FPC.  <fpc_src>/packages/fastcgi/*

I wanted know if many people here use that implementation of FastCGI.

Free Pascal is a very good choice for CGI web applications. You have the full RTL and FCL at your disposal. I even use a OPF (Object Persistent Framework) with our CGI apps.

YES, for me too. But I need to convence my team about that. For Web app, now, we use PHP.
I need to rewrite a Desktop app, coded in Delphi 7, to Web. The options: PHP, Java, C# and Pascal. For me, FreePascal would be a good choice, but the market here in Brazil does not like to use Delphi/Pascal any more... now, the most use Java or C#. So, because that, my team is worried about it, if exists support for reports, if is fast, etc.

Exists a project open source, in Pascal, here in Brazil. It's call ExtPascal <http://code.google.com/p/extpascal/>. This is a project to code Web apps. It use ExtJS for client and Pascal for server.

Best of all, I didn't have to learn a new language like PHP, Java, Python etc. :-)

Me too!

Marcos Douglas

Reply by email

Graeme Geldenhuys
to Marcos Douglas
Marcos Douglas wrote
I need to rewrite a Desktop app, coded in Delphi 7, to Web. The options: PHP, Java, C# and Pascal. For me, FreePascal would be a good

Some reasons:
* Free Pascal is open source (always available and no vendor lock-in)
* Free Pascal is free, so can always use latest version at NO cost.
* Previous skills from Delphi 7 project can be reused. No need to retrain developers. Saving 1000's in cost.
* Previous business domain code can be reused. Saving hundreds of hours in development time.
* No runtime or VM is required to run apps (unlike PHP, C# or Java).
* Development tools are free and again open source.

Exists a project open source, in Pascal, here in Brazil. It's call ExtPascal <http://code.google.com/p/extpascal/>. This is a project to code Web apps. It use ExtJS for client and Pascal for server.

I know of many developers or companies using ExtPascal to write web apps. I unfortunately have not looked at it yet. I started our CGI apps long before I found out about ExtPascal.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Rainer Stratmann
to Graeme Geldenhuys
Graeme Geldenhuys wrote 13 lines
On 2 May 2010 17:17, Marcos Douglas wrote: > I need to rewrite a Desktop app, coded in Delphi 7, to Web. The > options: PHP, Java, C# and Pascal. For me, FreePascal would be a good Some reasons: * Free Pascal is open source (always available and no vendor lock-in) * Free Pascal is free, so can always use latest version at NO cost. * Previous skills from Delphi 7 project can be reused. No need to retrain developers. Saving 1000's in cost. * Previous business domain code can be reused. Saving hundreds of hours in development time. * No runtime or VM is required to run apps (unlike PHP, C# or Java). * Development tools are free and again open source.

Here is a Web Server programmed entirely in Freepascal: http://ip.klimaregelung.de/ip.php?action=connect&benutzercode=Stratmann No Apache or PHP or something else.

Because it is a small embedded computer at home only 20 connections at a time are possible. But it would be possible to expand with more powerful computers.

I am HAPPY with Freepascal!

Show quoted text 7 lines
> Exists a project open source, in Pascal, here in Brazil. It's call > ExtPascal <http://code.google.com/p/extpascal/>. This is a project to > code Web apps. It use ExtJS for client and Pascal for server. I know of many developers or companies using ExtPascal to write web apps. I unfortunately have not looked at it yet. I started our CGI apps long before I found out about ExtPascal.

Reply by email

Lee Jenkins
to Graeme Geldenhuys: Some reasons: * Free Pascal is open source (always available and no vendor lock-in) *…
Graeme Geldenhuys wrote 14 lines
On 2 May 2010 17:17, Marcos Douglas wrote: > I need to rewrite a Desktop app, coded in Delphi 7, to Web. The > options: PHP, Java, C# and Pascal. For me, FreePascal would be a good Some reasons: * Free Pascal is open source (always available and no vendor lock-in) * Free Pascal is free, so can always use latest version at NO cost. * Previous skills from Delphi 7 project can be reused. No need to retrain developers. Saving 1000's in cost. * Previous business domain code can be reused. Saving hundreds of hours in development time. * No runtime or VM is required to run apps (unlike PHP, C# or Java). * Development tools are free and again open source.

* Virtual Private Hosting is really cheap now, largely alleviating the problem of deploying native executables to web servers like FastCGI, ISAPI, apache_mod, etc.

Show quoted text 9 lines
> Exists a project open source, in Pascal, here in Brazil. It's call > ExtPascal <http://code.google.com/p/extpascal/>. This is a project to > code Web apps. It use ExtJS for client and Pascal for server. I know of many developers or companies using ExtPascal to write web apps. I unfortunately have not looked at it yet. I started our CGI apps long before I found out about ExtPascal.

I am working on a project now for RIA similar in concept to ExtPascal, but abstracting out the UI framework with most of the logic executing on the server so that I can plug in different UI's without touching my model/controller.

I was about 90% finished with the Flex UI layer when the customer whose site I'm writing, got spooked by all the Apple/Adobe/HTML5 debate that has heated up and became adamant about not using flash based UI, limiting Flash to playing video where necesary and using DHMTL for client UI.

So I'm taking advantage of the extra time and refactoring the framework a bit and implementing a DHTML UI layer now. We looked at ExtJS as well as YahooUI, OpenLaszlo and a few of the others and eventually decided on Dojo javascript tookit, but different UI layers can be plugged in. Heck, even an LCL or fpGUI layer is feasible.

Warm Regards, Lee

Reply by email

duilio foschi
to Lee Jenkins

how do I build a minimal 'hello world' CGI application under Free Pascal ?

Where do I find 'instructions for dummies' ?

Peppe

2010/5/2 Lee Jenkins :

Show quoted text 57 lines
Graeme Geldenhuys wrote: > > On 2 May 2010 17:17, Marcos Douglas wrote: >> >> I need to rewrite a Desktop app, coded in Delphi 7, to Web. The >> options: PHP, Java, C# and Pascal. For me, FreePascal would be a good > > Some reasons: >  * Free Pascal is open source (always available and no vendor lock-in) >  * Free Pascal is free, so can always use latest version at NO cost. >  * Previous skills from Delphi 7 project can be reused. No need to retrain >   developers. Saving 1000's in cost. >  * Previous business domain code can be reused. Saving hundreds of hours >   in development time. >  * No runtime or VM is required to run apps (unlike PHP, C# or Java). >  * Development tools are free and again open source. > * Virtual Private Hosting is really cheap now, largely alleviating the problem of deploying native executables to web servers like FastCGI, ISAPI, apache_mod, etc. >> Exists a project open source, in Pascal, here in Brazil. It's call >> ExtPascal <http://code.google.com/p/extpascal/>. This is a project to >> code Web apps. It use ExtJS for client and Pascal for server. > > I know of many developers or companies using ExtPascal to write web > apps. I unfortunately have not looked at it yet. I started our CGI > apps long before I found out about ExtPascal. > > I am working on a project now for RIA similar in concept to ExtPascal, but abstracting out the UI framework with most of the logic executing on the server so that I can plug in different UI's without touching my model/controller. I was about 90% finished with the Flex UI layer when the customer whose site I'm writing, got spooked by all the Apple/Adobe/HTML5 debate that has heated up and became adamant about not using flash based UI, limiting Flash to playing video where necesary and using DHMTL for client UI. So I'm taking advantage of the extra time and refactoring the framework a bit and implementing a DHTML UI layer now.  We looked at ExtJS as well as YahooUI, OpenLaszlo and a few of the others and eventually decided on Dojo javascript tookit, but different UI layers can be plugged in.  Heck, even an LCL or fpGUI layer is feasible. -- Warm Regards, Lee _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

duilio foschi
to leledumbo

Lele,

I need instructions for _dumbier_ users :)

1.
==

After hosted, CGI can now be used normally as http://www.yourserver.com[.xx]/yourlogin/cgi-bin/cginame.exe

(I will use my web browser, I suppose...)

However I have no web site on my server... :(

So where to store and how to call the application ?

2.
==

what should I see on screen ?

Thank you

Peppe

2010/5/3 leledumbo :

Show quoted text 15 lines
> how do I build a minimal 'hello world' CGI  application under Free Pascal ? > > Where do I find 'instructions for dummies'  ? Have a look  http://wiki.lazarus.freepascal.org/CGI_Web_Programming here . -- View this message in context: http://old.nabble.com/TCgiApplication-in-cgiapp-unit---mostly-deprecated-tp28413954p28432080.html Sent from the Free Pascal - General mailing list . _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Graeme Geldenhuys
to duilio foschi: how do I build a minimal 'hello world' CGI application under Free Pascal ? Where do I…

duilio foschi het geskryf:

how do I build a minimal 'hello world' CGI application under Free Pascal ?

Can't get simpler than this:

---------------------
program cgitest;
{$mode objfpc}{$H+}
uses
  Classes;
begin
  writeln('Content-Type:text/html',#10#13);
  writeln('<html>');
  writeln('<head><title>FPC Test</title></head>');
  writeln('<body>Hello World</body>');
  writeln('</html>');
end.

-----------------------

Output is shown in the attached screenshot. Obviously you need a webserver to correctly view the results. Simply install Apache and enable CGI support (if not enabled by default).

As you can see from the sample application, CGI apps are simply glorified console applications.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Marcos Douglas
to Graeme Geldenhuys: Some reasons: * Free Pascal is open source (always available and no vendor lock-in) *…
Graeme Geldenhuys wrote 10 lines
Some reasons:  * Free Pascal is open source (always available and no vendor lock-in)  * Free Pascal is free, so can always use latest version at NO cost.  * Previous skills from Delphi 7 project can be reused. No need to retrain   developers. Saving 1000's in cost.  * Previous business domain code can be reused. Saving hundreds of hours   in development time.  * No runtime or VM is required to run apps (unlike PHP, C# or Java).  * Development tools are free and again open source.

Yes, are good reasons.

I know of many developers or companies using ExtPascal to write web apps. I unfortunately have not looked at it yet. I started our CGI apps long before I found out about ExtPascal.

I do not knew about this! Can you post a few links of companies using ExtPascal? Would be very good to post these links in list of ExtPascal.

Well, ExtPascal use FastCGI approach. People say FastCGI is more powerful than CGI, because the application continues in memory... What about do you think about performance of CGI apps?

Rainer Stratmann wrote 7 lines
Here is a Web Server programmed entirely in Freepascal: http://ip.klimaregelung.de/ip.php?action=connect&benutzercode=Stratmann No Apache or PHP or something else. Because it is a small embedded computer at home only 20 connections at a time are possible. But it would be possible to expand with more powerful computers.

Do you use FastCGI or CGI?
How do you limits max connections?

Marcos Douglas

Reply by email

Rainer Stratmann
to Marcos Douglas
Marcos Douglas wrote 41 lines
On Sun, May 2, 2010 at 2:29 PM, Graeme Geldenhuys wrote: > Some reasons: >  * Free Pascal is open source (always available and no vendor lock-in) >  * Free Pascal is free, so can always use latest version at NO cost. >  * Previous skills from Delphi 7 project can be reused. No need to > retrain developers. Saving 1000's in cost. >  * Previous business domain code can be reused. Saving hundreds of hours >   in development time. >  * No runtime or VM is required to run apps (unlike PHP, C# or Java). >  * Development tools are free and again open source. Yes, are good reasons. > I know of many developers or companies using ExtPascal to write web > apps. I unfortunately have not looked at it yet. I started our CGI > apps long before I found out about ExtPascal. I do not knew about this! Can you post a few links of companies using ExtPascal? Would be very good to post these links in list of ExtPascal. Well, ExtPascal use FastCGI approach. People say FastCGI is more powerful than CGI, because the application continues in memory... What about do you think about performance of CGI apps? On Sun, May 2, 2010 at 3:09 PM, Rainer Stratmann wrote: > Here is a Web Server programmed entirely in Freepascal: > http://ip.klimaregelung.de/ip.php?action=connect&benutzercode=Stratmann > No Apache or PHP or something else. > > Because it is a small embedded computer at home only 20 connections at a > time are possible. But it would be possible to expand with more powerful > computers. Do you use FastCGI or CGI? How do you limits max connections?

I don't know what CGI is. Nevertheless I was able to program a webserver completely in freepascal. It isn't that complicate (if you have time). If a connection comes in then I prove how many connections are already open, and if it exceeds the max_connection value (which I set to 20 now) then I close immediately the new incoming connection. If you want I show you sample code. I work with nonblocked sockets. So everything is in one thread. best regards, Rainer

Show quoted text 6 lines
-- Marcos Douglas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Graeme Geldenhuys
to Marcos Douglas: On Sun, May 2, 2010 at 2:29 PM, Graeme Geldenhuys Yes, are good reasons. I do not knew…

Marcos Douglas het geskryf:

I do not knew about this! Can you post a few links of companies using ExtPascal? Would be very good to post these links in list of ExtPascal.

Many are developers I read about in the Lazarus and FPC-users mailing list.

What about do you think about performance of CGI apps?

At the moment we use plain CGI apps. Even though our application needs to create on every user interaction a new database connection, our application is still sufficiently fast. Only after two years of development, did I find out about FastCGI and how it differs. So as soon as time permits, I will be porting our CGI apps to FastCGI - simply to keep database connections open, and keep other lookup lists in memory - this should improve performance a lot.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Marcos Douglas
to Lee Jenkins: * Virtual Private Hosting is really cheap now, largely alleviating the problem of…

Hi Lee,

Lee Jenkins wrote
* Virtual Private Hosting is really cheap now, largely alleviating the problem of deploying native executables to web servers like FastCGI, ISAPI, apache_mod, etc.

Yes, you right.

I am working on a project now for RIA similar in concept to ExtPascal, but abstracting out the UI framework with most of the logic executing on the server so that I can plug in different UI's without touching my model/controller.

That is what I looking for!
That is what I looking for!
I do not want to use ExtPascal because it depends on ExtJS and their documents (to generate the Pascal code). I wish I could choose the JavaScript framework.

Show quoted text 10 lines
I was about 90% finished with the Flex UI layer when the customer whose site I'm writing, got spooked by all the Apple/Adobe/HTML5 debate that has heated up and became adamant about not using flash based UI, limiting Flash to playing video where necesary and using DHMTL for client UI. So I'm taking advantage of the extra time and refactoring the framework a bit and implementing a DHTML UI layer now.  We looked at ExtJS as well as YahooUI, OpenLaszlo and a few of the others and eventually decided on Dojo javascript tookit, but different UI layers can be plugged in.  Heck, even an LCL or fpGUI layer is feasible.

Your project is open source?
I'm very interested about that. Do you use some "template engine" for UI? The tecnology WebBroker (old Delphi) had macros for replace in events like #name or #salary. That is very simply but very coupled. We had HTML code coupled with Pascal code. The designers could not easily change UI code because that.

Marcos Douglas

Reply by email

Marcos Douglas
to Rainer Stratmann: I don't know what CGI is. Nevertheless I was able to program a webserver completely in…
Rainer Stratmann wrote 6 lines
I don't know what CGI is. Nevertheless I was able to program a webserver completely in freepascal. It isn't that complicate (if you have time). If a connection comes in then I prove how many connections are already open, and if it exceeds the max_connection value (which I set to 20 now) then I close immediately the new incoming connection. If you want I show you sample code. I work with nonblocked sockets. So everything is in one thread.

I will appreciate it very much see this code, thanks!

Marcos Douglas

Reply by email

Marcos Douglas
to Graeme Geldenhuys: Marcos Douglas het geskryf: Many are developers I read about in the Lazarus and FPC-users…
Graeme Geldenhuys wrote 17 lines
Marcos Douglas het geskryf: > > I do not knew about this! Can you post a few links of companies using > ExtPascal? Would be very good to post these links in list of > ExtPascal. Many are developers I read about in the Lazarus and FPC-users mailing list. > What about do you think about performance of CGI apps? At the moment we use plain CGI apps. Even though our application needs to create on every user interaction a new database connection, our application is still sufficiently fast. Only after two years of development, did I find out about FastCGI and how it differs. So as soon as time permits, I will be porting our CGI apps to FastCGI - simply to keep database connections open, and keep other lookup lists in memory - this should improve performance a lot.

What do you use in UI?
What about templates, do you use?

If you have some news about on learning FastCGI, tell us, please.

Marcos Douglas

Reply by email

Graeme Geldenhuys
to Marcos Douglas: On Mon, May 3, 2010 at 9:41 AM, Graeme Geldenhuys What do you use in UI? What about…

Marcos Douglas het geskryf:

What do you use in UI? What about templates, do you use?

No templates and hard-crafted UI with our own HTML and CSS markup. Our CGI apps have a very dynamic interface which is build from information stored in a database.

If you have some news about on learning FastCGI, tell us, please.

I only know about FastCGI. I have never really looked at how it works yet. We do use PWU (Powutils), but actually just one or two methods, not much really. We can actually remove the dependency on PWU.

The version of PWU that we use are available for download in the following URL. The latest version in the PWU repository doesn't compile for us, for some months now. The project seems dead.

http://opensoft.homeip.net/~graemeg/pwu-1.6.0.2.tar.gz

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Marcos Douglas
to Graeme Geldenhuys
Graeme Geldenhuys wrote
No templates and hard-crafted UI with our own HTML and CSS markup. Our CGI apps have a very dynamic interface which is build from information stored in a database.

There are HTML code inside Pascal code?

Show quoted text 9 lines
I only know about FastCGI. I have never really looked at how it works yet. We do use PWU (Powutils), but actually just one or two methods, not much really. We can actually remove the dependency on PWU. The version of PWU that we use are available for download in the following URL. The latest version in the PWU repository doesn't compile for us, for some months now. The project seems dead.  http://opensoft.homeip.net/~graemeg/pwu-1.6.0.2.tar.gz

Thanks for the file.
So, you don't have any lib dependencies in your aplications?

Marcos Douglas

Reply by email

Lee Jenkins
to Marcos Douglas: Yes, you right. That is what I looking for! That is what I looking for! I do not want to…
Marcos Douglas wrote 16 lines
Hi Lee, > > So I'm taking advantage of the extra time and refactoring the framework a > bit and implementing a DHTML UI layer now. We looked at ExtJS as well as > YahooUI, OpenLaszlo and a few of the others and eventually decided on Dojo > javascript tookit, but different UI layers can be plugged in. Heck, even an > LCL or fpGUI layer is feasible. Your project is open source? I'm very interested about that. Do you use some "template engine" for UI? The tecnology WebBroker (old Delphi) had macros for replace in events like #name or #salary. That is very simply but very coupled. We had HTML code coupled with Pascal code. The designers could not easily change UI code because that.

Yes, I had plans to release it open source when its ready for testing, probably within 3-4 weeks from now.

The idea of the framework is mainly based on Proxy pattern. You build your gui within the server session, similar to how ExtPascal does it though with a more VCL/LCL kinds of model than ExtPascal. however, note that it doesn't use VCL/LCL and is based non-gui objects like TInterfacedPersistent to avoid dependencies on Lazarus LCL or Delphi VCL.

My goals in its development has been to ensure that the framwork overall:

A) Not tied to any particular GUI front-end, they should be swappable. I should be able to present my Model/Controller (or other business logic) in different UI's such as Flex, Silverlight, ExtJS, Dojo, OpenLaszlo, etc while still keeping 95% of the code on the server.

B) Any server platform or protocol. For instance, you should be able to deploy your application using what ever server protocol that is appropriate for the job. So feasibly you should be able to deploy your server app to FastCGI, Apache Module, ISAPI or even a stand alone synapse based HTTP server like I am using for testing.

Think of it as using the client UI as a puppet, with the server telling the client what to display through a two-way event system.

Here is a short screencast of the framework using the Flex UI layer. Note that its pretty old and the framework has come a long way since this screencast and as I said, I'm going through some refactoring now since I have to change some things for the customer anyway.

http://preview.tinyurl.com/18r

Warm Regards, Lee

Reply by email

Lee Jenkins
to Lee Jenkins
Lee Jenkins wrote 8 lines
Here is a short screencast of the framework using the Flex UI layer. Note that its pretty old and the framework has come a long way since this screencast and as I said, I'm going through some refactoring now since I have to change some things for the customer anyway. http://preview.tinyurl.com/18r

Not sure why TinyURL spazzed out with the first link but here is on that works:

http://preview.tinyurl.com/23uewfx

Warm Regards, Lee

Reply by email

Graeme Geldenhuys
to Marcos Douglas: On Mon, May 3, 2010 at 11:07 AM, Graeme Geldenhuys There are HTML code inside Pascal code?

Marcos Douglas het geskryf:

There are HTML code inside Pascal code?

All HTML code (inside our pascal code) is tagged with class of div id's. We then use CSS to adjust our UI the way we want.

For inspiration of this concept, have a look at:
http://www.csszengarden.com/

All the pages (themes) available is all build with the exact same HTML file (nobody is allowed to change that file), just the CSS files are different. Pretty awesome!

Thanks for the file. So, you don't have any lib dependencies in your aplications?

Our CGI applications (three of them) are just one part of our complete product. We have a desktop GUI part as well. The CGI applications reuse a lot of code from the desktop. We implement the Model-GUI-Mediator design pattern, to split UI code from Business Domain code. Our applications talk to a Firebird RDBMS, and use SqlDB components, but we do *not* code for SqlDB directly. Instead we use tiOPF (http://www.tiopf.com) which is a Object Persistence Framework to manage all our data persistence (loading and saving of Objects). So with a single compiler define we can switch from Firebird to MySQL or PostgreSQL etc without a single line of code that needs to change. We can even switch database components (eg: SqlDB -> FBLib) with a single compiler define, and again, no lines of code need to change.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Lee Jenkins
to Graeme Geldenhuys
Graeme Geldenhuys wrote 13 lines
Our CGI applications (three of them) are just one part of our complete product. We have a desktop GUI part as well. The CGI applications reuse a lot of code from the desktop. We implement the Model-GUI-Mediator design pattern, to split UI code from Business Domain code. Our applications talk to a Firebird RDBMS, and use SqlDB components, but we do *not* code for SqlDB directly. Instead we use tiOPF (http://www.tiopf.com) which is a Object Persistence Framework to manage all our data persistence (loading and saving of Objects). So with a single compiler define we can switch from Firebird to MySQL or PostgreSQL etc without a single line of code that needs to change. We can even switch database components (eg: SqlDB -> FBLib) with a single compiler define, and again, no lines of code need to change.

I am most interested to hear how tiOPF handles under a threaded environment when you move to FastCGI, Graeme.

Warm Regards, Lee

Reply by email

Marcos Douglas
to Lee Jenkins: Yes, I had plans to release it open source when its ready for testing, probably within…
Lee Jenkins wrote
Yes, I had plans to release it open source when its ready for testing, probably within 3-4 weeks from now.

This is great!

Show quoted text 5 lines
The idea of the framework is mainly based on Proxy pattern.  You build your gui within the server session, similar to how ExtPascal does it though with a more VCL/LCL kinds of model than ExtPascal.  however, note that it doesn't use VCL/LCL and is based non-gui objects like TInterfacedPersistent to avoid dependencies on Lazarus LCL or Delphi VCL.

Interesting!

Show quoted text 6 lines
My goals in its development has been to ensure that the framwork overall: A) Not tied to any particular GUI front-end, they should be swappable.  I should be able to present my Model/Controller (or other business logic) in different UI's such as Flex, Silverlight, ExtJS, Dojo, OpenLaszlo, etc while still keeping 95% of the code on the server.

His framework already supports all of these UI?!

Show quoted text 5 lines
B) Any server platform or protocol.  For instance, you should be able to deploy your application using what ever server protocol that is appropriate for the job.  So feasibly you should be able to deploy your server app to FastCGI, Apache Module, ISAPI or even a stand alone synapse based HTTP server like I am using for testing.

This is very interesting ... but you are not creating too many options? If there are many options, more harder it is to understand, isn't?

Show quoted text 7 lines
Think of it as using the client UI as a puppet, with the server telling the client what to display through a two-way event system. Here is a short screencast of the framework using the Flex UI layer.  Note that its pretty old and the framework has come a long way since this screencast and as I said, I'm going through some refactoring now since I have to change some things for the customer anyway.

Thanks for the link!

Marcos Douglas

Reply by email

Marcos Douglas
to Graeme Geldenhuys: Marcos Douglas het geskryf: All HTML code (inside our pascal code) is tagged with class…
Graeme Geldenhuys wrote 10 lines
All HTML code (inside our pascal code) is tagged with class of div id's. We  then use CSS to adjust our UI the way we want. For inspiration of this concept, have a look at:  http://www.csszengarden.com/ All the pages (themes) available is all build with the exact same HTML file (nobody is allowed to change that file), just the CSS files are different. Pretty awesome!

Interesting... OK, thanks to sharing this idea.

Show quoted text 12 lines
Our CGI applications (three of them) are just one part of our complete product. We have a desktop GUI part as well. The CGI applications reuse a lot of code from the desktop. We implement the Model-GUI-Mediator design pattern, to split UI code from Business Domain code. Our applications talk to a Firebird RDBMS, and use SqlDB components, but we do *not* code for SqlDB directly. Instead we use tiOPF (http://www.tiopf.com) which is a Object Persistence Framework to manage all our data persistence (loading and saving of Objects). So with a single compiler define we can switch from Firebird to MySQL or PostgreSQL etc without a single line of code that needs to change. We can even switch database components (eg: SqlDB -> FBLib) with a single compiler define, and again, no lines of code need to change.

Right. I also use an OPF made-in-home, but this is out of scope CGI's problems. BTW, is tiOPF life?

Lee Jenkins wrote
I am most interested to hear how tiOPF handles under a threaded environment when you move to FastCGI, Graeme.

Me too.

Marcos Douglas

Reply by email

Lee Jenkins
to Marcos Douglas: This is great! Interesting! His framework already supports all of these UI?! This is very…
Marcos Douglas wrote 10 lines
Lee Jenkins wrote: > My goals in its development has been to ensure that the framwork overall: > > A) Not tied to any particular GUI front-end, they should be swappable. I > should be able to present my Model/Controller (or other business logic) in > different UI's such as Flex, Silverlight, ExtJS, Dojo, OpenLaszlo, etc while > still keeping 95% of the code on the server. His framework already supports all of these UI?!

No. Only a partially finished Flex UI and the Dojo UI I'm working on now. My point was that would be possible to "plug in" different UI's.

Show quoted text 11 lines
> B) Any server platform or protocol. For instance, you should be able to > deploy your application using what ever server protocol that is appropriate > for the job. So feasibly you should be able to deploy your server app to > FastCGI, Apache Module, ISAPI or even a stand alone synapse based HTTP > server like I am using for testing. This is very interesting ... but you are not creating too many options? If there are many options, more harder it is to understand, isn't?

I don't think so because the framework itself doesn't incorporate any communication protocols. Using your favorite existing Server platform (like fpWeb/LazWeb) you write a small method for when a request comes in like the one below to handle the request/response:

var
   lApp: TRiaApplication;
begin
   lApp := FServer.ServerPool.RetrieveOrCreateApplication(URI, lSessionOID);
   try
     lApp.HandleClientRequest(InputData, OutputData, Cookies);
     // Pass back and new or changed cookies to the server.
     if lApp.OutCookies.Count > 0 then
       begin
         for lCounter := 0 to lApp.OutCookies.Count - 1 do
           begin
             OutCookies.Add(lApp.OutCookies[lCounter]);
           end;
       end;
   finally
     FServer.ServerPool.ReleaseApplication(lApp);
   end;
end;

InputDate is the post data received from the client and OutputData is a stream that will contain the response to send to the client. So in your server application, you're just feeding the TRiaApplication with simple data to handle the request and sending back to the client the data that TRiaApplication provides back in the OutputData stream. Its always works the same way, since TRiaApplication doesn't care where InputData and OutputData come from so you can use any server platform and then simply feed the TRiaApplication as indicated.

The TRiaApplication.HandleClientRequest method has two overloads that can take either Streams or Strings:

procedure   HandleClientRequest(const AInput: string; var AReturnString: string;
ACookies: TStringList); overload; virtual;
     procedure   HandleClientRequest(AInStream, AOutStream: TStream; ACookies:
TStringList); overload; virtual;
Warm Regards, Lee

Reply by email

Graeme Geldenhuys
to Lee Jenkins: I am most interested to hear how tiOPF handles under a threaded environment when you move…
Lee Jenkins wrote
I am most interested to hear how tiOPF handles under a threaded environment when you move to FastCGI, Graeme.

Well, Peter H. and others have used tiOPF in a threaded environment for years, so it does work. The only threaded part of tiOPF that I have use thus far is loading some lookup data in a background thread while users are logging in, and used the threaded debugging output (debug to file, GUI and console) all at once without degrading application speed. All debug output is cached output (except for console) and thread safe - works perfectly under our test systems (Windows and Linux).

But yes, I am very eager to switch to FastCGI, to help manage open database connections (normally the slowest code in any desktop/web app).

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Marcos Douglas: Interesting... OK, thanks to sharing this idea. Right. I also use an OPF made-in-home,…
Marcos Douglas wrote
BTW, is tiOPF life?

Not 100% sure what you mean. Maybe "is it alive?" If so, yes tiOPF is still actively being used and developed. A new branch was started recently to work on tiOPF3 features which will include Unicode support (but FPC is lagging behind Delphi on that one now).

tiOPF2 is very stable for many years already - hence the reason there are less commits than say 5 years ago, but that is just a sign that framework+applications are working well, not that tiOPF is dead.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email

Marcos Douglas
to Lee Jenkins: No. Only a partially finished Flex UI and the Dojo UI I'm working on now. My point was…
Lee Jenkins wrote 5 lines
I don't think so because the framework itself doesn't incorporate any communication protocols.  Using your favorite existing Server platform (like fpWeb/LazWeb) you write a small method for when a request comes in like the one below to handle the request/response: (...)

OK Lee, I will wait a public release, thanks.

Graeme Geldenhuys wrote 8 lines
Not 100% sure what you mean. Maybe "is it alive?" If so, yes tiOPF is still actively being used and developed. A new branch was started recently to work on tiOPF3 features which will include Unicode support (but FPC is lagging behind Delphi on that one now). tiOPF2 is very stable for many years already - hence the reason there are less commits than say 5 years ago, but that is just a sign that framework+applications are working well, not that tiOPF is dead.

Sorry my bad english :( but you get: "is it alive?" Thanks for the information about tiOPF!

Marcos Douglas

Reply by email

duilio foschi
to Marcos Douglas: Yes, you right. That is what I looking for! That is what I looking for! I do not want to…
Show quoted text 10 lines
> I am working on a project now for RIA similar in concept to ExtPascal, but > abstracting out the UI framework with most of the logic executing on the > server so that I can plug in different UI's without touching my > model/controller. That is what I looking for! That is what I looking for! I do not want to use ExtPascal because it depends on ExtJS and their documents (to generate the Pascal code). I wish I could choose the JavaScript framework.

from the documentation of ExtPascal:
file:///C:/ExtPascal/help/Overview.html (bottom part) the Parser can be adapted to read the documentation of another JavaScript framework, Dojo for example.

Duilio

Reply by email

Marcos Douglas
to duilio foschi

Hi Duilio,

duilio foschi wrote
from the documentation of ExtPascal: file:///C:/ExtPascal/help/Overview.html (bottom part) the Parser can be adapted to read the documentation of another JavaScript framework, Dojo for example.

Yes, he can, but the code generated contains the same classes and methods of ExtJS. So, if we adapt ExtPascal for other JS frameworks, the code would be very different... in other words, the framework Pascal do not be homogeneous for many JS frameworks.

Marcos Douglas

Reply by email