Simon Buckle's Weblog

Random thoughts for random people

Multi-Tenancy

one comment

I attended the Alfresco conference in London in the middle of November and there was a fair amount of talk about Alfresco’s cloud offering that – if it’s not already available – was due to be launched fairly soon. It will be a hosted service and will allow a single instance of Alfresco to host multiple sites (or tenants). This is usually referred to as multi-tenancy. There are a number of different approaches but the simplest one involves sharing the same database; at the database level you can think of each entry in a table, e.g. forum posts, having something like a site ID column that indicates which site the entry belongs to.

I started thinking about it and I don’t get it. I understand technically how multi-tenancy works; I just don’t see the benefits of making an application multi-tenant aware! More…

Written by admin

December 27th, 2011 at 4:38 am

Posted in Uncategorized

Yubico Java Client Changes

leave a comment

Just a quick note. As part of the integration work I did getting YubiKey to work with Alfresco, I also added support for signatures and making validation queries in parallel to the Yubico Java client (I forked the original client) so it should now work with version 2 of the validation protocol; see this FAQ. Hopefully I didn’t fork it up!

You can grab it from my GitHub account: https://github.com/sbuckle/yubico-java-client

If you do decide to use it, you might want to pick and choose which bits you want to pull as I have made other changes not related to the enhancements in version 2.0 of the validation protocol. Now I wonder if I’ll get my five free YubiKeys ;)

Update: I did. Just ordered them. Thanks Yubico :)

 

Written by admin

October 4th, 2011 at 11:29 pm

Posted in Uncategorized

Two-Factor Authentication with Alfresco

leave a comment

So what is two-factor authentication? I’ll defer that explanation to the Wikipedia page on the subject. Most systems require users to identify themselves using a username and password. The problem is that if people choose a weak password, which evidence suggests they do, suddenly your secure authentication system is not so secure. Using “something you have” in the authentication process makes it much more secure. Take cash machines as an example. If I discover your PIN number, I can only take money out of an ATM if I am in possession of your bank card. Without the card, knowing the PIN number is not going to help me steal your money.

I’ve created an Alfresco extension that implements two-factor authentication using a YubiKey.

What is a YubiKey? It’s a device that you plug into your USB port and it generates one time passwords (OTP). It’s similar to RSA’s SecurID, only a lot cheaper. So now, in addition to specifying your username and password, you also have to submit a OTP when logging in – the OTPs are validated by Yubico’s servers.

Using a key like this makes logging in a lot more secure as it is now no longer possible to log in just using a username and password. In addition, each key is tied to a particular user account – the extension takes care of this – so it’s not possible to just use any key; the user has to use the key that has been (uniquely) assigned to them. The screencast below shows how it works.

I will release the extension shortly. You can download the extension from here. I’ll be attending Alfresco DevCon in London so come and say hi and I can give you a live demo of the system. In the meantime, if you have any questions, feel free to leave a comment or send me an email.

Written by admin

September 29th, 2011 at 12:27 pm

Posted in Uncategorized

Using Hadoop to Analyze Apache Log Files

2 comments

After my post a few days ago about analyzing Apache log files with Riak, I thought I would follow that up by showing how to do the same thing using Hadoop. I am not going to cover how to install Hadoop; I am going to assume you already have it installed. What is it they say about assumptions? Also, any Hadoop commands are executed relative to the directory where Hadoop is installed ($HADOOP_HOME). Read More…

Written by admin

September 1st, 2011 at 6:29 am

Posted in Uncategorized

Analyzing Apache Logs with Riak

leave a comment

This article will show you how to do some Apache log analysis using Riak and MapReduce. Specifically it will give an example of how to extract URLs from Apache logs stored in Riak (the map phase) and provide a count of how many times each URL was requested (the reduce phase).

So what is Riak? According to Wikipedia it’s “a NoSQL database implementing the principles from Amazon’s Dynamo paper”. Or, put another way,  it’s a distributed key-value store that has built-in support for MapReduce. If you aren’t familiar with MapReduce a good starting point would be to read Google’s MapReduce paper. I am not going to go over how to install Riak; there’s a good tutorial for that on the Riak website. Riak also has a lot of other features that won’t be covered here. Read More…

Written by admin

August 27th, 2011 at 8:59 am

Posted in Uncategorized

Displaying JIRA Issues In Alfresco Share

2 comments

I decided to submit a dashlet to Alfresco’s dashlet challenge. Basically, it’s a user dashlet for Alfresco Share that shows the user all of their JIRA issues that are either already overdue (shame on you!) or issues that are due to be completed soon. The idea behind it is that you can see at glance on your dashboard what issues you have to deal with right now. Read More…

Written by admin

August 12th, 2011 at 2:27 pm

Posted in Uncategorized

Picture Perfect

leave a comment

This post kind of follows on from my previous post about creating thumbnails from a video. It describes how to take a snapshot with your webcam using Flex and then save the picture to your server. I decided to create my own little app to do this, originally because I wanted to take a snapshot of something and create a blog post from it from within the WordPress editor – it appears that out of the box you can only select and upload an image from your hard drive. There is an option in Facebook to take a picture when sending a message. I wanted something similar for WordPress. I am guessing there is a probably a plugin somewhere out there that does this, which would be nice as it would save me from having to write my own.

So, on with the solution. I came across a number of solutions – like this one - that appeared to involve creating an HTTP request then manually creating a multipart message, which seemed overly complex to me! Anyway, I vaguely remembered writing some Flex code a while back that did what I was looking for and after spending far too long searching for it on my laptop (don’t ask!) the solution turns out to be much simpler than the ones I had come across out there in Internet land.

Basically, you dump the data from the webcam into a bitmap, convert the bitmap into a JPEG, encode the bytes using base64 and then send the data (as a string) in an HTTP POST. I am not going to replicate the code here to do this as you can view it by taking a look at the webcam snapshot example. To view the source, right click on the page then select “View Source”. The example code relies on as3corelib – I use one of the classes in the library (JPGEncoder) to convert the bitmap data into a JPEG.

The example does an HTTP POST to a simple PHP script that just displays the snapshot you took. The code looks like this:

<?php

header("Content-type: image/jpeg");
echo base64_decode($_POST['image']);

?>

 

Simple eh?

So that is how to take a picture with your webcam and save it to your server using Flex.

Written by admin

July 1st, 2011 at 8:39 am

Posted in Uncategorized

YUI Compressor Ant Task

leave a comment

I was working on a project recently that contained a number of JavaScript files. As part of the build process, I wanted to minimise/compress all of the JavaScript files. The first thing that came to mind was to use YUI Compressor.

I was using Ant at the time so I needed to create a target to compress the JavaScript files and then output them to wherever they needed to be outputted to. Problem: By default, YUI Compressor can only handle one file at a time; you can’t pass to it a list of files to process. Damn! Anyway, to cut a long story short, I created a custom Ant task to do that for me. Hoorah!

I’ve set-up a repository on Google Code where you can download the code that generates the custom Ant task. Yes, I know it’s fashionable to create repositories on GitHub but I mostly use Subversion and Mercurial so there!

Alternatively you can check out the project directly by issuing the following command:

hg clone https://yui-compressor-ant-task.googlecode.com/hg/ yui-compressor-ant-task

Technically, it is possible to get the desired behaviour using Ant’s apply task; see the post here and the example under the heading, “Minify your JavaScript and CSS files”. I must admit, I only came across this after I had already developed my version; however, there are still reasons to use it. YUI Compressor supports a number of different options and to include a sub-set of these using apply would start to get ugly and (possibly) cumbersome. My Ant task is a bit neater. Well, I think so anyway.

Written by admin

February 20th, 2011 at 12:00 pm

Posted in Uncategorized

Body Recomposition Experiment

leave a comment

The other day my copy of The 4 Hour Body arrived. I read the author’s other book – The 4 Hour Work Week – a while ago so I thought this would be fun to read, especially as I recently joined a gym after about a 1.5 years of doing little in terms of exercise. Years ago I used to do a lot of weight lifting so I have always been interested in the science of exercise despite my recent hiatus. As I now have the time I thought I would try out some of the experiments in the book for myself.

First experiment: The Slow-Carb Diet or, as the book claims, “How to Lose 1.4 stone (9kg) in 30 Days Without Exercise!” I am going to start this tomorrow (Tuesday). Basically, none of the following are allowed: pasta, potatoes, bread, rice, cereal, milk, fruit etc, except for one day a week when you can eat whatever you like and have as much of it as you want. Sounds good to me!

Here’s an example of some of the meals I will be having:

  • Breakfast: Eggs, lentils, spinach
  • Lunch: Chicken, black beans, mixed veg, guacamole
  • Dinner: Fish, borlotti beans, more spinach, mixed veg

The only other thing I will be taking is a calcium and magnesium supplement (1 capsule a day); I intend on getting all the potassium I need from the copious amount of spinach I will be eating. I drink about 1.5 litres of water a day anyway so won’t need to change anything there. I intend to continue with my 3 gym sessions a week but I’ll probably keep it fairly light while I’m on this diet.

Judging by some of the body fat example pictures from the book (here and here) I reckon I am probably somewhere between 12-15% body fat. I still need to find a tape measure as I haven’t done any of the measurements, e.g. waist, bicep, thigh etc, as the book instructs you to do (twice!) before starting.

I am going to give it a go for at least two weeks but probably not much more than that. I don’t really need to lose weight but as I intend on going away somewhere warm for a few days soon it won’t hurt to try and get a bit more some definition for the beach :)

Update: I’ve added a food diary page to record everything I eat

Written by admin

February 14th, 2011 at 9:21 am

Posted in Uncategorized

It’s Quitting Time!

leave a comment

One week ago today (last Friday) I left the DMI project at the BBC. Was time for a change, among other things that I am not going to go into.

So what’s next? No idea. Downtime. Vacation. Catch up on sleep.

I’ve got a backlog of books to read and a few ideas for some projects that I have been meaning to start for a long time now, including a lot more writing.

In one word: Freedom

Written by admin

February 11th, 2011 at 3:08 am

Posted in Uncategorized