HMGSCRIPT: The beginning...

Moderator: Rathinagiri

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

HMGSCRIPT: The beginning...

Post by Roberto Lopez »

Code: Select all

HMG SCRIPT PROJECT
------------------



1. PROJECT GOALS



The main project goal is to write a Harbour MiniGUI to JavaScript/HTML translator.

The translator must generate pages containing HTML+JavaScript code with equivalent functionality to the original (source) HMG program.

Because JavaScript and web browsers limitations, the translator will support only a SMALL SUBSET of current Harbour+MiniGUI features.

Data will be accessed via XmlHttpRequest object (client side). 

Server side code (returning the data to XmlHttpRequest object) will be implemented via GENERIC routines (reusable for all programs) written in PHP. 

The backend database will be MySql.



2. WHY?



IMHO, web browsers must be considered as the new 'operating systems' or 'target platforms'.

If our applications were capable to run on web browsers, then will run 
on any place on any device.

Most web browsers can run JavaScript, so the choice is obvious.

Regarding server side, I've choosen PHP+MySql because it is a worldwide standard for servers (even for free hosting providers).

Finally, the concept is already proven. Google applications works this way. The Google web toolkit, allows you to translate Java to JavaScript to create applications like those.



3. WEB SITES VS. WEB APPLICATIONS AND A TWISTED PARADIGM STORY



I will be exaggeratedly provocative on this topic... please, don't 
report as a 'bug' :)


The web was created to read static documents across a computer network, NOT AS AN APPLICATION DEVELOPMENT PLATFORM.

Across time, it was transformed (patch over patch over patch...) into 
a strange hybrid that appears to be against the programmers :) .

IMHO this paradigm is clearly a technical involution, not only because the difficulty to create applications, but because the centralized processing.

Today, even cheap/portable computers has a tremendous processing power, so, wasting it, doing application processing in centralized servers is (at least) a silly thing.

You need more and more server power, while client computers uses their tremendous processing capabilities only to show the text that you server send to them. This is a really strange thing that this appears to be 'good' and 'reasonable' for most people.

So, imagine that your application is downloaded to the client (embedded into an HTML page) and then executed into the client machine using an universal programming language available for all client computers, despite the web browser, hardware or operating system that they use. JavaScript is such language.

More important yet, is that executing your applications into the client, you can 'think' your programs in a 'natural', 'common sense' and 'easy'  way... AS IT MUST BE!!!



4. PROJECT LICENSE


GPL v2.



6. HOW TO DO IT?



My first idea was to use the Harbour preprocessor to do the job (only
preprocessor directives needed) but I've found certain problems that 
could impede its use for this project.

Basically, the problem is that attempting to generate HTML tags, the preprocessor adds unwanted spaces that makes those tags unusable.

In the case that a workaround for this can't be found, we must write a translator from the scratch.



7. GOALS FOR THE FIRST RELEASE (SUPPORTED FEATURES)



a) Numeric variables
b) String variables
c) IF...ELSE...ENDIF control structure.
d) FOR...NEXT control structure.
e) DO WHILE...ENDDO control structure.
f) Support for the following operators:	

	:= , == , >= , <= , <> , .AND. , .OR. , .NOT. , + , - , / , *

g) Basic support for the following controls:

	- TextBox
	- CheckBox
	- ComboBox
	- RadioGroup
	- Button

h) Basic support for the following functions:

	i. DataBase Functions:

		- DbCreate()
		- DbUseArea()
		- DbCloseArea()
		- DbSkip()
		- DbGoTop()
		- DbGoBottom()
		- Eof()
		- DbFieldGet()
		- DbFieldPut()
		- DbAppend()
		- DbDelete()
		- DbSetOrder()
		- DbSeek()

	ii) String Functions:

		- AllTrim()
		- Upper()
		- Lower()
		- SubStr()
		- Left()
		- Right()
		- Ltrim()
		- Rtrim()
		- Space()

	iii) Other Functions:

		- Val()
		- Str()



8. TASK LIST



I've created a preliminar task list (suggestions are welcome).


a). Harbour preprocessor tests to know if it is useful for the project 
(capable of generate JavaScript and HTML code from HMG code).

b). Research about the translator programs structure and working to 
consider the development of our own translator in the case that Harbour preprocessor can't be used.

c). From the propossed feature list, only some items has direct support in JavaScript. When direct support exists, the only work involved is to translate (ie) a Harbour function name and its parameters into its JavaScript equivalent. The goal for this task is to do a list for the proposed features with NO DIRECT SUPPORT in JavaScript. Features in that list shoud be coded as functions in JavaScript itself to be invoked in translated programs to support source (HMG) features.


Tasks Assignment:


If you are interested in pick one of them, please answer to this message, to let us know about that.

A particular task can be taken for more than one person, since in this 
stage, comparing notes and opinions between people with different 
points of view, will be a good thing.


I'll take for myself all tasks too, but I'll take it easy, since I'm 
pretty busy by these days.

Enjoy!


Roberto.
Regards/Saludos,

Roberto


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

Re: HMGSCRIPT: The beginning...

Post by Rathinagiri »

Your vision is crisp and clear.

I can do some part of it. (translating HMG functionality and JavaScript functionality).

As you had said, first let us research for the preprocessor's ability to create html tags without any problem.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4012
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT: The beginning...

Post by Roberto Lopez »

rathinagiri wrote:Your vision is crisp and clear.

I can do some part of it. (translating HMG functionality and JavaScript functionality).

As you had said, first let us research for the preprocessor's ability to create html tags without any problem.
Thanks!

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
sistemascvc
Posts: 15
Joined: Wed Aug 06, 2008 10:00 pm
Contact:

Re: HMGSCRIPT: The beginning...

Post by sistemascvc »

Harbour is capable to produce HTML and javascript code in console mode.

I tested this way with good results, and develop a little system with DBF database.

I only did use HTML only, not javascript ,but it's totally possible.

I tested in IIS with optimal results.

best regards
Ciro
User avatar
Roberto Lopez
HMG Founder
Posts: 4012
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT: The beginning...

Post by Roberto Lopez »

sistemascvc wrote:Harbour is capable to produce HTML and javascript code in console mode.

I tested this way with good results, and develop a little system with DBF database.

I only did use HTML only, not javascript ,but it's totally possible.

I tested in IIS with optimal results.

best regards
Ciro
Yes, of course, but I'm trying to use the Harbour preprocessor (HBPP.EXE), this way we have no need to write complete translator, but only a set of preprocessor directives.

In the case that this can't be done, we will write a translator using Harbour.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: HMGSCRIPT: The beginning...

Post by apais »

I'm doing some php-mysql tests on the server side.
I'm just re-reading my old php books and some other things around here.
My goal is to create a universal dispatcher for data retrieval-bridging-obfuscating from sql engine.
In few day I expect to have something visible.

Angel
Angel Pais
Web Apps consultant/architect/developer.
User avatar
Roberto Lopez
HMG Founder
Posts: 4012
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT: The beginning...

Post by Roberto Lopez »

apais wrote:I'm doing some php-mysql tests on the server side.
I'm just re-reading my old php books and some other things around here.
My goal is to create a universal dispatcher for data retrieval-bridging-obfuscating from sql engine.
In few day I expect to have something visible.

Angel
Thanks!!!

I'm developing a prototype for the translator.

It will use preprocessor directives and Harbour code.

When it be ready, I'll publish here.

Regards,

Roberto.
Regards/Saludos,

Roberto


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

Re: HMGSCRIPT: The beginning...

Post by Rathinagiri »

Thanks a LOT.

Eagerly waiting.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
raumi75
Posts: 135
Joined: Wed Dec 17, 2008 2:31 am
Location: Lünen, Germany
Contact:

Re: HMGSCRIPT: The beginning...

Post by raumi75 »

This projekt seems very ambitious. It will levarage the power our code. If you get this right, it would be the first Rapid Application Development tool for the Internet.

But I have one concern. Do I understand you right, that you want to implement all functions as Java-Script and have the Client to the work? The clients processor is mostly idle. Thats right. But when writing a three-tier-application for the internet, the bandwidth is often the limiting factor.

So there are a lot of uses, where the server should do some of the work to save bandwidth.

Control structures that use use the SEEK (or worse: LOCATE) command will cause a lot of bandwidth-overhead.

Example

Code: Select all

use customers index custid
seek 12
@ 10, 10 say customers->first_name+" "+customers->last_name
Would cause the Client to download the complete "customers"-Table to seek via Java-Script. Whereas a simple

Code: Select all

SELECT * FROM customers WHERE custid =12;
would have caused the SQL-Server to do the seeking and only upload one record.

When working with large databases, this will make a huge difference.

Or code that will do data manipulation on the client side will be slow. It will keep the client busy doing the math and the server will be busy sending and receiving data

Code: Select all

go top
do while .not. eof()
  articles->price := articles->cost*1.5
  skip
enddo
Would load every single record, do the multiplication on the client and then save the data back to the server. An SQL-Script like

Code: Select all

UPDATE articles SET price = cost*1.5;
would cause no bandwidth at all, because it will do the multiplication without sending or receiving data.

Best way would be for HMGSCRIPT to decide where to do the processing (server or client). Even, if old control structures still work with HMGSCRIPT, some code should be rewritten us make use of MySQLs capabilities.

Raumi75
User avatar
Rathinagiri
Posts: 5477
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMGSCRIPT: The beginning...

Post by Rathinagiri »

Thanks for your nice words Raumi.

Actually, Roberto has told earlier somewhere in our forum that, HMGScript will utilize MySQL as the back end database.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply