HMGSCRIPT 2012: Programming For The Web in The Right Way :)

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

luisfrancisco62 wrote:genial, gracias desde colombia, como seria con una ventana de login? y una funcion para menu?

gracias muchas gracias
Ya es posible hacerlo con los elementos existentes.

En este momento he suspendido el trabajo por unos días, ya que no tengo tiempo disponible. En cuando pueda retomarlo, agregaré ejemplos.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

HMGSCRIPT R019

I've added some nice things to browse and made some modifications to server functions (created JS wrappers for some of them).

Code: Select all

BROWSE:
-------

Elements: DIV/TABLE

Creates an HTML table inside a scrollable DIV, loaded with the specified dbf query.

Syntax:

	Browse( cId, cParentId, nRow, nCol, nWidth, nHeight, cDbfFile, aColumns, 
	aHeaders , cForExpr , cOrder  )

Methods:

	- refresh()
	- GetSelectedRows()
	- GetRowCount()
	- Select()
	- UnSelect()
	- GetCell(nRow,nCount)


Notes:

	'cId' is the id of the HTML table created (to be accessed via DOM).
	'cParentId' is the Id of the parent window.
Moreover, I'm thinking in deep changes regarding communication with the server, since asynchronous logic is *very* counter-intuitive and a true mess when the application gets more complex.

I'm exploring alternatives like synchronous AJAX and function sequencers to find a way to get ride of callbacks.
Attachments
hmgs019.zip
(843.29 KiB) Downloaded 335 times
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5481
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Rathinagiri »

That is so nice of you Roberto.

I am in the process of creating a simple connection/query mechanism for MySQL tables that can be easily extended to SQLite and PostgreSQL..
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

rathinagiri wrote:That is so nice of you Roberto.

I am in the process of creating a simple connection/query mechanism for MySQL tables that can be easily extended to SQLite and PostgreSQL..
very interesting...

By the moment, I'll stop the development on websockets direction.

I'll borrow some of the code of the original HMGSCRIPT using synchronous AJAX and blending with current code.

This will have (theoretically) various advantages:

1. We could use any standard http server.

2. The server could be a Harbour based like the one included with the Harbour distribution (so, we could have server based Harbour routines).

3. Using synchronous AJAX (SJAX to be precise) our applications should be more inline with the xBase logic (no callbacks).

The question that many of you are thinking on is: Why to return to AJAX when websockets supposedly have a lot of advantages?

Well... because there is a big difference between knowing the path and walk it :)

I've walked websockets and I've learned that it has a lot of advantages and a lot of disadvantages too, the most important one, the lack of synchronous calls (I've tried to simulate without success).

Moreover, I guess that is very possible that the most effective solution be a mixed (Websockets and synchronous AJAX) one.

When some interesting happen, I'll post the code here!
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

HMGSCRIPT R20

I've replaced the websockets server with the uhttpd server from Harbour distribution, so the protocol used now is http.

The server calls are now synchronous AJAX, so server functions will execute synchronously (no need for callbacks) then we can write our applications using the same logic as xBase ones.

This is the new readme:

Code: Select all

How to Start:
-------------

1. Start the server (start.server.bat).

2. Open a web browser.

3. Go to localhost (demo server will be automatically loaded).

Notes:
------

- The public html files are in the www folder.

- The Harbour modules sources are in modules folder (you can compile to .hrb 
  running build.modules.bat).

- To know how to call modules, pass parameters to them from JavaScript and handle returned
  data, please, take a look at the library source (www/lib/hmgscript.core.js).

- uhttpd server source code is included in Harbour distribution (examples/httpsrv).
Enjoy!
Attachments
hmgs020.zip
(1.42 MiB) Downloaded 326 times
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5481
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Rathinagiri »

Thank you Roberto.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

HMGSCRIPT R021

In this release, the aValues array used as parameter for Append and Modify functions, supports number, boolean and date JavaScript types (besides string). The elements are converted to Harbour types prior to send them to the server.

For custom server procedures, please, take a look at sources for information about how to handle parameters (it is really easy).

The next steps:

1. Add security.
2. Create adequate methods to handle current widgets more easily.
3. Add most used missing widgets (combo, list, editbox and radio) with basic methods.

Then... will be ready...

As you can see in the browse sample, adding methods to it has made very simple and intuitive to handle. Besides that, I'm trying to use methods names that be very clear and self explanatory to make the learning process easier. I'll follow that policy on the other widgets.

Enjoy!
Attachments
hmgs021.zip
(1.42 MiB) Downloaded 375 times
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Rossine
Posts: 87
Joined: Thu Jun 30, 2011 10:04 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Rossine »

Hi Roberto,

When I execute uhttpd.exe, he starts and ends execution.

What can be ?

Thank you very much for this new world ;)

Best Regards,

Rossine.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

Rossine wrote:Hi Roberto,

When I execute uhttpd.exe, he starts and ends execution.

What can be ?

Thank you very much for this new world ;)

Best Regards,

Rossine.
It is the original (untouched) version distributed with Harbour.

The only thing that should happen is that Windows firewall ask for permission for it, that's all.

It is pre-configured to use port 80, if you have other server there, it could cause problems.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Rossine
Posts: 87
Joined: Thu Jun 30, 2011 10:04 pm

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Post by Rossine »

Hi Roberto,
It is the original (untouched) version distributed with Harbour.

The only thing that should happen is that Windows firewall ask for permission for it, that's all.

It is pre-configured to use port 80, if you have other server there, it could cause problems.
Yes, you is corret. :)

I change uhttpd.ini port for "Port = 2000"

and execute in firefox this address: "http://localhost:2000/" and work´s fine

Best Regards,

Rossine.
Post Reply