Cloud Server

Posted: 2017-01-17 in Cloud Server
Q:
 I am using the cloud server as I am running everything on my desktop as per a standard install – or do all web apps use the cloud server?
A:
If you install a apass developer the cloud server is also installed on your development machine. Please open the web examples, view as web app then preview. Once you are familiar with these steps proceed to experiment with calling server side JavaScript if that’s your server side scripting kanguage of choice.

Lianja Cloud Server incorporates an embedded database and Lianja SQL Server. If you have Lianja cloud server installed you do not need (and should not) install LuanhaLianja SQL server.

Q;
I have a wedding application (for my son) that guests will be using during the wedding.
I would like them to not have to type in the entire url.

Meaning – to get there now, you need to type in.
Samswedding.online/apps/wedding/index.html

I would like them to only type samswedding.online and have it re-directed.
A:
you can create a QR code for a URL. There are several free sites. Then print the QR code on folding cards, and put them on each table.
you need to obtain a domain from someone like network solutions or setup a CNAME in DNS.
I use easydns.com for my domains and DNS. They have Forward and Stealth options (the latter continues to show the original entered URL).

If you’re using the IIS plug-in then you will have actual rewrite capabilities, of course. http://nicolas.guelpa.me/blog/2015/0…irect-iis.html I haven’t tried a rewrite with the LCS, so let us know if you try it. <s>

Because Lianja uses the .dbo files, a cloud server app can be upgraded on-the-fly.

The Lianja Cloud Server includes the following features/functionality:

— An embedded version of the Lianja database engine
— Lianja SQL Server for ODBC data access
— Lianja OData Server
— Lianja WebSockets Server
— Lianja/VFP Server Pages (.rsp files)
— Lianja/JavaScript Server Pages (.jssp files)
— Handles interaction with Lianja HTML5/JavaScript Web Apps
— Handles interaction with Lianja HTML5/JavaScript PhoneGap Mobile Apps

Dynamic server pages contain HTML5 and directives that tell the Cloud Server how to process the contents of the page.

<%@ Language=VFP %>
or
<%@ Language=JavaScript %>

Let’s see some example code.
<%@ Language=JavaScript %>
<!--
    Lianja/VFP Server pages (.rsp) have the complete Lianja scripting engine embedded in them.
    ---------------------------------------------------------------------------------------------
    When a Lianja/VFP Server Page is executed the following are available to the script
    in addition to the complete VFP compatible cross-platform scripting language 
    implemented in Lianja.
    
    Global associative arrays:
    
         _REQUEST[]
         _SERVER[]
         _ARGS[]
         _GET[]
         _POST[]
         _FILES[]
         _COOKIE[]
         _SESSION[]
    
    Global objects:
    
        Response
            write( text )
            writeFile( filename )
            addCookie(name, value)
            addHeader(name, value)
            clear()
            flush()
            redirect( url )
            authenticate( [message] )
            appendToLog( message )
            include( filename )
            
    Built-in commands/functions:
    
        ? cExpression 
        echo cExpression 
        move_uploaded_file(tofilename, fromfilename)
        die(message)
        include( cExpression )
        object = require( cExpression )
        odata_Create( url, jsondatastring )
        odata_Read( url [, filename] )
        odata_Update( url, jsondatastring )
        odata_Delete( url, jsondatastring )
    
    JavaScript Server Pages are modelled on PHP Server Pages. 
    ---------------------------------------------------------
    When a JavaScript Server Page is executed the following are available to the script
    in addition to the built-in JavaScript functions. These will be familiar to PHP 
    Web developers.
    
    Global associative arrays(objects):
    
        $_REQUEST[]
        $_SERVER[]
        $_ARGS[]
        $_GET[]
        $_POST[]
        $_FILES[]
        $_COOKIE[]
        $_SESSION[]
    
    Global objects:
    
        Lianja.
            execute( vfp_command )
            evaluate( vfp_expression )
            openDatabase( databasename )
                openRecordSet( table_or_sqlselect )
                    moveFirst()
                    moveNext()
                    movePrevious()
                    moveLast()
                    move()
                    moveRelative()
                    moveBookmark()
                    findFirst( condition )
                    findNext( condition )
                    findPrevious( condition )
                    findLast( condition )
                    edit()
                    update()
                    delete()
                    requery()
                    field( name_or_number )
                        .name
                        .type
                        .width
                        .decimals
                        .value
                    close()
                    bof
                    eof
                    found
                    nomatch
                    recno
                    reccount
                    fieldcount
                    index
                    filter
                close()
        Response
            write( text )
            writeFile( filename )
            addCookie(name, value)
            addHeader(name, value)
            clear()
            flush()
            redirect( url )
            authenticate( [message] )
            appendToLog( message )
            include( filename )
    
    Built-in functions:
    
        print( cExpression );
        echo( cExpression );
        move_uploaded_file(tofilename, fromfilename);
        die(message);
        debugout(message);
        include( cExpression );
        object = require( cExpression );
        odata_Create( url, jsondatastring );
        odata_Read( url [, filename] );
        odata_Update( url, jsondatastring );
        odata_Delete( url, jsondatastring );
        tmpnam()
        objectType( object_fieldname )
        objectRead( from_filename, object_fieldname )
        objectWrite( to_filename, object_fieldname )
        base64_encode_object( object_fieldname, width, height)
        unlink( filename )


    The following is an example Lianja JavaScript Server Page.
            
-->
<html>
<body>
<%
    // Note that just as in PHP, JavaScript Server Pages can use include_once( filename) and include(filename)
    // The path of the filename is relative to the directory containing this script.
    include_once("library_example.jssp");


    // The Lianja global object provides embedded database access
    db = Lianja.openDatabase("southwind");
    print("db=" + typeof db); 
    print("<br>");
    
    // Lianja.openDatabase() returns a Database object so now we can open a RecordSet
    rs = db.openRecordSet("select * from customers");
    print("rs=" + typeof rs); 
    print("<br>");
    print("Fieldcount="+rs.fieldcount);
    print("<br>");
%>
<table>
<%
    print("<tr>");
    for (i=0; i<rs.fieldcount; ++i)
    {
        print("<td>"+rs.field(i).name+"</td>");
    }
    print("</tr>");
    rs.moveFirst();
    for (j=0; j<rs.reccount; ++j)
    {
        print("<tr valign='top'>");
        for (i=0; i<rs.fieldcount; ++i)
        {
            print("<td>"+rs.field(i).value+"</td>");
        }
        print("</tr>");
        rs.moveNext();
    }
    rs.close();
    db.close();
%>
</table>
</body>
</html>

PS. There are many examples in the examples directory. Run them like this.

http://localhost/examples/example_request.rsp

Reading these examples will show you how to upload files, handle authentication and much more.

Question:

Do you need to write code like this to run Lianja Web and Mobile Apps.

Answer:

If you follow best practices no you don’t but if you want to format a custom WebView section or use a third party JavaScript framework this is when you would use dynamic server pages.

And by the way, they are *very* fast. HTTP web connections and ODBC connections to MSSQL / MySQL / PostgreSQL etc are pooled internally.

Q:
I am wanting to set Lianja Cloud Server,
follow the instructions in the documentation,
but want to connect to http: //localhost/login.rsp
I get browser error “HTTP Error 404.0 – Not Found”
is this is something of the IIS configuration, but still the steps and it does not work.
A:
try this.

Was a bad IIS Configuration,

Sorry by my English, but i try

ISS Default directory, was originally C:\INETPUT\WWWROOT
and change to:

C:\lianja\cloudserver\tenants\public\wwwroot
You do not need to change the IIS default directory. That would interfere with existing web configuration.

The Lianja extension takes care of all that based on how it is configured.

I run with IIS and did not change the IIS default directory.

Some clients do not like the idea of using mapped network drives.

That doesn’t seem to be an issue.

In my testing, I create the public folder shared on the cloudserver (it is installed on the server as C:\Lianja\cloudserver\tenants\public\.

Then in the client desktop shortcut, I just set the target to the runtime library, and then use \\myservername\public\apps\myapp

like so.

Code:
C:\Lianja\bin\lianjaruntime.exe -a \\myserver\public\apps\<appname> –nosplashscreen

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s