Recent

Author Topic: Web Development  (Read 32902 times)

Lord_ZealoN

  • Full Member
  • ***
  • Posts: 141
    • http://lordzealon.com
Web Development
« on: May 28, 2009, 11:07:52 pm »
I readed some old threads about webdevelopment under FreePascal.

I see 4 options, and is like are outdated options.
CGIs
G-Framework: seems died, and not ported to freepascal.
ExtPascal: Propietary.
Pascal Server Pages

I would like to know, if there are something like RoR, Django, and so on, or if some of this options, is viable for web development.

There are somebody here developing web apps under FreePascal?

Cheers.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Web Development
« Reply #1 on: May 28, 2009, 11:22:16 pm »

"ExtPascal: Propietary"

Please explain what you mean by that.

ExtPascal is licensed under BSD; Ext JS Core 3.0 is licensed under MIT.

http://code.google.com/p/extpascal/

http://extjs.com/

Thanks.

-Phil

Lord_ZealoN

  • Full Member
  • ***
  • Posts: 141
    • http://lordzealon.com
Re: Web Development
« Reply #2 on: May 28, 2009, 11:50:17 pm »
Well, I didn't explained very well.

ExtJS is dual license. If your app is opensource no problem, if is commercial, needs a commercial license, like the old license of QT.

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Re: Web Development
« Reply #3 on: May 29, 2009, 12:36:15 am »
What's wrong with CGI?
Lazarus/FPC on Linux

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Web Development
« Reply #4 on: May 29, 2009, 01:12:57 am »
Well, I didn't explained very well.

ExtJS is dual license. If your app is opensource no problem, if is commercial, needs a commercial license, like the old license of QT.

Correct, for the full Ext JS. I'm not sure I would call a dual license "proprietary".

Also, don't confuse Ext JS with the ExtPascal wrapper.

You might want to take a look at the ExtP Toolkit that I'm developing. It adds visual "form" (TExtWindow) design capabilities to Lazarus:

http://extpascal.googlegroups.com/web/ExtPToolkitStatus.html

Thanks.

-Phil

Lord_ZealoN

  • Full Member
  • ***
  • Posts: 141
    • http://lordzealon.com
Re: Web Development
« Reply #5 on: May 29, 2009, 10:33:58 am »
Well, I didn't explained very well.

ExtJS is dual license. If your app is opensource no problem, if is commercial, needs a commercial license, like the old license of QT.

Correct, for the full Ext JS. I'm not sure I would call a dual license "proprietary".

Also, don't confuse Ext JS with the ExtPascal wrapper.

Well, my fault. I didn't explaned fine.

Quote
You might want to take a look at the ExtP Toolkit that I'm developing. It adds visual "form" (TExtWindow) design capabilities to Lazarus:

http://extpascal.googlegroups.com/web/ExtPToolkitStatus.html

I don't understand very much about licenses, but, if I use ExtPascal, I'm using indirectly ExtJS (my app, would be a derivate work, I think), and I must respect his license. Is this correct?

What's wrong with CGI?

About web development, I only touched a little of PHP (reading wordpress or drupal code), because I don't like web development. But now, some companies, wants his applications connected with a web interface, or only working over web.

The problem with CGI (as far as I readed, I never used it and could be wrong), is thath you have to parser all HTML, CSS and so on, and is more slow, and much sites talk about CGIs like "obsolet technology".

As I said, I dont know. I only readed here and there to document me a little.

Some help about this will be appreciated.

bobo

  • Full Member
  • ***
  • Posts: 171
Re: Web Development
« Reply #6 on: May 30, 2009, 04:32:07 am »
Here are some examples about using CGI or Apache modules to create websites with Lazarus/Freepascal :

http://bugs.freepascal.org/view.php?id=13706

This is not included in the Lazarus directory structure yet but you can download the zip from there and try them out.

chrnobel

  • Sr. Member
  • ****
  • Posts: 283
Re: Web Development
« Reply #7 on: June 01, 2009, 11:20:39 am »
The problem with CGI (as far as I readed, I never used it and could be wrong), is thath you have to parser all HTML, CSS and so on, and is more slow, and much sites talk about CGIs like "obsolet technology".
CGI is by no means "dead".

I use Powtils (AKA Pascal Server Pages) for several portal solutions, and it is extremely fast, scalable, and as Powtils runs as binaries, it is also secure, not to to forget that ressorces are freed the very splitsecond the binary is finish executing - so no memory hogs.

Combine that with Zeos, and it is possible to make some really powerfull webapplications with database access, but without the security flaws found in PHP.

/Chris

RudieD

  • Full Member
  • ***
  • Posts: 234
Re: Web Development
« Reply #8 on: June 04, 2009, 10:51:47 pm »
Quote
What's wrong with CGI?

Don't waste your time with Pascal and CGI. It's to fast ! I always have to check and check again to make sure that it did execute. And with the Powtils it's just to easy ! You will not feel as satisfied as you would be with some other languages. Pascal is just TOOOOOOOO productive.

So once again, ....
Don't use it !  >:D
Stay FAAAAAAAr away !  >:(

Regards
  RudieD
 :P :P :P
The FRED Trainer. (Training FRED with Lazarus/FPC)

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Re: Web Development
« Reply #9 on: June 05, 2009, 07:05:21 am »
I used to run a site with the Apache web server calling PHP scripts to generate the user interface, Perl scripts to parse text files, and a FreePascal console program to read GET parameters as command line arguments, solve a system of equations, and store the results in a MySQL database. It was extremely reliable and fast.
Lazarus/FPC on Linux

bee

  • Sr. Member
  • ****
  • Posts: 393
Re: Web Development
« Reply #10 on: June 05, 2009, 01:03:41 pm »
I used to run a site with the Apache web server calling PHP scripts to generate the user interface, Perl scripts to parse text files, and a FreePascal console program to read GET parameters as command line arguments, solve a system of equations, and store the results in a MySQL database. It was extremely reliable and fast.

Congratulations! You had just created another code maintenance nightmare! If you are able to do all of them in a single language (whatever your favorite language is), I suggest you to use that language. Unless, you have a very strong technical reason to do otherwise. ;)

Have you consider how hard your server work by using many interpreted programs within a single application? It would be ignorable if your application is being accessed by only a few users. What's the problem if you write them all in single native language (pascal)? I believe all those tasks are very easy to be done in pascal.

-Bee-

A long time pascal lover.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Web Development
« Reply #11 on: June 05, 2009, 07:39:58 pm »
Let me say I'm sort of a convert to CGI done with Pascal, largely on the strength of Wanderlan's ExtPascal project (http://code.google.com/p/extpascal/).

The only advantages I can see in working with a scripting language like PHP is that it's generally easier to deploy. Many ISP's, employers and "free" Web hosting services don't permit access to the cgi-bin folder on their servers. While this doesn't affect your development locally on your own computer, it might be a nuisance later to discover that your existing Web site won't do, meaning a change in URL and a small expense for a paid service could be necessary.

The other advantage to PHP, etc. is that when deploying you don't have to worry about what OS the server is running, whereas with CGI you'll have to compile for a specific OS target, typically Linux.

It might be useful if forum readers could post URL's of inexpensive Web hosting services that permit CGI apps which could be used for demo purpose and testing the deployment of CGI apps.

With ExtPascal, I think we have a CGI approach that represents one of those watershed or breakthrough moments. At its heart is the commercial, dual licensed Ext JS, which is one of the most popular and most attractive looking JavaScript Web widgetsets available. What do I mean by a "JavaScript Web widgetset"? Generally this means a set of visual classes written in JavaScript that are sent as source code to your browser by the Web server. These classes implement the buttons and other controls that you program and that the user interacts with in the browser. Since JavaScript is sent as source code, the .js files are usually pretty unreadable since all white space has been stripped out to shrink the files. However, Ext JS includes "debug" versions that, while not documented, at least include whitespace and line breaks and can be read as normal source files.

I'm glad Ext JS is commerical. This means it's not going to just disappear or fade into uselessness like to so many open source efforts.

I also like the way that there isn't really much code supplied with ExtPascal. All the Pascal wrapper classes for the Ext JS widgets (TExtWindow, TExtButton, etc.) are auto-generated. This is really a great idea because it means that there's so much less source that has to be maintained. Wanderlan's code generator (that you run just once to create the wrapper class source files) is only a few thousand lines of code.

The ExtPascal wrapper classes also emit almost all of the JavaScript, so you don't have to write much JavaScript yourself, although you can if you want. For example, when you instantiate a TExtButton class and set some of its properties, at runtime this results in a big JavaScript "new" constructor that actually creates the JS object. In addition to the base widgetset .js files that are sent when the page is first loaded, the browser will also receive this JavaScript that's created on the fly.

Probably the only thing missing from ExtPascal is a visual designer. Right now, that's probably an advantage of a product like Delphi for PHP. Not only does it have a VCL for PHP class library (PHP classes that wrap the underlying qooxdoo JavaScript widgetset similar to the way ExtPascal wraps Ext JS), it also has a visual form designer that will be familiar to any Delphi or Lazarus user. However, that's where the similarities to Delphi and Lazarus end. Once you start coding in Delphi for PHP you realize quickly that you're in a different world. Not only are you writing both PHP and JavaScript code, but you're putting the code in the same file. The PHP code you write is only executed on the server and the JavaScript code you write is only executed in the browser, yet they're in the same file. And the order in which they're executed isn't obvious. Looking at the postings on the Delphi for PHP forum shows that this absolutely stumps most developers at first.

Other issues with PHP, etc. that you only run into later include the fact that you can't use your normal debugger with these languages since they're scripting languages. With ExtPascal and Lazarus you just use your normal gdb.

What I've been working on is a set of LCL/VCL-based "design" controls that can be used with Lazarus and Delphi to visually design ExtPascal forms. One of my goals is to write as little code as possible, so the design controls are just wrappers of TCustomForm, TCustomButton, etc. and the source for them is all auto-generated. One of the problems with so many open source projects is the sheer volume of code involved. Many developers seem to be as happy as pigs wallowing in all that code, but at some point, almost by definition, if the project doesn't magically attract other developers and grow and stabilize, it _will_ reach a crisis point when the original author is no longer able to maintain and advance the project. By writing less code, the seriousness of this crisis when it comes can be reduced.

If you haven't tried out ExtPascal, you really should. If you have a Mac, Apache is already pre-installed and all you have to do is turn it on, so there shouldn't be any reason for not at least exploring CGI development with ExtPascal. And if you want to go the next step and install the Lazarus project package and design control package that I threw together, I think you'll be pleasantly surprised at what this adds to ExtPascal:

- Once the project and design control packages have been installed in Lazarus, just choose File | New | ExtPascal Application to create a new ExtPascal project. This immediately gives a structure to your project that should be familiar - that is, it's almost exactly the same as an LCL application. If you look at Wanderlan's ExtPascalSamples.dpr you might be dismayed by its jumbled structure, but this file is really intended as a way to demo and exercise many of the Ext JS widgets, not as an example of how you should structure your projects.

- Designing the ExtPascal forms visually and setting properties means you don't have to know very much about Ext JS. Although Ext JS is well documented (http://extjs.com/deploy/dev/docs/), this _is_ JavaScript documentation, not Pascal documentation. For example, to set a combo box's items, you'll find in the JS docs that you do this by setting the combo box's "store" array. In Pascal, this would be something like this (from Wanderlan's example):

StoreArray := JSArray('"Shade", "Mostly Shady", "Sun or Shade", "Mostly Sunny", "Sunny"');

However, if you use the TExtFormCombo in Lazarus, you set the StoreArray property in Object Inspector using the familiar strings editor dialog just like you use with TComboBox.

Thanks.

-Phil

bee

  • Sr. Member
  • ****
  • Posts: 393
Re: Web Development
« Reply #12 on: June 07, 2009, 06:39:16 am »
Let me say I'm sort of a convert to CGI done with Pascal, largely on the strength of Wanderlan's ExtPascal project (http://code.google.com/p/extpascal/).

I used to be a user of Powtils. But since I found ExtPascal and it became quite stable, slowly but sure I moved to ExtPascal. Moreover since ExtPascal provided CGI gateway (which I requested for), I could combine Powtils (CGI) and ExtPascal (FCGI).

The only advantages I can see in working with a scripting language like PHP is that it's generally easier to deploy. The other advantage to PHP, etc. is that when deploying you don't have to worry about what OS the server is running, whereas with CGI you'll have to compile for a specific OS target, typically Linux.

With a bit of extra efforts, through cross compilation and some shell scripting, deploying pascal web application could be as easy as PHP script.

It might be useful if forum readers could post URL's of inexpensive Web hosting services that permit CGI apps which could be used for demo purpose and testing the deployment of CGI apps.

AFAIK, most web hosting providers provide CGI as standard/common feature, even on free ones, though every provider has different restrictions. However, I don't think we could deploy a FCGI application (ExtPascal) on common web hosting provider.

However, Ext JS includes "debug" versions that, while not documented, at least include whitespace and line breaks and can be read as normal source files.

I had contributed JS and CSS beautifier (new line, indentation, etc) for ExtPascal that would be run on $DEBUG_JS mode. It's very helpful and handy when we need to debug the generated JS codes (through Firebug). I've been waiting for it to be merged into official ExtPascal SVN repository.

Probably the only thing missing from ExtPascal is a visual designer.

We could also use ExtJS GUI designer after it's released on v.3.1. Yes, it's not as rich as Delphi or Lazarus but its designer feature is quite sophisticated.

With ExtPascal and Lazarus you just use your normal gdb.

Being able to debug ExtPascal application as if it's a normal (desktop) application is a huge advantage to me. Plus, due to FCGI nature, I no longer need to manage cookies and sessions as they can be represented as normal variables.

What I've been working on is a set of LCL/VCL-based "design" controls that can be used with Lazarus and Delphi to visually design ExtPascal forms. One of my goals is to write as little code as possible, so the design controls are just wrappers of TCustomForm, TCustomButton, etc. and the source for them is all auto-generated.

Though I haven't use your tool but I do appreciate it and I believe it'd be very helpful to other people. I haven't yet use it because my web application isn't "window"-based. While by using your tool an approach, it obligates ExtPascal application to be "window"-based, as like desktop application build using Delphi or Lazarus.

In Pascal, this would be something like this (from Wanderlan's example):
StoreArray := JSArray('"Shade", "Mostly Shady", "Sun or Shade", "Mostly Sunny", "Sunny"');

FPC also provides fpJSON that can be used with ExtPascal. :)
-Bee-

A long time pascal lover.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Web Development
« Reply #13 on: June 07, 2009, 05:47:04 pm »
With a bit of extra efforts, through cross compilation and some shell scripting, deploying pascal web application could be as easy as PHP script.
Yes, some additional documentation would be helpful.

I had contributed JS and CSS beautifier (new line, indentation, etc) for ExtPascal that would be run on $DEBUG_JS mode. It's very helpful and handy when we need to debug the generated JS codes (through Firebug). I've been waiting for it to be merged into official ExtPascal SVN repository.
That would be very useful! I compile with DebugJs defined. Currently I think all that does is switch to use the debug .js files of Ext JS, but if it could also make the page source more readable, that would be great.

We could also use ExtJS GUI designer after it's released on v.3.1. Yes, it's not as rich as Delphi or Lazarus but its designer feature is quite sophisticated.
Although I assume that the Ext JS designer will generate JavaScript, not Pascal.

Though I haven't use your tool but I do appreciate it and I believe it'd be very helpful to other people. I haven't yet use it because my web application isn't "window"-based. While by using your tool an approach, it obligates ExtPascal application to be "window"-based, as like desktop application build using Delphi or Lazarus.
What layout do you use? I haven't worked through all the various layouts, but it would seem that they could be supported similar to the way Delphi for PHP supports different layouts in a pixel-based designer.

Also, it's worth pointing out the obvious that another use for the IDE is not just visually laying out controls, but also making non-visual things easier - setting properties, creating controls properly, etc. It's not obvious how to use some of the ExtPascal controls and properties or what they correspond to in other frameworks (VCL/LCL). By capturing this knowledge and making it part of the IDE, users won't have to waste time working through examples trying to figure out how to simple things.

Thanks for your comments.

-Phil

bee

  • Sr. Member
  • ****
  • Posts: 393
Re: Web Development
« Reply #14 on: June 08, 2009, 03:32:22 am »
That would be very useful! I compile with DebugJs defined. Currently I think all that does is switch to use the debug .js files of Ext JS, but if it could also make the page source more readable, that would be great.

I had given my modified ExtPascal source code to Wanderlan since a while ago. I gave it to the project author not to public (like you did) because I did also some modification to the base code. But, if you're interested I could send you the source code, especially the beautifier part.

What layout do you use? I haven't worked through all the various layouts, but it would seem that they could be supported similar to the way Delphi for PHP supports different layouts in a pixel-based designer.

Mostly fit layout and I avoid pixel based layout for common web application. Unless I made some kind of eyeOS-like environment for my application.

Also, it's worth pointing out the obvious that another use for the IDE is not just visually laying out controls, but also making non-visual things easier - setting properties, creating controls properly, etc. It's not obvious how to use some of the ExtPascal controls and properties or what they correspond to in other frameworks (VCL/LCL). By capturing this knowledge and making it part of the IDE, users won't have to waste time working through examples trying to figure out how to simple things.

Agree.

-Bee-

A long time pascal lover.

 

TinyPortal © 2005-2018