webserver using RESTFUL API and responsive

webserver using RESTFUL API and responsive

Postby Otto » Fri Jun 01, 2018 7:50 am

Hello friends,
I am working on a new project. An ANDROID APP is posting against a webserver using RESTFUL API. This work is done and fully functional.
At the moment the backend is written in SYMFONY. As I read about the “RestFul server with Harbour” I thought if it would be possible to use Harbour and FIVEWEB instead of Symfony for the WEB development.
Responsive design is a must because the ANDROID APP is used from different devices.
What do you think.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: webserver using RESTFUL API and responsive

Postby Antonio Linares » Sun Jun 03, 2018 10:51 am

Otto,

FiveWeb uses CGIs. For little amount of users it may be fine but not sure how it may behave for many users.

Can you use CGIs ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: webserver using RESTFUL API and responsive

Postby Otto » Sun Jun 03, 2018 9:05 pm

Dear Antonio,
thank you for your answer. Can you please tell me what number a little amount of users is.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: webserver using RESTFUL API and responsive

Postby Antonio Linares » Tue Jun 05, 2018 7:16 pm

Dear Otto,

Each time a CGI is invoked (a CGI is an EXE), the server executes it. Lets imagine 20 users simultaneously invoke the CGI. It is exactly the same
as launching 20 EXEs at the same time, in terms of memory consume and loading time. More users will result in more memory and time consume.

If we use a web server instead of a CGI, for each user requirement, a new thread is created. This means much less memory and time consume.
Just an EXE is running. A single one.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: webserver using RESTFUL API and responsive

Postby Carles » Wed Jun 06, 2018 5:11 pm

Hi Otto,

Otto wrote:Responsive design is a must because the ANDROID APP is used from different devices.


What do you mean, with responsive?

It's really necessary ? Many times the customer explains that if an application isn't responsive, it's not worth anything.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1137
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: webserver using RESTFUL API and responsive

Postby Otto » Wed Jun 06, 2018 8:36 pm

Dear Antonio,
thank you for your answer.

I looked inside task manager of my server. My Fivewin programs consume in average 5 MB.
5 MB, 10000 user would be an amount of 50 Gigabyte.
I saw that the maximum of Windows Server 2016 Standard is 24 TB.

Is this calculation realistic.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: webserver using RESTFUL API and responsive

Postby Antonio Linares » Thu Jun 07, 2018 7:49 am

Otto,

Common Gateway Interface (CGI) requests

For performance reasons, the use of CGI applications to serve requests is not recommended with IIS. Frequently creating and deleting CGI processes involves significant overhead. Better alternatives include using ISAPI application scripts and ASP or ASP.NET scripts. Isolation is available for each of these options.

https://msdn.microsoft.com/en-us/library/windows/hardware/dn567678%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Probably a real life test would solve the doubts about it. Here you have a guide to use CGIs with IIS:

viewtopic.php?p=171281#p171281
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: webserver using RESTFUL API and responsive

Postby Otto » Thu Jun 07, 2018 9:33 am

Dear Antonio,
as you know I try to evolve the project where your son Manuel developed the ANDROID APP to scan QRCodes.
The APP is working perfect.
I know it would be the best and easiest way to let him program the rest too.

But the problem is that I have no clear ideas about the final product at the moment.
So I would prefer to develop this step by step myself.

But I am sure that this ANDOID APP could be an interface like keyboard or touchscreen for all of us Fivewinners.
Therefore I asked for help.

It is not realistic to think that at the start there will be so many users. But if we see that there are then we have also the budget for developing.

I thought if I set up an internet server we could install HARBOUR RESTFUL and I could ask Manuels company to develop a extra APP which is working against this HARBOUR internet server.

That was my idea.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: webserver using RESTFUL API and responsive

Postby Carles » Thu Jun 07, 2018 3:52 pm

Otto,

Otto wrote:...Symfony for the WEB development.


Have you used simphony ? do you know php ?

C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1137
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: webserver using RESTFUL API and responsive

Postby Otto » Thu Jun 07, 2018 4:42 pm

Hello Carles,
no not really I am learning PHP and Symfony at the moment.
But I would prefer a Harbour/FiveWeb environment.

The Android QRCode APP is opening so many business opportunities.

Best regards,
Otto

https://www.bluelounge.com/products/quick-peek
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: webserver using RESTFUL API and responsive

Postby Carles » Thu Jun 07, 2018 5:01 pm

Otto,

Look at this little code and I'm sure you understand what this can try to do. All is a bit of php and javascript.

Code: Select all  Expand view  RUN
<?php
include ( 'config.php' );
include ( TWEB_PATH . 'core.php' );
include ( TWEB_PATH . 'core.grid.php' );

define  ( 'TITLE', 'App Bussines - Movil' );

$oWeb = new TWeb( TITLE );
   
$oWeb->Activate();

$oFont  = new TFont( 'Verdana', 14, true, true, false, CLR_GRAY );

    $oWnd = new TWindow( 'main',  0, 0, '100%', '100%' );
   
        $oPanel = new TPanel( $oWnd, 'main_A',  0, 0, '100%', 25, CLR_BLACK );
            $oImg = new TImage( $oPanel, null, 5, 5 , 'images/about.png', 16, 16 );            
            $oSay = new TSay( $oPanel, null, 2, 30, 'App Bussiness' )
                $oSay->SetFont( $oFont );   
                               
        $oPanel = new TPanel( $oWnd, 'main_B', 25, 0, '100%', '100%', CLR_HGRAY );         
       
            $oBar = new TBar( $oPanel, 'mybtnbar' );
                $oBar->nBtnWidth = 100;
                $oBar->AddButton( 'btn1', 'Consulta'        , 'Consulta()'      , 'images/db.png' );
           
            $oImg = new TImage( $oPanel, 'photo', 97, 10, '', 120, 150 );
                $oImg->lZoom = true;
                $oImg->SetBorderInset();
                $oImg->SetRight( 10, 120 );

                    new TSay( $oPanel, null, 60, 10, 'Id.', 100 );
            $oGet = new TGet( $oPanel, 'my_id', 60, 80, '1' );
                $oGet->SetRight( 140 );            

            $o = new TGroup( $oPanel, null,  90, 10, 'Datos Personales', 0, 160 );
                $o->SetRight( 140 );

                $oSay = new TSay( $o, 'first'   , 30, 10, '' );
                    $oSay->lBorder = true;
                    $oSay->SetRight( 10 );
                   
                $oSay = new TSay( $o, 'last'    , 60, 10, '' );
                    $oSay->lBorder = true;
                    $oSay->SetRight( 10 )

                $oSay = new TSay( $o, 'street'  , 90, 10, '' );
                    $oSay->lBorder = true;
                    $oSay->SetRight( 10 );

                $oSay = new TSay( $o, 'city'    , 120, 10, '', 120 );
                    $oSay->lBorder = true

                $oSay = new TSay( $o, 'state'   , 120, 140, '', 40 );
                    $oSay->lBorder = true;                     
                    $oSay->cAlign  = 'center';

            $oGrid = new TGrid( $oWnd, 'mygrid', 280, 10, 350, 500 );
                $oGrid->SetRight( 10 );
                $oGrid->SetBottom( 60 );
       
                $oCol = $oGrid->AddCol( 'fecha'   , 'Fecha'       , 100 );        
                $oCol = $oGrid->AddCol( 'service' , 'Servicio'    , 150 );
                $oCol = $oGrid->AddCol( 'total'   , 'Total'       , 100 );         
               
        $o = new TBar( $oWnd, 'mybtnbar' );
            $o->SetBottom( 0, 50 );
            $oBtn = $o->AddButton( null, 'Info' , "Info()", 'images/info.png' );
                $oBtn->cAlign = 'right';               
   
    $oWnd->Activate();
   
$oWeb->End();   
?>
<script>

    function Consulta() {
   
        Reset_Data();
       
        var o = new TControl();    
   
        var oParam = new Object()
            oParam[ 'accion'] = 'refresh'
            oParam[ 'id'    ] = o.Get( 'my_id' )
   
        MsgServer( 'srv_app_movil.php', Escucha_Consulta, oParam ) 
    }
   
    function Escucha_Consulta( dat ) {

        var o = new TControl();
       
        if ( dat.cab ) {   
       
                var o = new TControl();
               
                o.Set( 'my_id'  , dat.cab.id )
                o.Set( 'first'  , dat.cab.first )
                o.Set( 'last'   , dat.cab.last )
                o.Set( 'street' , dat.cab.street )
                o.Set( 'city'   , dat.cab.city )
                o.Set( 'state'  , dat.cab.state )                      
                o.Set( 'photo'  , 'images/data.img/' + dat.cab.photo, 'images/data.img/' + dat.cab.photo )                     
               
                o.Set( 'mygrid', dat.pos );        
           
        } else {
           
            MsgNotify( dat.msg, 'error'  )             
        }      
    }
   
   
    function Reset_Data() {
       
        var o = new TControl();

        o.Set( 'first'  );
        o.Set( 'last'   );
        o.Set( 'street' );
        o.Set( 'city'   );
        o.Set( 'state'  );
        o.Set( 'photo'  );
        o.Set( 'mygrid' );
    }
   
    function Info(){   
                       
        var oOptions    = new Object();
        oOptions[ 'title'       ] = 'Información...';
        oOptions[ 'centered'    ] = true;
        oOptions[ 'modal'       ] = true;
        oOptions[ 'resizable'   ] = false;
        oOptions[ 'closeOnEscape'] = false;
        oOptions[ 'dialogextend'] = false
           
        TLoadDialog( null, 'tuto_app_version.php', null, oOptions )        
    }   
   
</script>


I think it's a very clean code, do you agree ? :D

Now I would like to run this little code from your Android phone with the following url:

http://itarraco.com/tweb.examples/tuto_app_movil_4.php

We are a species that always find solutions to our needs. I propose one of them...
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1137
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: webserver using RESTFUL API and responsive

Postby Antonio Linares » Fri Jun 08, 2018 8:04 am

Dear Otto,

I understand what you mean :-)

Please review this guide I wrote to use CGIs from Windows server:
viewtopic.php?p=171281#p171281

Once you review and apply those settings, we will try to run a Harbour EXE as a CGI. From there on, you can use Harbour (+ FiveWeb)
to build the server side and we will see how it behaves for your needs.

Carles advise could help you to simplify all very much, in case that you want to try php.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: webserver using RESTFUL API and responsive

Postby Otto » Fri Jun 08, 2018 9:34 am

Dear Antonio,
thank you for your help. I will study your guide.

Please let me show you what I have so far.

As I said qr code reading is only an input device like the keyboard or touch. With this input device we have unlimited possibilities to develop commercial
APPs.

Here a little example for finding things you’ve packed quicker and easier

Managing my repair parts for my label printer

1. take a preprinted QRCode ( for e.g. Intern_1 ) label and attach it on your storage box or were you need the info in my case on the printer itself.
2. Take pictures of the box and I take also pictures of the article numbers
3. Store the pictures in a webpage – I use Wordpress
4. now you can scan with your smartphone the qrcode and you see the webpage with the stored pictures

One thing you have to do is to define in your software – like a DNS server – to which link the qr code label links.
Here I use a FIVEWIN SQL xBrowse.

That is all.



Best regards,
Otto






Image

Image

Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: webserver using RESTFUL API and responsive

Postby Antonio Linares » Fri Jun 08, 2018 6:22 pm

Otto,

What info will you send to the server ?

Just a string ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: webserver using RESTFUL API and responsive

Postby Otto » Fri Jun 08, 2018 9:48 pm

Dear Antonio,
KIBU APP sends handy ID and the content of the QR code.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 44 guests