Recent

Author Topic: New widget set : Web Application mode  (Read 73771 times)

Anonymous

  • Guest
New widget set : Web Application mode
« on: June 16, 2006, 05:51:55 pm »
Hello.

I think it will be very interesting to have a new mode in Lazarus-Free Pascal. The Web Application Mode (like Intraweb controls in Delphi). Compiling in this mode, the resultant application must be a mini-web server, showing the application in estandar HTML and Javascript pages.

Sorry for my english.

Congratulations for a great work.

Marc Guillot.

Phil

  • Hero Member
  • *****
  • Posts: 2750
New widget set : Web Application mode
« Reply #1 on: June 18, 2006, 05:31:51 pm »
Marc,

That's a very interesting idea: a Web widgetset. I don't have enough experience developing either a Laz widgetset or Web-based apps to know if this is practical or not. If you have experience with developing Web-based apps, perhaps you could expand a bit on your idea and get a discussion going.

Lord_ZealoN

  • Full Member
  • ***
  • Posts: 141
    • http://lordzealon.com
New widget set : Web Application mode
« Reply #2 on: June 19, 2006, 05:39:03 pm »
Would be great. And something like PHP but in pascal.

Yes, exists Pascal Server Pages, but is discontinuated.

Anonymous

  • Guest
New widget set : Web Application mode
« Reply #3 on: June 19, 2006, 09:07:56 pm »
Quote from: "Phil"
Marc,

That's a very interesting idea: a Web widgetset. I don't have enough experience developing either a Laz widgetset or Web-based apps to know if this is practical or not. If you have experience with developing Web-based apps, perhaps you could expand a bit on your idea and get a discussion going.


I have no idea to develop a new Laz widgetset too. :(

(Really I'am not sure if we must better talk about a new platform to support).

Is very easy to write a Web application using it (Intraweb in Delphi). You code it exactly the same way for a host application (no need of html and javascript knowledge).

http://www.delphizine.com/productreviews/2002/06/di200206ps_p/di200206ps_p.asp

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
New widget set : Web Application mode
« Reply #4 on: June 20, 2006, 12:19:08 am »
Quote from: "Anonymous"
I have no idea to develop a new Laz widgetset too. :(


Fortunately there is a tutorial about this =)

http://wiki.lazarus.freepascal.org/index.php/LCL_Internals#How_to_create_a_new_Widgetset

But I don´t know how this would work for a web application. It would be necessary to understand exactly what IntraWeb does.

Two options that come to my mind are:

1 - Transform the lazarus software into a CGI program

2 - Create another compiler that will read Lazarus code and transform it into html+javascript

Which of these (and other options I don´t see) IntraWeb does?

CCRDude

  • Hero Member
  • *****
  • Posts: 502
New widget set : Web Application mode
« Reply #5 on: June 20, 2006, 09:40:22 am »
I have no idea about IntraWeb, but since this was mentioned as a web widget, I would imagine
* Pascal application listens on defined port (80 or custom)
* App is invisible or has only status window, and serves forms as HTML to client
* The server could be in two parts: a simple web server for basic files, and a webservice for more (disadvantage: I don't know if a web service class exists and if so, if it would co-exist with a parallel file server on the same port).
* Clicks would still be easy if the whole "window" is a form
* Most things would be AJAX:
* using javascript events to report minor things like keypresses to the server
* changes the server does on those events would be the most complicated thing I guess; there would be need for a communication structure between the Pascal server app and the JS client app for visual changes.

Well, actually I need a Lazarus web server app in the near future, and with that tutorial page in mind, I can try to implement a few things as a start.

My concerns would be:
* HTML is a standard defined to create pages that are independent on screen resolutions, even if many web programmers don't care about that - forms are usually very strict in size. So either this takes good coding (using Align a lot, making it more difficult for the widget), or ignores the standards.
* HTML even with AJAX is still kind of unidirectional. The client can fire events like clicks, keypresses etc. that will not reload the whole form (making it quite unusable) and gets feedback. We could define some kind of message transport structure so that the handler called by the page could change things on the page. But the widget would not to store copies of nearly everything, because the widget can't just "ask" the client on its own, it's dependend on those events.

Hmmm. I guess I will try something "simple": code that transforms a form into HTML, which I could need for myself anyway, and see from there how it goes.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
New widget set : Web Application mode
« Reply #6 on: June 20, 2006, 10:50:34 am »
I've been thinking about this as well (just in theory)

You can have to solutions:
1) write your own server and let it be your application.
2) write the application as a cgi, and store the app data as session info.

the 1st form has the advantage that you kan keep all the application data together a bit like a traditional app. The disadvantage is that you need to implement all server logic as well. Not all ppl who want to deploy a websote like this are able to choose their server.

the 2nd form has the advantager that you don't have to take care of your server. You can place your app on almost  any existing server supporting cgi. The disadvantage is that you neet to keep the app data and logic stored in a session, in order to process each request.

Personally I think that a widgetset based on cgi would be preferred.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

CCRDude

  • Hero Member
  • *****
  • Posts: 502
New widget set : Web Application mode
« Reply #7 on: June 20, 2006, 03:21:00 pm »
Hmmm... not sure about that:

"Public" applications: you're right, not everyone has root access to a server so he could place his app there; access to upload cgi etc. is given way more often.

"Private" applications: not everyone has a server capable of running the cgi scripts needed for #2, but they can run #1 on every Windows or Linux machine they have.

So... I don't want to use Lazarus for developing "software" for public websites - perl, php, whatever are much more useful for that! A standard "web application" I would write would be targeted at an Intranet only, and small local networks may have a Windows server or Windows machine running through, but not so often a LAMPP box.

Of course you could tell people to install a webserver etc... but then it's like .NET - you've got to download dozens of MBs for the "framework" of a small application ;) And then this widget would only be used for huge applications (thinking about commercial software, you've probably got to explain to your customer why you need to install half a dozen of freeware applications to run his custom software).

I understand the hesitation to have the server inside the widget though - I've got some experiences with Indy an many clients accessing it that are far from good (will soon test with Synapse and hope that's better).

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
New widget set : Web Application mode
« Reply #8 on: June 20, 2006, 04:21:45 pm »
Quote from: "CCRDude"
So... I don't want to use Lazarus for developing "software" for public websites - perl, php, whatever are much more useful for that! A standard "web application" I would write would be targeted at an Intranet only, and small local networks may have a Windows server or Windows machine running through, but not so often a LAMPP box.


We surely can have both approaches on 2 separate widgetsets.

On open source world the developer is king. So, what will decide which approach get´s more code and become more standard is people writing code for it =)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
New widget set : Web Application mode
« Reply #9 on: June 20, 2006, 04:22:57 pm »
Maybe we can find a way to have both. Run in server mode or as cgi.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Anonymous

  • Guest
New widget set : Web Application mode
« Reply #10 on: June 20, 2006, 07:27:34 pm »
In Delphi, Intraweb offers various possibilities.

You can make and stand-alone executable, that acts like a mini-web server, offering your application. Or you can compile in a Apache or IIS shared module.

Some more information : http://www.drbob42.com/examines/examin48.htm

It seems the most hardarous work are not this deployment options but the engine of rendering forms and events in standar HTML and Javascript.

Marc Guillot.

RudieD

  • Full Member
  • ***
  • Posts: 234
New widget set : Web Application mode
« Reply #11 on: June 20, 2006, 08:38:20 pm »
Have any one tried the Fast CGI yet ? It should give you the power of normal CGI, but instead of loading the bin each time, you can have a full multi threaded socket server running full time and just sync the access to the common (session) block. You can then also easily extend the server to another PC to help with the load.
The FRED Trainer. (Training FRED with Lazarus/FPC)

Anonymous

  • Guest
New widget set : Web Application mode
« Reply #12 on: June 21, 2006, 02:25:52 am »
Quote from: "CCRDude"
Hmmm... not sure about that:

So... I don't want to use Lazarus for developing "software" for public websites - perl, php, whatever are much more useful for that! A standard "web application" I would write would be targeted at an Intranet only, and small local networks may have a Windows server or Windows machine running through, but not so often a LAMPP box.



I completely sencond that. Lazarus Developers should not concentrate on this. Web stuff is "main stream" stutff. Your provider will have PHP and/or ASP.NET installed. Even "en vogue" systems like Ruby on Rails have a hard time to get installed on most providers.

Quote from: "CCRDude"


I understand the hesitation to have the server inside the widget though - I've got some experiences with Indy an many clients accessing it that are far from good (will soon test with Synapse and hope that's better).


Synapse is way better than Indy, and it fully supports most FPC targets now.
Once you know your way through Synapse, you'll have the great feeling of "knowing what happens" which you'll never have using Indy.
Synapse may not seem as "handy" as Indy at first sight, but its much better written at lower level and has less bugs.

Anonymous

  • Guest
New widget set : Web Application mode
« Reply #13 on: June 21, 2006, 02:57:54 am »
Oh, and don't get confused about the relatively simple implementation of the "higher level" classes like THTTPSend in Synapse.
They have only demo character for me. But because the system is transparent, you can easily add your requirements to it.
Maybe my example http://www.theo.ch/kylix/httpthread.zip which was written for Delphi / Kylix can give you some ideas.
It shows how to use THTTPSend in a Thread for preventing the GUI from blocking, sending status messages to the GUI (this is using Sendmessage API and will not work on Lazarus (at least not crossplatform)), and how to handle redirects.

Almindor

  • Sr. Member
  • ****
  • Posts: 411
    • http://www.astarot.tk
New widget set : Web Application mode
« Reply #14 on: June 21, 2006, 03:17:30 pm »
For "CGI" handling you can use PSP ( http://www.google.sk/search?hl=sk&q=pascal+server+pages&btnG=H%C4%BEada%C5%A5+v+Google&meta= )

For web server, lNet will have a 100% functional HTTP 1.1 server with fastCGI support in 0.4.0 (will go out with fpc 2.0.4). It can be integrated with lazarus rather simply.