HMGSCRIPT 2012: Programming For The Web in The Right Way :)
Moderator: Rathinagiri
- 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
Hi Roberto,
Have you seen Harbour\source\rtl\hbbit.c which contains the hbbit* functions like hbbit_and() hbbit_or()?
Have you seen Harbour\source\rtl\hbbit.c which contains the hbbit* functions like hbbit_and() hbbit_or()?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- 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
Thanks.rathinagiri wrote:Hi Roberto,
Have you seen Harbour\source\rtl\hbbit.c which contains the hbbit* functions like hbbit_and() hbbit_or()?
I've made the same question in the Harbour users forums and Pritpal answered me:
If this works, we will able to send a complete recordset from the server to the client and have data tables (base for grid, browse, etc.).n := hb_bitAnd( n1, hb_bitAnd( n2, n3 ) )
n := hb_bitOr( n1, n2, n3, ..n )
n := hb_bitshift( 1, nBit )
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- 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
That's cool.
Now my question is, can we connect to a MySQL database in the local server using websockets if we compile wssocket.exe along with mysql calls and if we have libmysql.dll file in the websocket folder?
Now my question is, can we connect to a MySQL database in the local server using websockets if we compile wssocket.exe along with mysql calls and if we have libmysql.dll file in the websocket folder?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: HMGSCRIPT 2012: Programming For The Web in The Right Way
Here is a more advanced wersion
https://docs.google.com/document/d/1agc ... hvh7c/edit
IMO html websocket will be a important steep for harbour
https://docs.google.com/document/d/1agc ... hvh7c/edit
IMO html websocket will be a important steep for harbour
Chacal.GO wrote:Below another project with sockets (Maybe has something usefull)...
This Project is started at harbour developer group and made from Daniel Garcia Gil e Antonio Linares
You need a HTML5 WebSockets support capable Internet browser like Chrome. Unfortunately IE does not apply. IE is behind its competitors regarding HTML5 support. Thats why I use Chrome, and also because it is much faster. Microsoft has promised a new version with HTML5 support but it seems as it is not ready yet.
Internet Explorer 10 and Metro style apps using JavaScript add support for the WebSocket API as defined in the W3C's HTML5 specification on the WebSocket API, which is currently in the Working Draft stage.
http://code.google.com/p/harbour-websocket/
- 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
The server is a Harbour application.rathinagiri wrote:That's cool.
Now my question is, can we connect to a MySQL database in the local server using websockets if we compile wssocket.exe along with mysql calls and if we have libmysql.dll file in the websocket folder?
You can do with it, any thing that you can do with Harbour.
The only restriction now is the server to client message length, that is the thing I'm trying to fix.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- 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
Ok.
Super.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- 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
Hi,
I've posted the following message, looking for help, at the Harbour users group.
Any clue about that is welcome:
I've posted the following message, looking for help, at the Harbour users group.
Any clue about that is welcome:
Hi,
As I've said in a previous post, I'm trying to enhance the Harbour
websockets server by Antonio Linares and Daniel García Gil to allow it
to return messages longer than 126 bytes to the client browser.
The original line creating data frame is the following:
I've researched about WebSockets protocol and I've found the followingCode: Select all
oClient:SendData( Chr( 129 ) + Chr( Len( cAnswer ) ) + hb_StrToUtf8( cAnswer ) )
pseudo-code aimed to explain how data framing must be done:
Then, I've attempted to translate to Harbour as follows:Code: Select all
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bytesFormatted[0] = 129 indexStartRawData = -1 // don't matter what value is here; it will be set now: if bytesRaw.length <= 125 bytesFormatted[1] = bytesRaw.length indexStartRawData = 2 else if bytesRaw.length >= 126 and bytesRaw.length <= 65535 bytesFormatted[1] = 126 bytesFormatted[2] = ( bytesRaw.length >> 8 ) AND 255 bytesFormatted[3] = ( bytesRaw.length ) AND 255 indexStartRawData = 4 else bytesFormatted[1] = 127 bytesFormatted[2] = ( bytesRaw.length >> 56 ) AND 255 bytesFormatted[3] = ( bytesRaw.length >> 48 ) AND 255 bytesFormatted[4] = ( bytesRaw.length >> 40 ) AND 255 bytesFormatted[5] = ( bytesRaw.length >> 32 ) AND 255 bytesFormatted[6] = ( bytesRaw.length >> 24 ) AND 255 bytesFormatted[7] = ( bytesRaw.length >> 16 ) AND 255 bytesFormatted[8] = ( bytesRaw.length >> 8 ) AND 255 bytesFormatted[9] = ( bytesRaw.length ) AND 255 indexStartRawData = 10 // put raw data at the correct index bytesFormatted.put(bytesRaw, indexStartRawData) // now send bytesFormatted (e.g. write it to the socket stream) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
But, the code fails to return messages longer than 255 characters.Code: Select all
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bytesFormatted_0 := chr(129) if Len( cAnswer ) <= 125 bytesFormatted_1 := Chr( Len( cAnswer ) ) oClient:SendData( bytesFormatted_0 + bytesFormatted_1 + hb_StrToUtf8( cAnswer ) ) elseif Len( cAnswer ) >= 126 .and. Len( cAnswer ) <= 65535 bytesFormatted_1 := chr(126) bytesFormatted_2 := chr ( hb_bitAnd ( hb_bitShift( Len( cAnswer ) , 8 ) , 255 ) ) bytesFormatted_3 := chr ( hb_bitAnd ( Len( cAnswer ) , 255 ) ) oClient:SendData( bytesFormatted_0 + bytesFormatted_1 + bytesFormatted_2 + bytesFormatted_3 + hb_StrToUtf8( cAnswer ) ) else /* not implemented yet */ endif //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Is the translation to Harbour correct?
TIA.
Regards,
Roberto.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- 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
HMGSCRIPT R010 is Here!
It is able to handle long messages, so we can retrieve recordsets.
There is a new GUI demo showing that.
This was possible with the help of Pritpal and Viktor from the Harbour users forum.
With this enhancement (ability to handle recordsets) the project turned in a feasible way to create web applications using a Harbour server.
I hope that this be useful for you as it is for me, allowing to create mixed environments, where the same dbf files are shared between desktop applications and web applications (local and remote). In my case, for remote Windows clients, I'm using NETIO and for remote web clients I'll use Websockets.
It is able to handle long messages, so we can retrieve recordsets.
There is a new GUI demo showing that.
This was possible with the help of Pritpal and Viktor from the Harbour users forum.
With this enhancement (ability to handle recordsets) the project turned in a feasible way to create web applications using a Harbour server.
I hope that this be useful for you as it is for me, allowing to create mixed environments, where the same dbf files are shared between desktop applications and web applications (local and remote). In my case, for remote Windows clients, I'm using NETIO and for remote web clients I'll use Websockets.
- Attachments
-
- hmgs010.zip
- (562.23 KiB) Downloaded 511 times
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- 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
Very good Roberto. It is pretty fast enough.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- 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
Again a basic doubt.
How can we reach the demo.server.html file from another system (say another machine in the same LAN)?
How can we reach the demo.server.html file from another system (say another machine in the same LAN)?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.