Category Archives: Notes
I came across the Google-o-meter widget in the Google Charts API today, and had a perfect use for it in my current pet project, convict records.
For the uninitiated, the Google Charts API allows you to request an image with query string parameters and format it in various different ways to produce a pretty graph.
I wanted to display the severity of a convict’s sentence, relative to the known minimum and maximum sentence terms of other convicts I had in my database.
It took a little wrangling before I discovered that I really only needed a few parameters to achieve what I wanted – the final request HTML looked like this:
Lets break that down a little.
Range and Indicator Position
The Google-o-meter defaults to a range of 0-100, therefore the easiest way to position your indicator is if you can create a percentage value from 0-100. It does also support custom ranges but that is beyond the scope of this tutorial.
How do we determine the position of the indicator (in PHP)?
The sentence severity is the sum of the sentence term in question, divided my the maximum known sentence (in my case 47 years, multiplied by 100, and finally rounded for good measure. This gives a percentage result somewhere between 0-100%. 23 years = 50%, 47 years = 100% and so on.
Now that the sentence severity is known, all that is left to do is to pass the parameters to the Google Charts API.
The dimensions of the image length x height. *important* if you change the height value here, make sure you also change the <img> width and height attributes
The chart type – gm = google-o-meter
The indicator hexadecimal colour followed by the start colour and end colour (the gradient
Symphony CMS is relatively easy to install on a Ubuntu server.
Here are a couple of commands I issued on a clean Ubuntu install to get everthing I needed for Symphony CMS, including cloning the git archive.
- I chose to make a symbolic link from /var/www to my user directory, to skip writing a new apache site-available file, however for production purposes I would suggest to write a new proper apache2 site configuration file
- The default apache2 site-enabled file has “AllowOverride None” – this needs to be changed to “AllowOverride All” for mod_rewrite to work
- The php5-xsl package is vital for XSLT to work!
sudo apt-get install git-core apache2 php5 mysql-server php5-mysql php5-xsl
## now that mysql is installed, create a database and database user and GRANT PRIVILEGES ##
sudo a2enmod rewrite
sudo vi /etc/apache2/sites-enabled/000-default (change AllowOverride None to AllowOverride All)
sudo /etc/init.d/apache2 restart
git clone git://github.com/symphonycms/symphony-2.git
git submodule update --init
git clone git://github.com/symphonycms/workspace.git
ln -s /home/steve/symphony-cms/symphony-2 /var/www/symphony
chmod -R 777 /home/steve/symphony-cms/symphony-2/workspace
chmod 777 /home/steve/symphony-cms/symphony-2
## run web configuration now at yourwebsite.com/install.php ##
chmod -R 755 workspace
rm install.php install.sql workspace/install.sql update.php
See the git documentation for further reading.
If you need any clarifications, ask away in the comments section.… Read more
Had a nice little surprise today after getting a brand new computer, I had no audio available in Windows Media Player. This is basically a result of the machine not having the correct codecs – you’d think Microsoft would be smart enough to include this stuff by default, but alas no. Even after upgrading to WMP11 I still had no luck.
After a bit of research, I discovered if you have this problem, you likely need the AC3 codec. Its dead easy to install – just go here, get the installer and install and restart Windows Media Player.… Read more