Category Archives: Open Source

Setting up a VirtualBox development instance with NAT port forwarding

I just spent another couple of hours figuring out how to effectively re-install my development instance (Ubuntu Server running in VirtualBox on my Windows host) and thought I’d write it down for personal reference and in case someone needs it :).

  1. Install VirtualBox (of course)
  2. Install Ubuntu Server
  3. Enable port forwarding from 127.0.0.1 to 10.0.2.15 on port 80
  4. Install guest additions
    1. sudo apt-get install dkms build-essentials
    2. mount guest additions
    3. sudo mount /dev/cdrom /media/cdrom
    4. cd media cdrom
    5. sudo ./VBoxLinuxAdditions.run
  5. Reboot
  6. You’re done ! You should now be able to access your linux guest by going to localhost on your host 🙂

Now you might want to set up folder sharing and map your local www folder to /var/www, but that is easy from here I guess :).

Note: do not forget to sudo adduser “youruser” vboxsf to enabled permissions on your shared folder!

Development of an Android Application for Moodle – Pre-development (1)

As I am approaching the end of my time at King’s College London, I have to write a BSc project. In my case, I decided to write an Android application that interfaces with Moodle and a timetabling solution, to give students a nice client when they forgot to download their slides, take notes and interact with fellow students. As my work might someday be useful to someone, I thought I’d just start writing about it as it goes along. Most of the parts of what will be written here are parts of my report, so please do excuse me if they seem a bit formal. This post is the first of two that outline my considerations before I started developing.

Building on top of an existing project

In today’s globalised and internet-enabled world, people are starting and abandoning projects all the time. By nature, developers are builders and our first instinct is to start from scratch no matter what we do. However, this leads to massive time-wasting, creating the same software over and over again without even taking the time to see what is already out there. Re-inventing the wheel is not productive and should be avoided as much as possible.

As the open-source movement has exploded in the past couple of years, there are many projects available whose authors are more than happy for you to hack around with their existing source code, as long as they are attributed the credit where appropriate. For this reason, I owed it to the credibility of the project to find out if there was an existing basis that I could build my application on top of and my search was fruitful.

As my background research pointed out, at the start of my project there were two Android applications available that properly integrated with Moodle. One of them turned out to be fully open-sourced and its main developer more than happy to help out.

Moodle-for-Android (initial project)

Moodle-for-Android[1] is a project that was started by a group of Monash IT students in collaboration with Yew Cheung International School Puxi Campus and presents very similar features to my initial project specifications

Features

The application is working, although a little buggy and currently integrates the following functionality

Authenticating a user through Moodle

The application provides a way for the user to authenticate to the correct Moodle instance, obtains a token and uses it to authenticate its requests for information at later stages. This authentication method is also referred to as oAuth[2].

Obtaining and displaying the user’s subscribed courses

Once the user is authenticated, he / she has access to a list of courses they are enrolled in through Moodle.

Obtaining the documents related to the user’s courses

The user has access to all of the documents that are uploaded on Moodle, related to the courses they are enrolled in.

Offline storage of documents

The user can decide to download his / her course documents and store them for offline reference. We will be performing a full offline synchronization, meaning that the application checks for updates of documents on the server and re-downloads them when appropriate.

Automatic downloading of documents

The user has a possibility to specify that the application should (or should not) download all of the course documents accessible to it, automatically, for offline usage.

Showing course assignment details and deadlines

The user has access to all of the course assignments that are present on Moodle, related to the courses they are enrolled in. We will only be handling showing the course assignments, meaning the user cannot use any real interaction (like uploading a document).

Providing web-access to forums

Direct access to the web-forums from within the application is not available. However, a list of the existing forums (available to the user on the Moodle platform) is provided, but with web links to them. This enables the user to access these forums on the browser of his / her mobile device (it does mean the user has to re-authenticate him / herself to Moodle within the browser).


[1] https://github.com/M0nk3yofdoom/Moodle-for-Android

[2] http://oauth.net/

A developer / entrepreneurial Windows setup

As I’ve now been under Windows 7 for a couple of months, I’ve had to struggle really getting adapted from my previous Linux setup and thought I’d share my resulting setup, in the hopes it might help someone else out. I will write this in two posts, as it would become a little too long if I didn’t Smile.

VirtualBox

Many years back, when I started developing under WIndows, I was using EasyPHP and so that was my first reaction as soon as I was back. However, now that I am so used to my flexible environment in Linux, EasyPHP simply didn’t do the job any more. Luckily there is VirtualBox and with some tweaking, I managed to set up a really neat development environment.

  • Ubuntu Server 12.04
  • VirtualBox network configured to pass requests for localhost on to the virtual machine
  • Windows host file used to provide actual development names for my websites
  • Map /var/www/ to /sf_media/www, which is a share folder in virtualbox, linking to a folder under my Windows (host) machine

This enables me to go to mydevelopmentdomain.dev in windows and it will serve-up the website in /var/www/mydevelopmentdomain on my virtual development server. I get to fully develop under my Windows environment and still have the full power of a linux server to tweak / debug.

Zend Studio / Eclipse

Without these tools, my life would be a lot harder. Luckily, they are as much available under Windows as they are under Linux, so no real change here. I user Zend for my Web development and Eclipse for any other development.

Github

I had a hard time getting on to it, but I have finally taken the plunge and haven’t regretted it. Github is now my go-to place for source control and luckily they have a very good Windows app available, providing me full git command-line functionality even under Windows ! (or UI if you prefer that).

Next week

This weeks post was focused mostly on the Development setup. Next week I’ll be diving deeper into all the rest (Twitter, Outlook, etc.).

4 hour sync with Tasker (Android)… and gaining in productivity

Over the past couple of months, I had started to feel as if my phone was keeping me busy all the time. Being a technology entrepreneur / geek / developer, I had everything configured on my phone to be “wired in” 24/7″, this included :

  • 3 e-mail accounts with push
  • 2 e-mail accounts syncing every 15 minutes
  • Facebook
  • Twitter
  • Google+
  • Meetup
  • SMS / Calls

I realised that I was “drawn” to my phone every 2-3 minutes, as some sort of push notification popped up (mostly e-mail, with other services mixed in between). At first, I tried to cope with this and simply work around it. However, after a little while, I started to have the impression that I was actually becoming less productive because of it, so I started researching a little bit. I found a couple of articles telling me that turning off sync would really help my productivity, but I couldn’t really do that. Not having my phone sync at all didn’t seem like an option : I need my e-mails / feeds to be updated on a regular basis. It did, however, get me thinking.

Tasker – Switch auto-sync on for 5 minutes, every 4 hours

I had already heard about Tasker on Android before, but this was the first time I thought of it becoming really useful. My reasoning was as follows :

  • During my day at work, when I am available to answer e-mails, I will be behind my computer – meaning I don’t really need to get e-mails on my phone
  • After work, I want my e-mails available on my phone, to read, but will probably only answer them once I’m behind my computer again

It suddenly struck me that an idea situation for me would be to have auto-sync on my device enabled, but only once every 4-5 hours. This would mean that all my services got synced, but I wouldn’t be bothered by notifications every single time. This is where Tasker came in handy. I configured a task, to run every 4 hours, that switches auto-sync on for 5 minutes and then turns is off again. Now I get notifications only once every 4 hours and, if something is really urgent, people tend to call / send an sms anyways.

I have definitely noticed an increase in productivity, being able to more closely focus on a certain task and not get distracted by e-mails in the middle.

Joomla permissions fix script

As I’m doing quite some Joomla development, I wrote this small script that could be used for multiple purposes. It takes 1 parameter which is the directory of your joomla installation (I restrained it within the “/var/www/” directory, as a precaution, but you can get rid of this) and  then goes through folders and files to change their permissions. Hope it’s useful to someone :


#! /bin/bash
# This script simply fixes the permissions on a Joomla install to be perfectly $
# Need at least 1 parameter, which is the joomla root directory
MINPARAMS=1
DIRECTORYPARAM=$1

if [ ${DIRECTORYPARAM:0:9} == "/var/www/" ];
then
if [ $DIRECTORYPARAM == "/var/www/" ];
then
echo "The directory CANNOT be /var/www/ itself"
else
find $DIRECTORYPARAM -type d -exec chmod 755 {} ;
find $DIRECTORYPARAM -type f -exec chmod 644 {} ;
fi
else
echo "The directory can ONLY be in /var/www/"
fi

First impressions on Ubuntu 11.10

Two days ago, I decided I would give Ubuntu 11.10 a try as my full-time desktop. As I was already running 11.04, I started the update process hoping it would go without a problem. Of course, I was wrong…

Luckily, I made a backup of my files and proceeded to a clean install of Ubuntu 11.10. However, to my big surprise, WIFI wasn’t working at all suddenly… It took some figuring-out, but I now have a working instance of the new OS and am pretty happy with it. Here are some of the features I like most :

  1. Thunderbird over Evolution. This is a major step in the right direction. Evolution was starting to become very slow and searching wasn’t very effective. This is the kind of change that makes my day a lot easier 🙂
  2. Gnome 3. I have been a major fan of the new Gnome 3 and have tried to install it multiple times under Ubuntu 11.04, without real success (there was always something wrong). Now it comes out-of-the-box, it works and all I have to do is install the “gnome-shell” for my lovely new interface to appear !
  3. Login-screen. I know this is not necessary, but it’s simply nice. For once, the Ubuntu design team have done a really good job here.
  4. The Ubuntu Software Center. It has had a major overhaul and is a lot clearer to navigate, rate, install, remove and everything else you would want to do with it.
  5. New PhpMyAdmin in official repositories. I konw this is not a direct feature of the Ubuntu team, but as a web developer, this surprised me in a good way. A new and clean user-interface to deal with, finally making the old one obsolete.

The things I don’t like :

  1. The Ubuntu Software center. I know, I also put this in “the things I like”, but that is because it does come with one MAJOR drawback : speed. For some reason the Ubuntu Software Center is starting to become very slow for me and they should pay real good attention to that (I mean, I am running on a fairly new computer that should have no problem running this at all, and it still takes a couple of seconds to load -> more then ANY other application on my computer).

I will continue to add to this list over time and hope it helps you decide if Ubuntu 11.10 might be your cup of tea 🙂

Chrome defends drop of H.264 codec support

Chrome drops H.264

A few days ago, Google announced they were dropping H.264 video support for their browser : Chrome.
This has come as a pretty big surprise to most of the industry and people had different opinions about it. Some said it was “short-term pain for long-term benefit” and others said it was plain stupid. It is important to point out that this change only effects the HTML5 <video> tag, which is only available in the latest browsers.

Google’s argument is three-fold :

  1. H.264 is not open, nor is it free. A license fee has to be paid for every product that ships with the codec. Hence, this is not possible for any open-source project (their revenue being as small as it is, cannot go into licensing other code).
  2. This is not a “move on it’s own”. Many open-source communities are behind this move, not the least being Firefox and Opera.
  3. The <video> tag in browsers such as Opera and Firefox (two of the other big browsers) do not support H.264 either. This means that publishers will have to encode their video twice in any case (which means that Google is not causing that situation by dropping support now).

I myself think it is a good move. If Google is smart (and presumably it is), they will re-encode all Youtube videos with their native WebM format. Youtube being the largest video-sharing website around, they can make this move for the better, getting rid of the patent loaded H.264 once and for all :).

Sources : http://blog.chromium.org/