Sunday, July 27, 2014

Working with Library Stacks


This tutorial is written explicitly for LiveCode 6.6.2 Stable and might not work with other versions. The tutorial will not be updated!

Using Mainstacks as Libraries

When you work on a large Livecode project you'll want to include libraries that contain re-usable commands and functions. You can do this by adding a mainstack to your project as substack. This is neat but when an update has been added to the library stack you'll have to delete the Substack and add it again.

The better solution is to load the libraries in as Mainstacks. This way each time you open your stack the library stacks will be loaded on demand. The Mainstacks will only be loaded if you have loaded them using the "start using" command. Otherwise they'll not be loaded.

To tell the Mainstack to load in other Mainstacks as libraries open the Property Inspector of the Mainstack and choose Stack Files. Click on to the small folder icon to choose Mainstacks that should be loaded if you open your stack.


Once you've added the stack files you can load them with the the start using command:

on preOpenStack 
  start using "LibJson" 
  start using "LibUuid" 
  start using "GenericCouchDb" 
end preOpenStack

Once you've loaded the Mainstacks with the start using commands and re-open your stack you'll see that the other stack files are loaded in automatically:


Including the stacks in to your application when building

The above works nice in development mode. But you'll also have to make sure that the stacks are built in to your standalone application. To do this you'll have to copy the files in to your application folder.

Click on to File -> Standalone Application Settings -> Copy Files


If all the files are in a lib directory for example you can choose Add Folder and choose the lib folder. But you can also add single stack files by clicking on to Add File.

Using relative paths

If you want to open the stacks from a relative directory as for example ../lib you will have to load the stacks over script.

put the effective filename of this stack into tPath
set the itemDel to slash
delete the last item of tPath -- deleting the stack file name
delete the last item of tPath -- deleting the folder the stack is in
put tPath & "/lib" into tPath
set the defaultFolder to tPath -- sets the default folder to the new path

open stack "YourStack.livecode"
start using "YourStack"

As an alternative you can use following command:

set the stackFiles of this stack to "My Dialog,Custom Dialogs.rev,..."

Wednesday, July 9, 2014

Install LiveCode Community Server 6.6.2 on Debian


This tutorial is written explicitly for LiveCode 6.6.2 Stable and might not work with other versions. The tutorial will not be updated!

Install Apache

sudo apt-get install apache2

LiveCode currently depends on 32bit libraries. If the Debian distribution is 64bit then following commands need to be executed:

dpkg --add-architecture i386
apt-get update
apt-get install libc6:i386

Setup directory structure

cd /var/www
sudo mkdir cgi-bin
sudo mkdir
sudo mkdir
sudo mkdir

Download the LiveCode Community Server

Login to the LiveCode site. Or you can also go to

Click on to the Download link on the left and then click on to View All LiveCode Downloads


Click on to Linux just below the header called Community Server


Upload the zip file to your server:

scp ~/Downloads/

Unzip the file in your home directory on the server:

mkdir livecode662
mv livecode662
cd livecode662

Make sure that the livecode-community-server file is executable:

chmod 755 livecode-community-server

Move the folder in to /var/www/cgi-bin

sudo mv livecode662 /var/www/cgi-bin/

Setup the Apache configuration

Enable mod_actions:

cd /etc/apache2/mods-enabled
ln -s ../mods-available/actions.conf .
ln -s ../mods-available/actions.load .

Go in to the configuration directory:

cd /etc/apache2/sites-available

Create Apache configuration file /etc/apache2/sites-available/

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

<Directory "/var/www/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
AddHandler livecode-script .lc
Action livecode-script /livecode-cgi/livecode-community-server

<Directory "/usr/lib/cgi-bin/livecode662/">
Options ExecCGI
Order allow,deny
Allow from all

ScriptAlias /livecode-cgi/livecode-community-server /usr/lib/cgi-bin/livecode662/livecode-community-server

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.

LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined


Enable the configuration:

cd /etc/apache2/sites-enabled/
ln -s ../sites-available/ .

Restart apache:

sudo apache2ctl start

Once finished try logging in over following URL:


  • Make sure that the directories are "chmod 755" within the cgi-bin folder.
  • Make sure that the slashes at the end of the directory pathes are present in the user apache conf script.

Development Frameworks

RevIgniter - Full blown MVC Framework - Use with TextMate 2.0-Alpha for Color Coding
RevSpark - Minimal Web Framework - Use with TextMate 2.0-Alpha for Color Coding