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

Moderator: Rathinagiri

Post Reply
User avatar
Rathinagiri
Posts: 5480
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 »

Great Roberto!

I have to study a lot this weekend to cope up with the improvements.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
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,

Wow :shock: :?

Thank you for being expanding our horizons ;)

I work for many years with HRB. What do you need ?

Below an example of how to put generate it and run it.

Code: Select all


#include "minigui.ch"

PROCEDURE Main

DEFINE WINDOW Win_Main ;
AT 0,0 ;
WIDTH 600 ;
HEIGHT 400 ;
TITLE 'Test program' ;
MAIN

DEFINE STATUSBAR ;
FONT 'Times New Roman' SIZE 12
STATUSITEM ''
END STATUSBAR

@10,10 BUTTON Btn_1 ;
CAPTION 'Run Script' ;
WIDTH 200 ;
HEIGHT 25 ;
ONCLICK RunScript()

END WINDOW
Win_Main.StatusBar.Item(1) := 'HMG Power Ready'
CENTER WINDOW Win_Main
ACTIVATE WINDOW Win_Main

RETURN


PROCEDURE RunScript

local CONTENT, HANDLE_HRB, PRG, HRBCODE

PRG := ;
"proc p()" + hb_eol() + ;
" SetProperty ( 'Win_Main', 'StatusBar' , 'Item' , 1 , 'Hello World' ) "+ hb_eol() + ;
" MsgInfo( 'Hello World' )" + hb_eol() + ;
"return"

HRBCODE := hb_compileFromBuf( PRG, "harbour", "-n", "-w3", "-es2", "-q0" )

memowrit( "myhrb.hrb", sx_encrypt( HRBCODE, "myPaswdKey" ) )

CONTENT := sx_decrypt( memoread( "myhrb.hrb" ), "myPaswdKey" )

HANDLE_HRB := hb_hrbload( CONTENT )

hb_hrbDo( HANDLE_HRB )

hb_hrbunload( HANDLE_HRB )

RETURN

Thank you very much for all :D

Rossine.
User avatar
Rathinagiri
Posts: 5480
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 cool Rossine. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Rathinagiri
Posts: 5480
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 »

Roberto,

demo.server.html is working fine (only) in Chrome.

wssocket.exe should be run as an administrator and firewall should be opened up.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Rathinagiri
Posts: 5480
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 »

Now, my basic doubts:

1. Can wssocket server be started in a Linux machine.
2. Can we make it run in a leased web space provider's system? (for example, can I someway start wssocket server in our forum's server providers system?)

I have uploaded hmgscript in www.hmgforum.com/hmgscript. So, we can test the behavior immediately.
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 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

rathinagiri wrote:Roberto,

demo.server.html is working fine (only) in Chrome.

wssocket.exe should be run as an administrator and firewall should be opened up.
Is working fine for me with FireFox 12.0.

Which version are you using?
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5480
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 »

Sorry I am using FireFox 10. I will update now and check.
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 2012: Programming For The Web in The Right Way

Post by Roberto Lopez »

rathinagiri wrote:Now, my basic doubts:

1. Can wssocket server be started in a Linux machine.
2. Can we make it run in a leased web space provider's system? (for example, can I someway start wssocket server in our forum's server providers system?)

I have uploaded hmgscript in hmgscript. So, we can test the behavior immediately.
R1: I guess yes, but I'm not tested. I've tweaked the command line, but you can look at the application and you'll find option to make it run as a daemon instead as a normal app.

R2: I don't know, but my first thinking is that is not possible, but I'm not sure. The alternative, as I've stated in a previous post is to use a PHP based websockets server. There is code available. Just google it.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4012
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,

Wow :shock: :?

Thank you for being expanding our horizons ;)

I work for many years with HRB. What do you need ?

Below an example of how to put generate it and run it.
Thanks!

My idea is to pass message to the server with the name of external .hrb modules to execute, so there will be no need to recompile the whole server when you want to add or modify a module.

I'll start testing.
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,

Here a more detailed example:

Code: Select all


#include "hbcompat.ch"

function MAIN

local CONTEUDO, nHandle

cls

CREATES_NEWHRB()

CONTEUDO := HRB_LoadFromFileEncrypted( "myhrb.hrb", "mypassword" )
try
      nHandle := hb_hrbload( CONTEUDO )
catch oErr
      ? "Error load in hrb"
      quit
end
if empty( nHandle )
   ? "Error call hrb"
   quit
endif

? call_func( nHandle, "p1", "1" )
? call_func( nHandle, "p2", "2" )

hb_hrbunload( nHandle )

return NIL

*************************
static function call_func( nHandle, cFunc, xPar )
*************************

local xRet := HB_HRBGETFUNSYM( nHandle, cFunc )

if empty( xRet )
   ? "Error load in function " + cFunc
   quit
endif

return eval( xRet, xPar )

********************************
function HRB_SaveToFileEncrypted( cEncFileName, cKey, cHrbBody )
********************************

local cFile

if !empty( cHrbBody )
   cHrbBody := hb_zcompress( cHrbBody )
   cHrbBody := sx_encrypt( cHrbBody, cKey )
   hb_memowrit( cEncFileName, cHrbBody )
endif

return NIL

**********************************
function HRB_LoadFromFileEncrypted( cFile, cKey )
**********************************

local cHrbBody

cHrbBody := hb_memoread( cFile )
cHrbBody := sx_decrypt( cHrbBody, cKey )
cHrbBody := hb_zuncompress( cHrbBody )

return cHrbBody

***********************
function CREATES_NEWHRB
***********************

local CONTENT, HANDLE_HRB, PRG, HRBCODE

PRG := ;
"function p1( cPar )" + hb_eol() + ;
"? 'Hello World One ' + cPar" + hb_eol() + ;
"return 'One'" + hb_eol() + ;
"function p2( cPar )" + hb_eol() + ;
"? 'Hello World Two ' + cPar" + hb_eol() + ;
"return 'Two'"

HRBCODE := hb_compileFromBuf( PRG, "harbour", "-n", "-w3", "-es2", "-q0" )

HRB_SaveToFileEncrypted( "myhrb.hrb", "mypassword", HRBCODE )

RETURN

Best Regards,

Rossine.
Post Reply