Writing web applications with quorum

The quorum programming language has a little known feature which you can use to create web applications. The quorum program is translated into a java servlet. Quorum masks the complexities of creating the servlet. You can then call the program from a form. You can pass the program parameters via get or post requests. You will have to generate the output dynamically in the form of a HTML page or whatever other end point format you want to use. Most of your code can remain unchanged. The key differences between a web and desktop application are below.

  • you need to use the following libraries.
    • use Libraries.Web.WebResponder
    • use Libraries.Web.WebResponse
  • The main class will have to be derived from the webresponder class.
    class Main is WebResponder
  • The main function changes. You need to use the following function.
    action Respond(WebRequest request) returns WebResponse
    WebResponse response
    //your code
  • You output data to the client by using the following function.

    response:SetPageText("text to output")

The other thing you need to do is to account for situations where web aparameters are not specified. This can happen if you are using a form and the user specifies a blank parameter. You do this using the HasParameter function of the request object.

if request:HasParameter("name of parameter")
//code for handling blank parameter
//do something

Creating the program

If you are using sodbeans, go into the project’s properties and set the application to web server. Build the program and you will get a war file. You may want to change the name of the war file before building it. You can do this from the project properties dialogue. The edit box containing the name of the final project has the value of default. You can change this to whatever name you like. Once you have the war file, you move it to Tomcat’s webapps folder. In its default configuration, tomcat will deploy the web application automatically.

Calling the program

You can call the program by using its name. See the beginning of the

tag below.

The name is the same name you specified in sodbeans in the project pproperties.

Handling static resources

Your program can refer to static resources. These are not included by default in the war. You need to upload them separately. The root folder for servlets changes depends on a variety of settings. Use the
GetWorkingDirectory() method of the File class to get the servlet path. You can then copy your resources accordingly to that path and reference them as you do regularly. One of the challenges in this process is seeing the value of the working directory. You can either output it in HTML or use an output statement. The items printed by the output statement are recorded in catalina.out in the tomcat/logs folder on Linux and in the tomcat9-stdout.date.log file on Microsoft Windows.

Debugging web applications

The biggest strength when using quorum to write web server applications lies in debugging. You can change the application type to standard and then manually pass parameters via the request object. You get a jar file instead of a war file. Beware that the main action is called instead of the Respond action. See the below code from my chat bot application.

action Main

output("main method invoked")
text qt=""
WebResponse wr
WebRequest wq
output("about to invoke input")


Once again, the main function is ignored when you switch to a web application.


Quorum is one of the few languages where transitions to different program running contexts is almost seemless. You can run your programs as web servers, as desktop applications, as mobile apps and as client side java script. The key differences like in the plugin architecture and in the way you reference resources. One of the key advantages of a web application is that you can continue using the same plugin infrastructure and no rewriting is required in the majority of cases.


Thanks to Professor Andreas Stefik, the lead creator of quorum for helping understand key aspects of the web application framework.
Thanks also to the members of the quorum list who continue to answer my questions about quorum queries.

Filed under: commonTasks — Tags: , , , , , — security-writer @ June 3, 2017 23:26

How to install Program-O with the LEMP stack

Program-O is an environment that allows you to host chatbots. As of this writing, it is AIML version 1.1 compliant. Its interface is easy to use and you can get started easily. However, installation can take some time and troubleshooting. Here is the guide I wish I had when I began installing Program-O.

My environment

  • Ubuntu 16.04 64bit
  • Nginx
  • MySQL
  • PHP
  • Vmware workstation and player version 12 running on Windows 10 professional 64bit.
  • Your machine obtains its IP address automatically via DHCP.

Prepareing Ubuntu

If you are starting from scratch, let the automatic installer handle the creation of the virtual machine. Follow the prompts and you will be fine. The only thing you should change is the network connection. I have set mine to bridged and to replicate the state of the physical network connection. This way, the virtual machine gets its own IP address and comes up with a working connection to your LAN. Once you have ubuntu installed, you will have to add a SSH server. You can install this using the gui but I will cover the commandline approach. Once you are at the ubuntu desktop, hit ctrl+alt+t to get into the terminal. Then type
sudo apt-get update
to ensure that the package repositories are updated and then type
sudo apt-get install openssh-server -y
this command will download and install the SSH server.
You can then run ifconfig to see the address that has been assigned to your virtual machine.
Exit the terminal and return to Windows. Use a terminal emulator to login into your virtual machine.

Configuring users and groups

You do not run as root in ubuntu. The user you created at the time of installation has sudo access. It is tempting to do everything as root but avoid that temptation because you may have to do a fair bit of ownership changes once you are ready to deploy your machine. You need to add your user to the www-data group. You will need this to work with nginx. To do this, run the following command.
usermod -a -G www-data bob


I am working on the assummption that bob is your user name.
This completes the ubuntu configuration.

Installing git

You will need a git client to pull Program-O from its git repository. Git is not installed on ubuntu by default. You can install it by typing the following command into the terminal.
sudo apt-get install git -y

Installing the components required for Program-O


The first thing you need is the MySQL database server. You can install it by issuing the following command and following the prompts.
sudo apt-get install mysql-server -y
You should secure your MySQL installation. Run the following command.
sudo mysql_secure_installation
You do not need the test database. Once this script has finished running, login into the MySQL database by typing the following command.
mysql -u root -p
Once you are in, you need to create a database. You can do this by issuing the command
create database bots;
You need a database user too as you do not want the root user doing any work with the database.
CREATE USER ‘botmaster’@’localhost’ IDENTIFIED BY ‘bot123’;
you then issue the command
use database bots;
At this point, you have a user and a blank database but the user cannot do anything. You need to make the user capable of administering the bots database.
GRANT ALL PRIVILEGES ON * . * TO ‘botmaster’@’localhost’;


It is now time to setup the web server which is nginx. To install nginx, issue the followig command at the terminal.
sudo apt-get install nginx -y

Install php

It is time to install php. Nginx can serve static content but your chatbot is dynamic content because its input and output will change. Program-O also needs to write configuration values to the server.
sudo apt-get install -y php-fpm php-mysql php7.0-mbstring php7.0-zip php7.0-xml 
You need to change one setting in the php configuration to make things more secure. See the references section for details. Execute the following command.
sudo nano /etc/php/7.0/fpm/php.ini
You can use any editor of your choice.
Change thecgi.fix_pathinfo=1 to
remembering to uncomment the above line.
Restart the php preprocessor by issuing the following command.
sudo systemctl restart php7.0-fpm
also restart the web server by using the below command.
 service nginx reload

Configuring nginx to use php

If you have followed this guide, everythingng that you need to run Program-O should be installed. You have to configure nginx to use php. This involves careful editing of the nginx configuration file. Do not be distracted by the comments in that file.
sudo nano /etc/nginx/sites-available/default
Again, you can use whatever editor you want.
The first thing we do is to set our server’s name or ip address to prevent unnecessary warnings. The chances are that you do not have a local domain name server running so set the IP of your virtual machine here.
server_name 192.168.xx.xxx
Find the line that reads
root /var/www/html;
Note the line below it.
index index.html index.htm index.nginx-debian.html;
You need to add index.php to the above line so that nginx first servers files with a php extention. The modified line looks like this.
index index.php index.html index.htm index.nginx-debian.html;
You now need to uncomment the following lines.
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
location ~ /\.ht {
deny all;
Once you have completed these changes, save the file. It is crucial to test it for errors. To do this, run the following command.
sudo nginx -t
If there are no errors, move on. If you encounter errors, recheck what you changed.

Installing Program-O

You need to get the Program-O files into the web root of your web server. This should be /var/www/html if you have not changed this in nginx. To install Program-O, do the following.

  1. cd /var/www/html
  2. sudo git clone https://github.com/Program-O/Program-O.git

Setting ownership and permissions

One of the trickiest things when configuring web servers and web applications is to set the right ownership of files and folders. You have to get this right else php will be unable to write configuration information or logs may not be generated in the event of errors etc.
The web server files should not be owned by root and php should be permitted to write to the folders under the Program-O folder.To do all of this, execute the following commands.
sudo chown -R www-data:www-data /var/www/html/Program-O
The /var/logs/nginx folder should also be owned by www-data so that logs can be created.
sudo chown -R www-data:www-data /var/log/nginx

Running the installation script

You are ready to run the Program-O installation. Launch a web browser and navigate to the following link.
Follow the prompts and if there are no errors, you should be good to go and setup your chatbot.


Filed under: commonTasks,robotics — Tags: , , , — security-writer @ October 2, 2016 12:53

Using the keyboard to create a contact group in Microsoft Outlook 2013

Many times, you would be in a situation where you need to communicate with a group of people. Addressing a message to this group is made simple by using contact groups. A contact group is a mechanism that allows you to combine a number of contacts into one. You place the group in the “to” field of a message and the e-mail is sent to everyone. Be warned, all the recipient addresses are visible therefore it is better to blind carbon copy the recipients by placing the name of the contact group in the “bcc” field. The approach below is a keyboard centric way of creating contact groups. Most other tutorials focus on using the mouse.

  1. Launch outlook.
  2. Go to the ribbon by tapping the alt key; navigate to the entry called “new items”. It is in the new group.
  3. Expand it by pressing the right arrow key.
  4. Arrow down to the “more items” entry and expand it by using the right arrow key.
  5. Arrow down to contact group and press enter.
  6. You will be in a dialog box where you can enter the name of the group. Do so.
  7. Press the tab key once to reach the members list box.
  8. Activate the ribbon and navigate to the item called “add members” It is in the Members group.
  9. Expand that group.
  10. Choose the source from where you are adding a member. I chose the source called “from outlook contacts”.
  11. You will be in the contacts folder. You can search for contacts here.
  12. Once you have found a contact you want to add, tab to the “member” button and press it.
  13. Repeat steps 11 and 12 until you have added all the contacts you want.
  14. Once you have finished, navigate to the ribbon, choose “save and close”, answer in the affirmative to prompts asking you if you want to save.

Filed under: commonTasks — Tags: , , — security-writer @ July 8, 2015 21:53

How to delete individual messages in WhatsApp messenger on the iPhone

WhatsApp messenger has become one of the most popular messaging apps around. We get everything from business meeting schedules to photos of grandchildren on WhatsApp. People use the term “whatsapp” as a synonim for messaging.

Those of us on active WhatsApp groups get several messages per day. We may not want to store all of them. If you want to delete messages selectively, follow the below steps.

  1. Navigate to a conversation out of which you want to delete messages and open it.
  2. Hit the button labeled “Edit.”
  3. Navigate to the message you want to delete and tap it to select it.
  4. Do the same for any other messages you want to delete from that conversation.
  5. Hit the button labeled “Delete” which is to the right of the button labeled “Share.”

That is it, you have selectively deleted messages from your whatsapp conversation!

Filed under: commonTasks — Tags: , , , — security-writer @ October 26, 2014 19:11

Getting your contacts back in Outlook 2013 after iCloud synchronization

I had had the iCloud control panel installed for sometime but had not sined in. I wanted to get my Outlook calendar appointments on to my iPhone so was forced to synchronize my contacts, calendars and tasks.

Apple, please give me a choice of what to synchronize.

I let the synchronization finish and then looked at my contacts folder.

My regular contacts folder was blank. All the contacts had been moved to the iCloud contacts folder.

There were all kinds of instructions showing me how to asociate my iCloud contacts folder with Outlook such that it became my regular addressbook. I did not want any of that. I wanted my contacts back. One of the most agrovating things about the iCloud contacts folder is that it is not possible to address a message from it. There are none of the “to”, “cc” buttons that I am used to. Moreover, when I hit alt+. in the “to” field of a message, I am unable to search for a contact.

I finally found a way to move my contacts back to the regular contacts folder using the keyboard. My thanks to Diane Poremsky who indicated that this was possible.

Yes, I prefer using the keyboard.

  1. I navigated to the iCloud contacts folder using the treeview invoked by hitting ctrl+y in Outlook 2013.
  2. I hit ctrl+shift+end to select all the contacts.
  3. I then hit the windows key to activate the context menu.
  4. I navigated to the “other folders” option using the arrow keys.
  5. I was able to navigate to my regular contacts folder.
  6. I then hit ctrl+v to paste the contacts back.

Filed under: commonTasks — Tags: , , — security-writer @ June 28, 2014 19:50

Raspberry PI video streaming: a note on resolution

I wanted to use my raspberry pi model B as a video camera. A search lead me to the following 2 links.
Remote Motion-Activated Web-Based Surveillance with Raspberry Pi
for a good overview of the process.
href=”http://www.codeproject.com/Articles/665518/Raspberry-Pi-as-low-cost-HD-surveillance-camera”>Raspberry Pi as low-cost HD surveillance camera
for details on installing motion and camera housing.

One of the things I had to do was to stream the video at a sufficiently high resolution so that it was useful to my end user. Most articles on the Internet tell you that this is a trial and error thing. This is correct. There were times when I just wanted a set of values to try. The maximum resolution I have been able to achieve is 640 by 480 pixels. Anything higher appears to make motion restart constantly. I am streaming at 8 frames per second.

As for viewing the stream, I am using Firefox.

Filed under: commonTasks — Tags: , , , — security-writer @ June 14, 2014 10:49

Outsmarting that malicious document

Most of us would be familiar with the injunction not to open executable attachments. Executable attachments are those files which are sometimes attached to email messages and can be run directly by clicking on them. These days most people have stopped sending executable files via email. A majority of Internet service providers filter out such files. Attackers have now adapted to use documents as a vector of attack. The objective of the attacker as always is to gain control of at least one machine in your network. Once he does that, he is easily able to go through the network and gain control over other machines. Yes, it is possible to have defenses in place and isolate the machine the moment it is infected but that is the topic of another post. Here, I would like to tell you how to avoid getting trapped by malicious documents.

We need to step back and understand why documents work as a vector of infection. Today’s word processors and file readers are very sophisticated applications. They can render almost any kind of file in whatever fancy format you wish. More importantly, they can execute bits of programs as they open. This capability helps you submit things like forms in PDF files, use macros in Microsoft Office applications et cetera. It is this capability that malware authors have begun to exploit. Let us take Adobe Acrobat Reader as an example. Acrobat Reader is a powerful application that can render a variety of PDF files. These files can not only contain text and graphics but also multimedia content. Moreover, you can have forms and other objects embedded in PDF files. Over the years, Adobe has done a significant amount to ensure that malware does not break out of the Acrobat Reader sandbox. However, it sometimes does and this is where the problem starts. As of this writing, there is no way to disable executable content in Adobe reader. The only thing you can do is mitigate the effects of the malware.

In Microsoft Office, from version 2007, Microsoft has made the primary word document format such that it cannot contain executable code. Any file with a docx extension cannot contain word macro code. You need to use a special kind of file which is known as a Word macro enabled file if you want to use macros in your Word documents. The same applies across Microsoft Office.

I am not going to debate which approach is better. Things can and do go wrong. Here are the steps you need to take to mitigate the impact of malicious documents.

  • If you do not expect an attachment, do not open it. The usual caveats about spam apply. Remember, there are no free lunches.
  • As far as possible, do not run with administrator privileges. As long as you run with restricted privileges, even if malware breaks out of the Adobe sandbox or otherwise infects your computer, it will be limited to the privileges assigned to the current user. Malware can escalate its privileges but it needs a hook and that hook is harder to get when you are running as a nonprivileged user.


    I use the term hook in the loosest possible context. Any programmers reading this post should not mistake the term hook for the hook that is used when dealing with Windows messages.

  • Ensure that you keep your systems and applications fully patched. Companies are quick about patching vulnerabilities that are found in their programs.
  • As with any malware mitigation strategy, keep backups handy in case the worst happens.
  • Use services such as open DNS on your Internet infrastructure so that it is harder for malware to phone home.
  • Keep anti-malware applications updated.

Filed under: commonTasks,networking — Tags: , , , , , — security-writer @ December 30, 2013 20:51

Getting Google+ Authorship to work on your WordPress blog or website

if you run a blog or website, you could be forgiven for thinking that Google author is the next best thing to sliced bread. The problem is that with WordPress version 3.6, there is no way to enter a Google author URL or id. I spent countless hours searching the settings of my blog without success. I mentioned my frustration to Megarush who told me about how WordPress had decided not to put in the Google author related options into version 3.6. The Google author related options were incorporated into plugins. Some more searching led me to the following post which explains how Google author is to be enabled.
How to Implement Verified Google+ Authorship on Your WordPress Website

I searched for “google author” and found the plugin called “Google author+ Plugin” by Dan Taylor. I installed and activated it. I went into my WordPress profile and added my Google+ profile id.

I then tried the structured data tool to test if my blog had been associated with my Google+ profile. No go. Google was unable to retrieve any authorship information from my blog.

After a significant bit of head scratching and keyboard pounding I concluded that I needed something to populate the meta tags of my previous blog posts. The Google+ Author plugin just added my profile id to WordPress. There was no mention of it adding Meta information to posts that were already made on the blog.

the solution was the plugin called Single Author G+ META. Once I had installed, activated and configured it, Google reported that Google+ authorship was working.

when implementing Google+ authorship for your blog, do ensure that you add meta information to the posts that you have already made.

If you liked this post and need similar material written, please use the contact form on the Contact Me webpage to get in touch with me.

Filed under: commonTasks — Tags: , , , — security-writer @ August 11, 2013 12:07

Attending conference calls using a touch screen phone

Many of us at one time or another would need to attend a conference call. In such a call, , the participants dial in from various parts of the world. There is a conferencing bridge which serves as a virtual meeting place. There are certain challenges when dealing with such calls especially when using touch screen phones.

the problem with touch screen phones is that you cannot dial if you hold the phone close to you. You can place the phone on a table and use a headset and dial in that way but a better approach is to enter the conference dial in string as a mobile number. The dial in string is composed of 3 components.

  1. The dial in number for your city.
  2. The conference id.
  3. The conference pin.
  4. Note

    • This may vary. Some bridges just require a conference id.
    • You may not have a local phone number so would have to call the bridge global number or the bridge number in another city.

    The idea is to avoid having to enter your credentials instead have the phone enter them. This is done by building a suitable dial in string which is the series of keys you would push if you were working interactively with the IVR.

    The trick in building conference strings is to insert suitable pauses while the interactive voice response system is speaking. You insert a pause by adding a comma (“,”) to the dial in string.
    Take the below string as an example.


    The reason for the 8 commas after the phone number is to wait until the advert which plays when you connect to the service. Many services insert messages that are played when you connect to them. In the above case, this message is an advertisement.

    Finally, it is better to dial in from a mobile phone since you can mute yourself easily. One problem with conference bridges is that people remain unmuted and everyone else gets a lot of background noise. The conference organizer can also mute a participant but that is more work. In addition, you may not want everyone to hear what is happening in your space.

Filed under: commonTasks — Tags: , , — security-writer @ July 2, 2013 22:04

Coping with 2 SIM cards

It has become common to find yourself in a situation where you need to use 2 Sim cards. Many companies give their employees mobile numbers. You have to use that number since calling your colleagues is free. The problem that many people face in this situation is how to get calls and messages from one phone to the other. There are a few solutions that are possible in this situation.

Using two devices

This is the most common solution that people adopt. You carry 2 mobile phones with you. Each phone has its own Sim card and you use them as necessary. The problem (more…)

Filed under: commonTasks — Tags: , , , — security-writer @ January 10, 2013 21:53
Older Posts »