Monday, April 29, 2013

Querying QuickBase

QuickBase is a nice tool for quickly creating data-centric web applications without having to write any code. It basically allows you to define table similar to the way you would a database, but also give you roles, permissions, reports, forms, emails, etc all in one place. If you are familiar with Custom Lists in SharePoint you will see how this is very similar.

Once you have a table created in your application you may want to show that data in another web application. You can do that use a POST or GET request. For our purposes we will be doing a GET request since it doesn't require any coding and is easiest to play with.

Here are the API docs. Of particular interest are the following:
  • api_authenticate-- you will need this to get the authToken if you are not logged in
  • gen_results_table -- does all the heavy lifting
  • do_query -- use this to create your own custom query instead of a existing view
  The example below shows how to return all rows in the table that match the criteria I pass it using a GET request. You can also customize the query.

According to the sample here, you can embed the QuickBase on your page by doing something like the following:

<html><head> <script lang="javascript" src=></script> <style> td.m { font-family:verdana; font-size:70%; } td.hd { font-family:verdana; font-size:70%; font-weight:bold; color:white;} </style> </head> <body> <h3> content below:</h3> <script lang="javascript">qdbWrite();</script> </body></html>

Finding the parameters we need using the UI

While this is pretty easy to do the stuff above, you need to know what to put for the placeholders in red. First thing I recommend is log into using your favorite browser. Click on the tab for the application you want to access. Next click on one of the reports. Now take note of the url. It should map pretty closely to the following:

The host will be your host. The stuff after db/ and before ?a= will be your dbid. The qid variable is the id (integer) of the report you want to use. In this example, the report id is 1. Now, just use those same values in the url for the javascript src attribute (replacing the items in red with the values you see in the url to the report).

In the above example, we will not be getting the authToken (QuickBase calls it a ticket) and instead assume that you are already logged into However, if you are trying to display the on your own web page and you will be using a functional account for instead of each user that comes to your website having a login also you will need to get the authToken programmatically.  Read this discussion on how you might do this. The short answer is you COULD (but SHOULD NOT) pass the username and password via the url in the browser's address bar, because this is dangerous because even HTTPS does not hide urls stored in browser history. Thankfully, the url is enrypted from everyone except the browser and server computers. The url will be on the log files, but they already have access to your data so it should not be an issue.

So, I suggest making a HTTP POST request ON THE SERVER-SIDE (not client-side such as JavaScript) and using SSL to protect the functional username and password of the account that will be accessing Please note, JavaScript is accessible to anyone that cares to read it, so it is not a good way to do the HTTP POST. I recommend doing this on the serverside and passing it to your page. Keep in mind the authToken (ticket) in in the url for the JavaScript so, end users could get the content just by going to going to the url and doing exactly what we are doing here. This not a huge issue since they already have access to the page you are displaying the data. To minimize how long someone can use the url, you may want to make the ticket expire after 1 hour. 

Friday, April 12, 2013

Artificial Intelligence research/overview

Pattern Recognition

Pattern recognition is "the act of taking in raw data and taking an action based on the category of the pattern"[1]. Most research in pattern recognition is about methods for supervised learning and unsupervised learning.
Pattern recognition aims to classify data (patterns) based either on a priori knowledge or on statistical information extracted from the patterns. The patterns to be classified are usually groups of measurements or observations, defining points in an appropriate multidimensional space. This is in contrast to pattern matching, where the pattern is rigidly specified.

A wide range of algorithms can be applied for pattern recognition, from simple naive Bayes classifiers or k-nearest neighbor algorithm to powerful neural networks.

Facial Recognition uses Pattern Matching

Image and good info can be found at:


Data Mining
neural networks
genetic algorithms (1950s)
decision trees (1960s)
support vector machines (1980s).
Choice Modelling

Data mining
Data mining commonly involves four classes of tasks:[11]
·    Clustering - is the task of discovering groups and structures in the data that are in some way or another "similar", without using known structures in the data.
·    Classification - is the task of generalizing known structure to apply to new data. For example, an email program might attempt to classify an email as legitimate or spam. Common algorithms include decision tree learning, nearest neighbor, naive Bayesian classification, neural networks and support vector machines.
·    Regression - Attempts to find a function which models the data with the least error.
·    Association rule learning - Searches for relationships between variables. For example a supermarket might gather data on customer purchasing habits. Using association rule learning, the supermarket can determine which products are frequently bought together and use this information for marketing purposes. This is sometimes referred to as market basket analysis.

Rewriting or Graph Rewriting may be useful as well
Machine Learning and Pattern Recognition are really the same thing, but from different angles

Machine Learning
Algorithm Types:
Machine learning algorithms are organized into a taxonomy, based on the desired outcome of the algorithm.
·    Supervised learning generates a function that maps inputs to desired outputs. For example, in a classification problem, the learner approximates a function mapping a vector into classes by looking at input-output examples of the function.
·    Unsupervised learning models a set of inputs, like clustering.
·    Semi-supervised learning combines both labeled and unlabeled examples to generate an appropriate function or classifier.
·    Reinforcement learning learns how to act given an observation of the world. Every action has some impact in the environment, and the environment provides feedback in the form of rewards that guides the learning algorithm.
·    Transduction tries to predict new outputs based on training inputs, training outputs, and test inputs.
·    Learning to learn learns its own inductive bias based on previous experience.