Decisions!

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
ajperks
Posts: 60
Joined: Sat Sep 06, 2014 3:38 pm

Decisions!

Post by ajperks » Thu Dec 01, 2016 3:27 pm

I understand that livecode can be called from a website directly.
I am at the start of a project and deciding the path I should take. Your advice would be appreciated.
The project is to display book details, rather like you would see on Amazon. I suppose a datagrid might apply here as the way of displaying the combination of book cover and text alongside. Other books would be in the following lines.
Clicking a cell displays an enlargement of the cover or more details of the text, like reviews and synopsis.
Obviously the book details will be contained in a database because more will be added, others removed and text will change.
On the face of it, this would be easy using Livecode.
However, a user might have any device from computer to a small screen phone.
Also, to develop for a variety of devices would be daunting and unsatisfactory.
The user would have to download an app.
The ideal would be a web page, but with the tools I have, that is tricky with log on and database functions. Readers would only need to look, authors could use a PC/MAC app to alter their content on the database.

Question, can livecode be downloaded and run like a web page with this type of application?

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 311
Joined: Tue Apr 10, 2012 9:18 am

Re: Decisions!

Post by ghettocottage » Thu Dec 01, 2016 5:56 pm

The good thing about writing your application in Livecode is that you can start with whatever approach you think best, and then alter/add things as you go along.

Your core-code is going to be usable in a desktop app, mobile app or Livecode server-based website; as such, you can start by working out the skeleton of your application ( which is going to consist of your database server, how you talk to that server, and then your various queries back and forth to your database).

Once you have your framework in place, and some basic app working, you can play with different ways to present that.

One cool thing I recently discovered Livecode can do (thank @richardGaskin): you can have your stack on your server, and then create a "launcher" app. The launcher app does nothing really except requests the stack on your server, downloads it to memory, and then closes itself.

The advantage being that you can just distribute your launcher stack, and then continue working on the main-stack on the server..no need to update all the devices that have your launcher stack installed...as they will pull the updated version from the server at startup.

Also, the main stack can be told what to do based on what type of device is opening it...so you can have a different presentation for different devices.

Do you already have your database server? Have you looked into using Livecode Server as the intermediary between your database and app?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6716
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Decisions!

Post by FourthWorld » Thu Dec 01, 2016 8:14 pm

ajperks wrote:However, a user might have any device from computer to a small screen phone.
Also, to develop for a variety of devices would be daunting and unsatisfactory.
Phones and computers deliver fundamentally different user experiences, both in terms of how good designs handle the very different forms of inputs and how they manage the difference in screen sizes.

Whether imlpementated as a native app or confined to a browser window, the design decisions required for handling different types of devices are largely the same.

Most apps that are available both natively and on the web deliver a much stronger user experience with the native app. Consider LinkedIn, EverNote, Facebook, Twitter, etc.

As ghettocottage noted, there are ways to simplify deployment with native apps, but ultimately that's the smaller set of concerns.

The much larger issue is the design of the app itself, making sure it delivers a great experience across such very different device types.

For some tips on managing layouts, this post may be helpful:
http://forums.livecode.com/viewtopic.ph ... 22#p147391

These LiveCode Lessons may also be useful:

Displaying Assets On Differing Screen Resolutions
http://lessons.livecode.com/m/4069/l/28 ... esolutions

How do I support different device screen densities?
http://lessons.livecode.com/m/15262/l/1 ... -densities
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

sphere
Posts: 864
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Decisions!

Post by sphere » Thu Dec 01, 2016 10:22 pm

Hi Richard,

continuing on downloading a stack and run it.
I saw your message here: https://www.mail-archive.com/use-liveco ... 80604.html

So i thought lets try this.
So i uploaded a livecode file.
And made a test stack with a single button containing

Code: Select all

on mouseUp
   go stack "https://thiswebsite/externalstuff/lc/teststack.livecode"
end mouseUp
getting Error in Statement
so i also tried "go to stack "blabla" same issue.

Is it correct that the extension .livecode can be anything? like thisstack.jippee

maybe you have a little example? on how to correctly write the line to get the stack, the dictionary is too cumersome on this

Thanks!
Last edited by sphere on Fri Dec 02, 2016 6:20 pm, edited 1 time in total.
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6716
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Decisions!

Post by FourthWorld » Thu Dec 01, 2016 11:03 pm

My bad - should have been:

Code: Select all

go url "http://somedomain.com/somestack.livecode
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

sphere
Posts: 864
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Decisions!

Post by sphere » Thu Dec 01, 2016 11:07 pm

ah yes that makes sense :)

stupid of me too, did not think about it clearly

Thanks works!
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

AxWald
Posts: 361
Joined: Thu Mar 06, 2014 2:57 pm

Re: Decisions!

Post by AxWald » Fri Dec 02, 2016 12:05 pm

Hi,

the idea with a "launcher StandAlone" is great and versatile. Imagine a small size thing that has just one card, and a menu on it (or a few buttons). And, for sure, a bit of decoration ;-)
This one contains your basic logic, mainly functions to read/ write preferences files, encryption functions (if you use them) and the database interface. Compiled for the desired platforms it can be distributed freely, because without a proper prefs file it doesn't do anything useful - beside maybe launching a browser pointing to a web site where the project is explained, and where's a possibility to register, and to ask for said prefs file.

Now imagine the new user is accepted, and has received its credentials. Can be a plain text file, a link to one, a code file or a simple code to enter. Things that can be done now:
  • Decoding the credentials the fresh StandAlone Launcher ("SAL" from now) knows where to connect, what username and passwords to use etc. In a "firstRun" handler it can create its environment - for instance generating some keys, encrypting its own prefs file, populating menus, loading lib stacks, fonts, graphics that should be held local (for speed and responsiveness). After this it's personalized and ready to work.
    .
  • The SAL can now, depending on menu choice, load interface stacks as modules:

    Code: Select all

          put "http://myDomain.org/docu/apps/" & "myModule.rev" into myStack
          go stack url myStack in new window
    Since the SAL knows where it resides it can load the approbate version of the module - usually you'll have one for desktop & mouse/ keyboard, and one for mobile & touch.
    .
  • You can start further modules from one already loaded:

    Code: Select all

       go stack url myOtherStack in new window
       dispatch "EatThis" to stack myOtherStack with myMsg
    The receiving stack will set up itself using the data in "myMsg":

    Code: Select all

    on EatThis myMsg
       set the pData of me to line 1 of myMsg
       set the pIWasCalledFrom of me to line 2 of myMsg
       setUpUI
    end EatThis
    For sure you can pass all kind of data back and forth using this technique, just be sure to have set up a consistent way at first, or you'll debug more than you want later ...
    .
  • The sweet thing is now: Drop a new module stack version onto the web site, and as soon as your user reloads it, she has the new version! Never was patching this easy!
    And that's not all - you even can even live patch the compiled SAL itself, when set up properly:

    Code: Select all

       put the script of this stack into myScript
       set the script of this stack to myScript & CR & CR & myNewCode
    "myNewCode" can be loaded from the web, and the new code runs even w/o restarting! So carefully adjust the code in your SAL, and you can replace certain portions of it on the fly. And there's nothing to stop you to do this even in an encrypted way.
I hope this serves as further explanation to the posts above. And this isn't just an untested idea, the code above is (slightly altered) running at customers.

Have fun!
Livecode programming until the cat hits the fan ...

sphere
Posts: 864
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Decisions!

Post by sphere » Fri Dec 02, 2016 6:23 pm

Yes i like it.
I maintain a website for dutch veterans too. Especially the older ones this comes in quite handy.
And i can use this greatfully. It saves exporting to executable, saves creating an installer for people who don't understand how to treat a exe without installer. One time install only.
Super fast up and download as it is only say max 100Kb for example. Always the latest version.
:D :mrgreen: :D :mrgreen: :D :mrgreen: :D
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

Post Reply

Return to “Talking LiveCode”