Discussion:
WebPage support in Gambas
(too old to reply)
Benoît Minisini
2012-03-18 13:29:23 UTC
Permalink
Hi,

In revision #4561, Gambas compiler now can compile WebPage.

---- What is a WebPage ?

WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.

It generates an HTML page from an HTML template having an ASP-like syntax.

A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.

At the moment, the following syntaxes are implemented:

<% Code %>

This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.

<%= Expression %>

This evaluates Expression and convert it to HTML with the
Html$() function.

For example:

<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>

---- How does it work internally?

The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.

---- So now?

Let's talk about what kind of useful syntax could be implemented!

I think that every template syntax should be enclosed by '<%' and '%>'.

I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.

Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!

Regards,
--
Benoît Minisini
Emil Lenngren
2012-03-18 14:40:52 UTC
Permalink
Looks interesting!
What's up next? Gambas.net framework with webforms? ;)
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like syntax.
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
--
Benoît Minisini
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
John Spikowski
2012-03-18 14:45:18 UTC
Permalink
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like syntax.
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
Looks sort of like PHP to me. ScriptBasic uses a preprocessor to
generate HTML pages from templates and 'form' variable tags.

I hate PHP but almost all widely used applications out there are based
on it. (security nightmare)

Personally I would like to see Gambas be able to create a desktop
application I can install easily and without the development tools
before you wonder off to the web side of Gambas.
Emil Lenngren
2012-03-18 14:54:57 UTC
Permalink
You don't need the development tools to install a desktop application?
Post by Benoît Minisini
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like
syntax.
Post by Benoît Minisini
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
Looks sort of like PHP to me. ScriptBasic uses a preprocessor to
generate HTML pages from templates and 'form' variable tags.
I hate PHP but almost all widely used applications out there are based
on it. (security nightmare)
Personally I would like to see Gambas be able to create a desktop
application I can install easily and without the development tools
before you wonder off to the web side of Gambas.
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
Olivier Cruilles
2012-03-18 15:00:10 UTC
Permalink
It's exact, you don't need to install all the development environment but just
create the executable of your application and install the runtime + all components you use
in your project. That's all.

Olivier Cruilles
Post by Emil Lenngren
You don't need the development tools to install a desktop application?
Post by Benoît Minisini
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like
syntax.
Post by Benoît Minisini
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
Looks sort of like PHP to me. ScriptBasic uses a preprocessor to
generate HTML pages from templates and 'form' variable tags.
I hate PHP but almost all widely used applications out there are based
on it. (security nightmare)
Personally I would like to see Gambas be able to create a desktop
application I can install easily and without the development tools
before you wonder off to the web side of Gambas.
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
Olivier Cruilles
2012-03-18 15:26:31 UTC
Permalink
To beginning, from what version you develop your application, from the svn version or official package of your
distribution ?

In normal time, your create a package .deb from the IDE of Gambas by using the package menu
and you sent it to the second machine and install it.

To install it on the Ubuntu distrib, use the 'gdebi' command to resolv all dependencies during installation of your package.

You can meet problems if the versions of both machines are to many different and when you will install your package, the system
will inform you that you haven't the right version of Gambas3 on the depot of Ubuntu and refuse to install it.


Olivier Cruilles
Post by Olivier Cruilles
It's exact, you don't need to install all the development environment but just
create the executable of your application and install the runtime + all components you use
in your project. That's all.
Olivier Cruilles
Post by Emil Lenngren
You don't need the development tools to install a desktop application?
Post by Benoît Minisini
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like
syntax.
Post by Benoît Minisini
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
Looks sort of like PHP to me. ScriptBasic uses a preprocessor to
generate HTML pages from templates and 'form' variable tags.
I hate PHP but almost all widely used applications out there are based
on it. (security nightmare)
Personally I would like to see Gambas be able to create a desktop
application I can install easily and without the development tools
before you wonder off to the web side of Gambas.
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
John Spikowski
2012-03-18 15:11:46 UTC
Permalink
Post by Emil Lenngren
You don't need the development tools to install a desktop application?
If I created a 'Hello World' Qt dialog and want to send it to a friend
that has a virgin Ubuntu install. What would I need to send him?
Rob Kudla
2012-03-18 16:58:09 UTC
Permalink
Post by John Spikowski
Post by Emil Lenngren
You don't need the development tools to install a desktop application?
If I created a 'Hello World' Qt dialog and want to send it to a friend
that has a virgin Ubuntu install. What would I need to send him?
The .deb package you create in the IDE. Its dependencies will include
the Gambas runtime, not the whole IDE. He should just be able to
double-click the package (or whatever the equivalent Unity action is...
maybe caress it gently? I dunno, I switched to Xubuntu) and have the OS
install what's needed.

Rob
John Spikowski
2012-03-18 17:16:47 UTC
Permalink
Post by Rob Kudla
Post by John Spikowski
Post by Emil Lenngren
You don't need the development tools to install a desktop application?
If I created a 'Hello World' Qt dialog and want to send it to a friend
that has a virgin Ubuntu install. What would I need to send him?
The .deb package you create in the IDE. Its dependencies will include
the Gambas runtime, not the whole IDE. He should just be able to
double-click the package (or whatever the equivalent Unity action is...
maybe caress it gently? I dunno, I switched to Xubuntu) and have the OS
install what's needed.
Rob
I have found that it is more difficult to get folks to try your software
if it means needing admin privileges and installing frameworks not used
by any other applications. I would guess the best approach would be is
to use Gtk components for a demo version of your application which would
minimize the install time of dependencies. How big is the Gambas
runtime?
Emil Lenngren
2012-03-18 18:04:44 UTC
Permalink
It is only a few megabytes.
Compare that to Java, .NET, ruby, glibc, libstdc++ and so on.

It is not any strange that gambas has a runtime environment that takes up
some space...

You maybe want to have self-unpacking executable files that contains a
minimal runtime?
Post by John Spikowski
Post by Rob Kudla
Post by John Spikowski
Post by Emil Lenngren
You don't need the development tools to install a desktop application?
If I created a 'Hello World' Qt dialog and want to send it to a friend
that has a virgin Ubuntu install. What would I need to send him?
The .deb package you create in the IDE. Its dependencies will include
the Gambas runtime, not the whole IDE. He should just be able to
double-click the package (or whatever the equivalent Unity action is...
maybe caress it gently? I dunno, I switched to Xubuntu) and have the OS
install what's needed.
Rob
I have found that it is more difficult to get folks to try your software
if it means needing admin privileges and installing frameworks not used
by any other applications. I would guess the best approach would be is
to use Gtk components for a demo version of your application which would
minimize the install time of dependencies. How big is the Gambas
runtime?
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
Rob Kudla
2012-03-19 16:31:35 UTC
Permalink
Post by John Spikowski
I have found that it is more difficult to get folks to try your software
if it means needing admin privileges and installing frameworks not used
by any other applications. I would guess the best approach would be is
To be honest, that's largely why I develop primarily for the web now.
All the end user needs is a 0-3 year old web browser, or if I design
carefully, a smartphone or tablet.

The only solutions you have for a single-file stand-alone program under
Linux are a statically linked C/C++ app (which will be enormous) or
something with a self-contained app wrapper like tcl/tk (which is awful
to program in, and will make your app look like it came with Windows
95). I remember efforts to make statically linked versions of Python and
Ruby for this purpose, but I imagine for graphical apps you'd run into
the same dependency issues as Gambas.
Post by John Spikowski
to use Gtk components for a demo version of your application which would
minimize the install time of dependencies. How big is the Gambas
runtime?
$ time sudo apt-get install gambas2-runtime
[...]
The following NEW packages will be installed:
gambas2-runtime
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 193 kB of archives.
After this operation, 602 kB of additional disk space will be used.

So you're correct, the bulk of the dependencies will be the components.
On the other hand, on my system, "apt-get install gambas2-ide" wants to
install 15.2MB of packages totaling 50MB when uncompressed. Most of it
seems to be Qt.

Rob
John Spikowski
2012-03-19 16:50:24 UTC
Permalink
Post by Rob Kudla
Post by John Spikowski
I have found that it is more difficult to get folks to try your software
if it means needing admin privileges and installing frameworks not used
by any other applications. I would guess the best approach would be is
To be honest, that's largely why I develop primarily for the web now.
All the end user needs is a 0-3 year old web browser, or if I design
carefully, a smartphone or tablet.
The only solutions you have for a single-file stand-alone program under
Linux are a statically linked C/C++ app (which will be enormous) or
something with a self-contained app wrapper like tcl/tk (which is awful
to program in, and will make your app look like it came with Windows
95). I remember efforts to make statically linked versions of Python and
Ruby for this purpose, but I imagine for graphical apps you'd run into
the same dependency issues as Gambas.
Post by John Spikowski
to use Gtk components for a demo version of your application which would
minimize the install time of dependencies. How big is the Gambas
runtime?
$ time sudo apt-get install gambas2-runtime
[...]
gambas2-runtime
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 193 kB of archives.
After this operation, 602 kB of additional disk space will be used.
So you're correct, the bulk of the dependencies will be the components.
On the other hand, on my system, "apt-get install gambas2-ide" wants to
install 15.2MB of packages totaling 50MB when uncompressed. Most of it
seems to be Qt.
Rob
I think it's great that a language as rich in features as Gambas is
flexible enough to server up web pages as well.

ScriptBasic is less then 500KB, can run in a single process as a
multi-threaded web server (with in memory session support) which works
really well with the new web paradigm. (AJAX) ScriptBasic is already
running and waiting for requests which are handled with pre-compiled
(tokenized) scripts. An efficient client / server environment is
paramount if dynamic applications is your web goal. If all you care
about is displaying static pages, pretty much anything will do.
Rob Kudla
2012-03-19 17:16:57 UTC
Permalink
Post by John Spikowski
(tokenized) scripts. An efficient client / server environment is
paramount if dynamic applications is your web goal. If all you care
about is displaying static pages, pretty much anything will do.
You're right, and while Gambas doesn't have its own built-in web server
(as far as I know, though it'd be about 10 lines of code to write a
simple single-purpose one), it works fine with thttpd or lighttpd or any
other small-footprint server that implements CGI. As do perl, ruby and
the other CGI options, as well as your own ScriptBasic.

What Gambas currently lacks and the others have (don't know about
Scriptbasic, but there are many for perl and ruby, the best known being
Ruby on Rails) is a framework for writing rich web apps using jQuery and
similar tools, which is what I was proposing in my earlier post on the
topic.

Getting back to your original question, how do you handle distributing
the ScriptBasic interpreter to people? I can't find it in the Ubuntu
repositories; do you provide some kind of single-file executable
functionality?

Rob
John Spikowski
2012-03-19 18:47:34 UTC
Permalink
Post by Rob Kudla
Getting back to your original question, how do you handle distributing
the ScriptBasic interpreter to people? I can't find it in the Ubuntu
repositories; do you provide some kind of single-file executable
functionality?
Rob
You can download pre-compiled binaries and source from the ScriptBasic
project site. There is a 32/64 bit Ubuntu .deb install on the site.

http://www.scriptbasic.org

ScriptBasic runs on Windows, Linux and OS X. (32/64 bit)
Emil Lenngren
2012-03-19 17:33:24 UTC
Permalink
Why can't anyone write a real web server for gambas that does not use CGI?
Then the runtime does not have to be restarted on each request. But maybe
it is a problem because gambas does not really support multi-threading?
Post by John Spikowski
Post by Rob Kudla
Post by John Spikowski
I have found that it is more difficult to get folks to try your
software
Post by Rob Kudla
Post by John Spikowski
if it means needing admin privileges and installing frameworks not used
by any other applications. I would guess the best approach would be is
To be honest, that's largely why I develop primarily for the web now.
All the end user needs is a 0-3 year old web browser, or if I design
carefully, a smartphone or tablet.
The only solutions you have for a single-file stand-alone program under
Linux are a statically linked C/C++ app (which will be enormous) or
something with a self-contained app wrapper like tcl/tk (which is awful
to program in, and will make your app look like it came with Windows
95). I remember efforts to make statically linked versions of Python and
Ruby for this purpose, but I imagine for graphical apps you'd run into
the same dependency issues as Gambas.
Post by John Spikowski
to use Gtk components for a demo version of your application which
would
Post by Rob Kudla
Post by John Spikowski
minimize the install time of dependencies. How big is the Gambas
runtime?
$ time sudo apt-get install gambas2-runtime
[...]
gambas2-runtime
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 193 kB of archives.
After this operation, 602 kB of additional disk space will be used.
So you're correct, the bulk of the dependencies will be the components.
On the other hand, on my system, "apt-get install gambas2-ide" wants to
install 15.2MB of packages totaling 50MB when uncompressed. Most of it
seems to be Qt.
Rob
I think it's great that a language as rich in features as Gambas is
flexible enough to server up web pages as well.
ScriptBasic is less then 500KB, can run in a single process as a
multi-threaded web server (with in memory session support) which works
really well with the new web paradigm. (AJAX) ScriptBasic is already
running and waiting for requests which are handled with pre-compiled
(tokenized) scripts. An efficient client / server environment is
paramount if dynamic applications is your web goal. If all you care
about is displaying static pages, pretty much anything will do.
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
Rob Kudla
2012-03-18 16:52:41 UTC
Permalink
Post by Benoît Minisini
Nothing is engraved in the marble (french expression),
The equivalent English phrase is "etched in stone", so pretty close.
Post by Benoît Minisini
so please tell what you think about that, and if you have ideas!
I started separating the code from the markup in my web apps about 10
years ago, but many will still want something analogous to ASP/PHP.
Congratulations on getting it working.

A few years back, when it first became possible to write Gambas CGIs, I
started working on a Gambas library with companion Javascript library to
essentially render Gambas forms as web pages, and handle events through
AJAX, using Javascript to render the form in the browser and Gambas to
do all the actual processing. I ended up abandoning the project because
I needed to get something done right away and I was doing all the
Javascript from scratch.

These days, though, something like jQuery on the browser side would make
such a thing much easier to implement in a RESTful way, allowing modern
HTML5 apps to be written (at least on the server side) in Gambas. You
could have essentially a Gambas jQuery plugin that does nothing but pass
events to the server side using $.ajax, but allow advanced users to
insert their own Javascript code if they wanted to do any extra
validation or effects or whatever. With some kind of JSON message
passing convention and a centralized Javascript event dispatcher, you
could have events trigger other events, have timers, etc., just like a
native Gambas form, but in an HTML5 page that looks like any other web
app. I could probably help you write the Javascript side of that, if
nothing else.

Maintaining state on the server side would be more difficult (unless you
used keep-alive to do everything over one connection) but web
programmers are used to dealing with state issues, or at least they
should be.

To integrate it fully into the Gambas IDE might be more work than anyone
is willing to do, though.

Rob
John Spikowski
2012-03-18 17:09:47 UTC
Permalink
Post by Rob Kudla
To integrate it fully into the Gambas IDE might be more work than anyone
is willing to do, though.
What is the overhead of using Gambas as a CGI scripting engine?

Keep in mind that each request is a new Gambas session and all that goes
with it to get to the point a script can be interpreted. PHP is a 8 MB
interpreter (file size) and waking up that monster is not pain
(resource) free.
Benoît Minisini
2012-03-18 23:04:24 UTC
Permalink
Post by John Spikowski
Post by Rob Kudla
To integrate it fully into the Gambas IDE might be more work than anyone
is willing to do, though.
What is the overhead of using Gambas as a CGI scripting engine?
Keep in mind that each request is a new Gambas session and all that goes
with it to get to the point a script can be interpreted. PHP is a 8 MB
interpreter (file size) and waking up that monster is not pain
(resource) free.
I earn my life with a Gambas CGI script I made for my job. This CGI
script is actually a full web application used (among many other things)
for managing all road signs of Paris.

Running Gambas as a CGI script is fast. Only the interpreter, the
gb.web, gb.db and gb.db.sqlite3 components are loaded.

I used a tiny web server to speed up things again, and response time has
never been a problem at the moment.

Just try! :-)
--
Benoît Minisini
Rob Kudla
2012-03-19 16:46:21 UTC
Permalink
Post by John Spikowski
What is the overhead of using Gambas as a CGI scripting engine?
We've been running Gambas 1.99 as a CGI scripting engine on the
gambasdoc.org host for about 5 years now. Benoit wrote the entire Gambas
wiki in Gambas. Like other CGI languages (perl, ruby, some use cases of
php, etc.) the overhead is that the interpreter needs to start for every
page load. But you saw in my previous post how small that is. We don't
have X installed on that server, so the only Gambas component installed
is gb.db.mysql.

If anything, Gambas CGI seems to be a little faster than perl CGI,
probably because perl compiles its programs at runtime. php may be a
little faster because of mod_php, and I've used mod_perl to reduce
perl's overhead, but that introduces compatibility issues that can be
irritating if you don't remember that you have it enabled.

Last I checked, the Gambas CGIs running gambasdoc.org were serving about
25GB per month without any problems, and no one has complained about the
site's responsiveness. We had a bit of a load crunch around the release
of Gambas 3, so gambasdoc.org has its own dedicated machine now that
should be in production soon.

I don't use Gambas for my own web projects, to be honest, because I
pretty much dream in perl and am used to its modules for things like
encryption, JSON, etc. as well as its regex syntax. But Gambas is pretty
efficient as CGI languages go.

Rob
Demosthenes Koptsis
2012-03-18 22:20:24 UTC
Permalink
it is nice feature.

May i ask if we can use it with apache in the future like php ?
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like syntax.
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?");"</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
Emil Lenngren
2012-03-18 22:57:00 UTC
Permalink
If someone writes a mod_ for apache, yes ;)
Post by Demosthenes Koptsis
it is nice feature.
May i ask if we can use it with apache in the future like php ?
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like
syntax.
Post by Benoît Minisini
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?");"</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
nando
2012-03-18 23:15:21 UTC
Permalink
If you wanted to know, an English term for

Nothing is engraved in the marble

would be

Nothing is etched in stone.

===

One thing I am thinking right off the top is
the equivalent to sessions in PHP
where a specific folder on the server holds
something equivalent that is sent by the browser cookie
so I can get variables associated with the browser sessioin.

You may want to populate a collection or variant array of stuff in such a case
to be available for inspection

Something like...

DIM b AS NEW VARIANT[]
b = SESSION()

-Fernando



---------- Original Message -----------
From: Benoît Minisini <***@users.sourceforge.net>
To: mailing list for gambas users <gambas-***@lists.sourceforge.net>
Sent: Sun, 18 Mar 2012 14:29:23 +0100
Subject: [Gambas-user] WebPage support in Gambas
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like syntax.
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
--
Benoît Minisini
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------
Benoît Minisini
2012-03-18 23:40:17 UTC
Permalink
Post by nando
If you wanted to know, an English term for
Nothing is engraved in the marble
would be
Nothing is etched in stone.
===
One thing I am thinking right off the top is
the equivalent to sessions in PHP
where a specific folder on the server holds
something equivalent that is sent by the browser cookie
so I can get variables associated with the browser sessioin.
You may want to populate a collection or variant array of stuff in such a case
to be available for inspection
Something like...
DIM b AS NEW VARIANT[]
b = SESSION()
-Fernando
All that is in Gambas from years. Look at the gb.web documentation!

Regards,
--
Benoît Minisini
nando
2012-03-19 06:22:54 UTC
Permalink
Thank you!!!
I'm going to migrate
Thank you Benoit


---------- Original Message -----------
From: Benoît Minisini <***@users.sourceforge.net>
To: ***@nothingsimple.com, mailing list for gambas users
<gambas-***@lists.sourceforge.net>
Sent: Mon, 19 Mar 2012 00:40:17 +0100
Subject: Re: [Gambas-user] WebPage support in Gambas
Post by Benoît Minisini
Post by nando
If you wanted to know, an English term for
Nothing is engraved in the marble
would be
Nothing is etched in stone.
===
One thing I am thinking right off the top is
the equivalent to sessions in PHP
where a specific folder on the server holds
something equivalent that is sent by the browser cookie
so I can get variables associated with the browser sessioin.
You may want to populate a collection or variant array of stuff in such a case
to be available for inspection
Something like...
DIM b AS NEW VARIANT[]
b = SESSION()
-Fernando
All that is in Gambas from years. Look at the gb.web documentation!
Regards,
--
Benoît Minisini
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------
Fabien Bodard
2012-03-19 13:27:30 UTC
Permalink
Post by nando
Thank you!!!
I'm going to migrate
Thank you Benoit
---------- Original Message -----------
Sent: Mon, 19 Mar 2012 00:40:17 +0100
Subject: Re: [Gambas-user] WebPage support in Gambas
Post by Benoît Minisini
Post by nando
If you wanted to know, an English term for
    Nothing is engraved in the marble
would be
    Nothing is etched in stone.
===
One thing I am thinking right off the top is
the equivalent to sessions in PHP
where a specific folder on the server holds
something equivalent that is sent by the browser cookie
so I can get variables associated with the browser sessioin.
You may want to populate a collection or variant array of stuff in such a case
to be available for inspection
Something like...
DIM b AS NEW VARIANT[]
b = SESSION()
-Fernando
Another gambas cgi :

http://gambasforge.org

This site have a gambas mail deamon based on gb.smtp, a chat deamon
that is a bridge between an external irc server and a websocket
server(in gambas too)
, and the site cgi. The site is writted using a special DOM component
that is a clone of the js HTML DOM tree


The source are here :
http://sourceforge.net/projects/gambasforge/?source=directory
you can found the dom component here :

http://gambasforge.org/code-41-gbhtml.html
Post by nando
Post by Benoît Minisini
All that is in Gambas from years. Look at the gb.web documentation!
Regards,
--
Benoît Minisini
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------
------------------------------------------------------------------------------
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
--
Fabien Bodard
jm
2012-03-20 09:57:35 UTC
Permalink
Post by Benoît Minisini
Hi,
In revision #4561, Gambas compiler now can compile WebPage.
---- What is a WebPage ?
WebPage is a new "form" type that you enable in the IDE by using the
'gb.web' component.
It generates an HTML page from an HTML template having an ASP-like syntax.
A WebPage has two parts: a "class" part (like forms) stored in a *.class
file, and an HTML template part stored in a *.webpage file. The HTML
part is edited with a standard text editor.
<% Code %>
This introduces Gambas code inside the HTML page. Use the
PRINT instruction to generate some HTML directly.
<%= Expression %>
This evaluates Expression and convert it to HTML with the
Html$() function.
<html>
<body>
<%Dim sEnv As String%>
<h2>Environment</h2>
<table>
<%For Each sEnv In Application.Env%>
<tr>
<td><%=sEnv%></td>
<td><%=Application.Env[sEnv]%></rd>
</tr>
<%Next%>
</table>
<%
Print "<p>"; Html("Cool isn't it?"); "</p>"
%>
</body>
</html>
---- How does it work internally?
The *.webpage file is transformed by the compiler into a Render() method
added to the *.class file. This Render() methods prints the generated
HTML to the standard output.
---- So now?
Let's talk about what kind of useful syntax could be implemented!
I think that every template syntax should be enclosed by '<%' and '%>'.
I think that some sort of include is needed. For example, something like
<%{OtherWebPage}%> will be transformed into "OtherWebPage.Render()", so
that the OtherWebPage is included into the current one.
Nothing is engraved in the marble (french expression), so please tell
what you think about that, and if you have ideas!
Regards,
What about making the include <%{OtherWebPage}%>
into a C like format i.e. <% #include OtherWebPage.html %>
and the renderer cleanly snips everything between <%..%>
including the <% and %>
and replaced it with whatever is inside OtherWebPage.html

The idea is that OtherWebPage.html can then have its own <%..%>
or just plain html which can change dynamically and it doesn't
affect how it gets interpreted from the original web page.

(Both the original scheme and this scheme could co-exist. When the
interpreter sees the # it switches to this C type of include mode.)


______________________________________________________________________________
This message has been checked for viruses and spam by Corpex using
the ArmourPlate Anti Virus and Anti Spam Scanning Service.
To find out more and see our email archiving service see
http://www.armourplate.com or call Corpex on UK 0845 050 1898.
Benoît Minisini
2012-03-20 11:55:21 UTC
Permalink
What about making the include<%{OtherWebPage}%>
into a C like format i.e.<% #include OtherWebPage.html %>
and the renderer cleanly snips everything between<%..%>
including the<% and %>
and replaced it with whatever is inside OtherWebPage.html
The idea is that OtherWebPage.html can then have its own<%..%>
or just plain html which can change dynamically and it doesn't
affect how it gets interpreted from the original web page.
(Both the original scheme and this scheme could co-exist. When the
interpreter sees the # it switches to this C type of include mode.)
Including another webpage and including a normal HTML file are not the
same thing, so two different syntaxes would be needed there...
--
Benoît Minisini
Continue reading on narkive:
Loading...