Comunity rocks

Hold my hand by Adam Foster | Codefor on Flickr. Licensed under Attribution-NonCommercial-NoDerivs 2.0 Generic
Though I’ve been involved with the Ubuntu community for close to a year now, support wasn’t something I was good at (mainly because #ubuntu was too fast for comfort). I’ve been working on cakephp for about 3 weeks now and I’ve been in the channel the whole time. The one thing that always strikes me in the help channel of any open source software is the community feeling around there. I’ve often seen person A coming in asking a question and a person B coming in to ask another question and they end up answering each other and both leave happy. That feeling just plain rocks!

Automatic database backup

I use git extensively for version control.  Its nice to use git since it backs up the code, but the database still remains unversioned.  Well, thankfully, XAMPP has a script that does a database dump.  So, I wrote a script to do the dump and then commit it to git.

Big Ben by vgm8383 on flickr
Big Ben by vgm8383 on flickr. Used under Attribution-NonCommercial 2.0 Generic license

Step 1
Create a directory in the home directory for the database dump

~$ mkdir projectname-database
~$ cd projectname-database

Step 2
Initialize git in the directory

~$ git init

Step 3
Do a database dump for the initial commit

~$ /./opt/lampp/bin/mysqldump -u root database-name > database.sql

Step 4
Commit the database file

~$ git add .
~$ git commit -a -m "Initial database commit"

Step 5
Now we’ll write a script to do the database dump and add commits. Open your favorite text editor and write the following script. Save the file as probably “database-project” in your home folder

#!/bin/bash
/opt/lampp/bin/./mysqldump -u root database-name > /home/username/projectname-database/database.sql
cd /home/username/projectname-database/
git commit -a -m "Database dump at `date`"

Save the script so that you can run it via a cron.

Step 6
Open crontab with the following command

~$ crontab -e

Step 7
Add the following line

00,30 * * * * /home/username/./database-project

This cron will run the script every 30 minutes.

Basically what happens here is the database dump will be taken every 30 minutes and the change will be committed to a git repository allowing you to keep track of the overwriting. I’ve found it quite useful and I hope you will too.

Baking on Ubuntu while using xampp

xampp logoSo, I’m a web developer working on Ubuntu.  Since I don’t want to get into complications like pinning to have earlier versions of PHP (useful when developing on Drupal), I use XAMPP.  Its a bit of a work to get php ready to bake while using XAMPP on Ubuntu.  These instructions are probably generic to any bash shell, but tested and working on Ubuntu.  Also note, I assume you install XAMPP in the expected directory at /opt/lampp

Step 1:  Add an alias for php in .bashrc.  Open the ~/.bashrc file and add the following line
alias php='/opt/lampp/bin/php'

Step 2: When running the bake script, run it as follows
php cake.php bake

Backing up with APTonCD

In my previous post about Keryx, I had mentioned there are 3 different ways to bring .debs from another system to your own, but I skipped explaining APTonCD because (a) those packages need to be installed on another Ubuntu system, (b) that system must be running the same release of ubuntu as yours (c) it gives an output of an iso file or has to be written to CD. This makes it non-ideal for bringing specific packages from one system to another system.

APTonCD

APTonCD though is the perfect backup tool. When you want to reinstall your OS for some reason (like playing with it too much that it does not work), APTonCD is the tool to use. It’s fairly straightforward. Once installed just run it from System > Administration > APTonCD. Click on create and all the applications installed will be listed out. Then click on Burn, and viola all the packages that you’ve installed gets backed up onto a CD, DVD, or iso.

After reinstalling the OS, pop the CD or DVD that was burned earlier into the CD drive, run APTonCD (install it first), and click restore. Now all the .debs will be copied to apt cache. Now go to System > Administration > Synaptic Package Manager and go to Edit > Add CD-ROM. Then click on Origin in the bottom left and all those packages will be listed and can be added.

All the applications installed will be restored. If like me, you have /home on a separate partition, not much configuration required either.

Installing packages without Internet Access

On the Ubuntu desktop, it is difficult for a user stuck without Internet because all packages are directly downloaded by the package manager. In India, unfortunately, Internet is not available for everyone. If you’re is lucky to have a laptop AND have a friendly local Internet Centre where you can connect your laptop, you’re among the few who can browse on Ubuntu (apart from those who have Internet ;)). I’ve been searching for a way to download the packages off-line and then install at home for people from my LoCo.

The latest Full Circle Magazine had an article giving a few workarounds for this, including a script generated by Synaptic Package Manager, APTonCD, and Keryx. The 2 most attractive options are to generate a script from Synaptic Package Manager and Keryx Project. They let you download on systems without Ubuntu and bring the .deb files to Ubuntu.

Generate a Script from Synaptic Package Manager
Start Synaptic Package Manager and mark all the applications that you want to install/upgrade. Instead of clicking the “Apply” button from the toolbar as you would normally do, go to the File menu and select “Generate Package Download Script” menu option to generate the download script. Save the generated script file. Give it a name like ‘ubuntu.sh’ and click the “Save” button. This script file can now be carried to a machine which has a fast Internet connection and it needs to be executed there.

Synaptic Package Manager

To download the softwares on a Windows machine, use Linkification plugin to convert text links into genuine, clickable links. Then, use DownThemAll plug-in. When the plugin in installed, go to Tools > DownThemAll and include *.deb in fast filtering. If downloading from another Ubuntu machine, just type sh .sh in terminal after changing directory to the folder containing the script.

Keryx Project
The Keryx Project only needs to be installed on the system with Internet connection and it downloads the debs. The best about Keryx is that its compatible with Ubuntu/Debian, Mac, and Windows. Download the Keryx Project from their download page.

Keryx Project

There is an excellent tutorial on using Keryx by crashsystems on his website.

All about the IRC and Freenode

Almost all big open source projects have one IRC channel where they can meet and coordinate or else it would be very difficult for someone new to join the group or ask for help. For a new user though, IRC is very daunting. It takes some time understanding something that was originally made in 1988 (wow, 21 years old). Today, I just want to break it down, a little bit of history, and why the open source world loves it. And no, its not that we don’t have GTalk or MSN.

IRC

According to wikipedia, Internet Relay Chat (IRC) is a form of real-time Internet text messaging (chat) or synchronous conferencing.

There are some reasons why we open source geeks tend to use IRC

    1. IRC is an open procotol. Makes a lot of sense for open source people. Its all about principles.
      Most IRC servers don’t need a sign up. Now, that is a major advantage. True, some channels may require that you register your nickname, but that is after actually entering the IRC server. Most of the time, to participate or ask questions, registration is not really required.
      IRC is real-time. Kinda obvious for a chat, but I just wanted to state it anyway.
      Not really graphics heavy. It can even be run from command line. Need I say more?

    The Ubuntu community uses IRC for support, in the channel #ubuntu, and for discussions of all sorts. All official teams have an IRC channel and sometimes even more. We use the Freenode network. Its a network that exists solely to support peer-directed projects, including those relating to free software and open source. The aim of Freenode is to help our participants to improve their communicative and collaborative skills and to maintain a friendly, efficient environment for project coordination and technical support. That’s just their official philosophy. In simple words, they’re there so that open source projects have a place to discuss and support.

  • Ubuntu User Days

    At the Ubuntu Developer Summit Lucid a couple of weeks ago, there was a discussion for extending Ubuntu Open Week throughout the release cycle by having a few smaller “days” in #ubuntu-classroom which were devoted to certain things. So the current plan is to have a “Ubuntu User Day” where a series of beginner level sessions would take place. Our vision is for this to happen on a Saturday and probably last 8-10 hours. This depends on getting volunteers to lead sessions and we’re working on that.

    Ubuntu Classroom on IRC
    Ubuntu Classroom on IRC

    The first User Day is scheduled for January 23rd, Saturday, from 1200 UTC to 2200 UTC, which comes to 1730 IST to 0330 IST. It drags a bit late, but that is to accommodate a wide range of time zones.

    Right now, we don’t have many volunteers, so we’re looking for a bit of participation both in terms of teachers and participants too. I’d like to re-emphasize that most of this is going to be beginners friendly.

    Thanks for your help and hope to see you there.