How to Work with FIVEWIN and Web Side by Side - An Easy Way
How to Work with FIVEWIN and Web Side by Side - An Easy Way
How to Work with FIVEWIN and Web Side by Side - An Easy Way
Hello friends,
I have conducted many tests and have concluded that if you want to combine a DBF desktop application with a web application, the simplest solution is to exchange data via JSON files. I have also implemented a heartbeat function, which means the online application periodically checks if the heartbeat of FIVEWIN.EXE is present, indicating that it is running and functioning properly. The desktop application regularly creates a file, and the online application checks how old this file is. If it is older than a certain time, an error is displayed.
The next step is to implement authentication so that only authorized JSON files can be passed to the FIVEWIN.EXE; otherwise, they will simply be deleted.
The file-based system takes 200 ms, which I think is a good value. It also has the advantage of not requiring changes to the existing program. I believe that if one were to release this, it would be the best path to take. Also, adding or updating data is rare in this case. Here, you can see all CRUD actions with data exchange via files and the FIVEWIN.EXE.
I have now created a test with data deletion and a FIVEWIN EXE with a timer. It is a very simple program, as you can see from the attached screenshot.
The PHP program writes a file. In this case, I read from the filename what needs to be done and the record number. The PHP program itself also has a timer (JavaScript interval) that checks and updates the view. The big advantage here, even if you might lose some speed, is that you pass the data to FIVEWIN and are sure that it arrives.
Even when there is a lot of work, you should take some time for a little fun. I have now added a heartbeat. If the FIVEWIN.EXE is active and functioning, so that it can receive and process the JSON files, then you will see the heartbeat. A nice little gimmick.
Best regards,
Otto
Hello friends,
I have conducted many tests and have concluded that if you want to combine a DBF desktop application with a web application, the simplest solution is to exchange data via JSON files. I have also implemented a heartbeat function, which means the online application periodically checks if the heartbeat of FIVEWIN.EXE is present, indicating that it is running and functioning properly. The desktop application regularly creates a file, and the online application checks how old this file is. If it is older than a certain time, an error is displayed.
The next step is to implement authentication so that only authorized JSON files can be passed to the FIVEWIN.EXE; otherwise, they will simply be deleted.
The file-based system takes 200 ms, which I think is a good value. It also has the advantage of not requiring changes to the existing program. I believe that if one were to release this, it would be the best path to take. Also, adding or updating data is rare in this case. Here, you can see all CRUD actions with data exchange via files and the FIVEWIN.EXE.
I have now created a test with data deletion and a FIVEWIN EXE with a timer. It is a very simple program, as you can see from the attached screenshot.
The PHP program writes a file. In this case, I read from the filename what needs to be done and the record number. The PHP program itself also has a timer (JavaScript interval) that checks and updates the view. The big advantage here, even if you might lose some speed, is that you pass the data to FIVEWIN and are sure that it arrives.
Even when there is a lot of work, you should take some time for a little fun. I have now added a heartbeat. If the FIVEWIN.EXE is active and functioning, so that it can receive and process the JSON files, then you will see the heartbeat. A nice little gimmick.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
Hi Otto,
my simple solution is to call the fivewin.exe from php simply passing the parameters I receive from Apache server.
The environment is a Windows VPS server with Apache + Php installed but I think it would run on Linux also
this is a very simplified code for index.php just to send the idea:
my simple solution is to call the fivewin.exe from php simply passing the parameters I receive from Apache server.
The environment is a Windows VPS server with Apache + Php installed but I think it would run on Linux also
this is a very simplified code for index.php just to send the idea:
Code: Select all | Expand
switch ($_SERVER['SERVER_NAME']) {
case "siteone.com":
$exename = 'folderOne\FWsiteOne.exe';
break;
case "www.siteTwo.it":
case "siteTwo.it":
$exename = 'folderTwo\FWSiteTwo.exe';
break;
case "www.site3.net":
$exename = 'folder3\FWSite3.exe';
break;
}
$runexe = $exename.' '.$user.' '.$pswd.' '.$func.' '.$gets.' '.$posts ; // passing parameters managed before
$htmlOut = shell_exec( $runexe ); // the exe program produces html code
echo($htmlOut); // display the page
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
Hello Roberto,
Thank you. In your case, if I understand the code correctly, you would have a PHP endpoint that receives the response and then calls an executable with parameter passing.
I will run a test to see how fast the execution is here.
Best regards,
Otto
Thank you. In your case, if I understand the code correctly, you would have a PHP endpoint that receives the response and then calls an executable with parameter passing.
I will run a test to see how fast the execution is here.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
Otto,
if you want to test the execution speed you can visit these sites:
https://www.recinformatica.it (our site)
https://www.to-build.it (one of the last done, multilingual)
https://www.autoricambischicchi.it
https://www.sicuriallestero.it
https://www.boscomarshop.it (an e-commerce under construction)
all sites (and others) on the same webserver, some of them from several years,
all sites entirely written in harbour, data-driven, dbf files, my custom harbour CMS,
some sites share data with customer's databases via synchronization (orders, invoices and other documents)
some customers can manage site contents by their Fivewin accounting software (product description, prices, images and so on)
Roberto
if you want to test the execution speed you can visit these sites:
https://www.recinformatica.it (our site)
https://www.to-build.it (one of the last done, multilingual)
https://www.autoricambischicchi.it
https://www.sicuriallestero.it
https://www.boscomarshop.it (an e-commerce under construction)
all sites (and others) on the same webserver, some of them from several years,
all sites entirely written in harbour, data-driven, dbf files, my custom harbour CMS,
some sites share data with customer's databases via synchronization (orders, invoices and other documents)
some customers can manage site contents by their Fivewin accounting software (product description, prices, images and so on)
Roberto
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
Roberto,
thank you very much for your examples.
Very professional and beautiful.
You should post more about how you do it.
Best regards,
Otto
thank you very much for your examples.
Very professional and beautiful.
You should post more about how you do it.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
hello Otto,
here is a brief description:
the CMS module is a standard fw desktop application, it is the place where all informations about the sites are stored: sites, pages, contents, menus, documents, html templates, css files and so on.
It is multi-site so a single customer can have multiple sites sharing the same dbf's. As an example: the official site, landing pages, reserved areas with login, etc.
It is multi-language, contents can be active or not or scheduled. Every folder/customer has its own repository
The cgimodule.exe is the app that is called by php with the parameters received from Apache server. this app recognizes the user by the 'session id', interprets the parameters ('gets' and 'posts' as the pageId), reads contents from the repository, builds the pages and returns the html code to php. Every customer can have one or more cgi-modules, one per site/domain.
It uses classes to generate html pages, contents, menus, browses, forms, carousels, grids and image galleries from repository
Harbour power: in the repository we can define as 'content' a function or codeblock that is executed at runtime, the result is macro-substituted inside the html template via $KEYWORDS to create real-time contents.
We can also define nested templates (virtual pages) so can create very complex pages built by 'sections' .or. share sections across multiple pages (as an example page header and footer are 'sections')
Don't update pages, update sections!
There is still a lot of work to do but we can already create complex real web applications
If you have any question feel free to ask
kind regards
Roberto
here is a brief description:
the CMS module is a standard fw desktop application, it is the place where all informations about the sites are stored: sites, pages, contents, menus, documents, html templates, css files and so on.
It is multi-site so a single customer can have multiple sites sharing the same dbf's. As an example: the official site, landing pages, reserved areas with login, etc.
It is multi-language, contents can be active or not or scheduled. Every folder/customer has its own repository
The cgimodule.exe is the app that is called by php with the parameters received from Apache server. this app recognizes the user by the 'session id', interprets the parameters ('gets' and 'posts' as the pageId), reads contents from the repository, builds the pages and returns the html code to php. Every customer can have one or more cgi-modules, one per site/domain.
It uses classes to generate html pages, contents, menus, browses, forms, carousels, grids and image galleries from repository
Harbour power: in the repository we can define as 'content' a function or codeblock that is executed at runtime, the result is macro-substituted inside the html template via $KEYWORDS to create real-time contents.
We can also define nested templates (virtual pages) so can create very complex pages built by 'sections' .or. share sections across multiple pages (as an example page header and footer are 'sections')
Don't update pages, update sections!
There is still a lot of work to do but we can already create complex real web applications
If you have any question feel free to ask
kind regards
Roberto
Last edited by chiaiese on Tue Sep 03, 2024 9:35 am, edited 1 time in total.
- Antonio Linares
- Site Admin
- Posts: 42256
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
Dear Roberto,
It would be great if you could share some simple example so it can help Harbour users as a guide
many thanks!
It would be great if you could share some simple example so it can help Harbour users as a guide
many thanks!
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
hi Antonio,
here is a simplified sample code I use:
and here is the definition of the main Class CWebPage()
Obviously other classes helps to manage Contents and Content elements
here is a simplified sample code I use:
Code: Select all | Expand
function main()
parameters User,Password,cFunction,cGets,cPosts
... here some settings
* Start application **********************
public oApp := CApp():New(" Gestione CGI Web ",INI_FILE)
oApp:cParms := cParms // parametri da Setup
oApp:cGets := cGets // parametri GET (dai link/bottoni)
oApp:cPosts := cPosts // parametri POST (dai FORM)
oApp:lPost := .t. // passaggio parametri con metodo POST - 14/03/2014
oApp:lUtf8 := .t. // conversione stringhe UTF8 - 27/06/2018
oApp:Start(User,Password) // user = Sessid
if empty(cFunction) // se non è un passaggio
cFunction := getPar(cPosts,"function") // predefinito ctrl se c'e
endif // una funzione chiamata da POST
cFunction := lower(cFunction)
nLang := val(alltrim(getPar(,"L"))) // language
nLang := if(range(nLang,0,4),nLang,0) // add: 18/03/2019
cSub := lower(getPar(,"cSub")) // sub-function
if cFunction=="nil" // carattere
cFunction := lower(getpar(,"id"))
if empty(cFunction)
cFunction := "homepage" // default PageId
endif
endif
// pageId, idSito, ..., Tabella contenuti sito
oPage := CWebPage():New(cFunction,"MYSITE",,,{|oPage,cHead|setHeader(oPage,cHead)},,TABVAR):Exec() // here we build Page object and output the Html code
release all
exit()
// end program
Code: Select all | Expand
Class CWebPage // 03/11/2017
var aFiles as array // files procedura da aprire
var cSiteId // id sito (cod. in tabella generale)
var cPageId // id pagina (Nome)
var cKeyPag // Chiave pagina x Seek (cSiteId+cPageId) add: 22/06/2018
var cAllpages // codice pagina 'invisibile' per i contenuti validi per tutte le pagine (no stdout)
// es. menu, logo, footer, ecc.
var cHeadTpl // header template
var cFootTpl // footer template
var cCssFile // file css
var cFavicon // favicon
var cLogo // logo
var cTagDescription // meta tag description
var cKeyWords // meta tag keywords
var cHtml // html generato
var cTabVar // tabella contenuti vari di default - può essere modificata
var cFileOpen // elenco dei files da aprire per questa pagina (comma separated)
var bSetHeader // codebock to set header
var bSetFooter // codebock to set footer
var bFor // filtro sui contenuti
var lUtf8 init .t. // se output in utf-8 (solo contenuti non-stdout)
var lStdOut init .t. // se output su stdOut
var lContentOnly init .f. // .t. non visualizza header e footer
var nLang // indice lingua [1-5] // 19/06/2023
var cLang // sigla lingua [ITA,ENG,SPA,FRA,DEU(ROM)] // 19/06/2023
var nAreaTab // area Tabelle // 11/04/2019
var nAreaAll // area Allegati x sito // 11/04/2019
var oContent // contenitore principale
Method New( cPageId, cSiteId, aFiles, cAllPag, bSetHeader, bSetFooter, cTab, nAreaTab, nAreaAll ) Constructor
Method exec() // eseguo motore pagina
Method allegati(cIdContent,cPage) // visualizzo allegati (contenuto)
Method carousel(oCnt,aCarousel,lCaption) // creo carousel
Method content(cIdContent,cPage) // visualizzo un content-object
Method edit(cIdContent,cPage) // visualizzo oggetto Edit (contenuto)
Method genContent() // genero e visualizzo i contenuti
Method genMenu(cIdContent,cPage) // visualizzo menu (contenuto)
Method genSlides(cIdContent,cPage) // visualizzo slides/carousel
Method genBlock( obj, cTipo, cIdContent ) // genera 'bData' per il contenuto
Method griglia(cIdContent,cPage) // visualizzo una griglia (contenuto)
Method loadAllega(cPage,cIdContent,cType,cTag) // carica allegati per una griglia
Method readContent(cSite,cPage) // carico singolo contenuto
Method template(cIdContent,cPage) // visualizzo template (pagina in pagina)
Method loadMenu(nMenu,cIdContent,cPage) hidden // carica il menu
Method buildMenu(aM,nIdx) hidden // genera il menu (html)
Method lSito(cTab) inline (cTab $ TABSITE+"-"+TABTEMP+"-"+TABVAR ) // come pr_tabel - 29/10/2022
EndClass
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
Dear Roberto,
Thank you very much.
I will take a close look at the code and will surely have more questions about it.
I was not online last week because I was at a TikTok Tourism Marketing Meeting at the new TikTok HQ in Dublin.
An amazing success story and a very exciting product.
May I ask where in Italy you are from? I live just 4 km from the Italian border. Maybe we can meet sometime.
Best regards,
Otto
Thank you very much.
I will take a close look at the code and will surely have more questions about it.
I was not online last week because I was at a TikTok Tourism Marketing Meeting at the new TikTok HQ in Dublin.
An amazing success story and a very exciting product.
May I ask where in Italy you are from? I live just 4 km from the Italian border. Maybe we can meet sometime.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: How to Work with FIVEWIN and Web Side by Side - An Easy Way
Hi Otto,
I'm from Napoli but I live in Roma from over 30 years.
Often people who lives at borders are bilingual..so do you also speak Italian?
If you have more questions I will be happy to answer
Regards
I'm from Napoli but I live in Roma from over 30 years.
Often people who lives at borders are bilingual..so do you also speak Italian?
If you have more questions I will be happy to answer
Regards