Friday, March 1, 2013

Back-Up a Moodle Installation and Upload it to an FTP Server

Are you a Moodle administrator (on Windows) who is looking for a batch file to automate the process of taking a back-up of your Moodle server and uploading that back-up to an FTP server? Look no further; you have come to the right place!

Simply download the batch file below on the machine hosting your Moodle server, modify it with your information (i.e. paths to the relevant directories, etc.), then run the batch file. The batch file is hosted on and can be downloaded from there.

For the batch file to work, I make the following assumptions:
  1. You are running your Moodle server in a Windows environment, and you have administrator access on the machine hosting your Moodle server.
  2. You are using MySQL Server as your database server.
  3. You have installed 7-Zip ( on the machine hosting your Moodle server.
The full source code (with detailed comments) of the batch file is as follows:

@echo off

REM ======================== DEFINE SETTINGS AS REQUIRED ========================
REM Set timestamp in DDMMYYYY format
set TIMESTAMP=%date:~7,2%%date:~4,2%%date:~10,4%
REM Set the location of the 7-Zip executable
set ZIP="C:\Program Files\7-Zip\7z.exe"
REM Set the output folder where the zip file will be stored (temporarily)
set OUTPUT_FOLDER="C:\outputfolder"
REM Set location of the moodledata folder
set MOODLE_DATA="D:\moodledata"
REM Set name of zip file
REM Set location of where your Moodle site resides
set MOODLE_CODE="C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\moodle"
REM Set location of the mysqldump executable
set DB_MYSQLDUMP="C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe"
REM Set the database parameters: -u<username> -p<password> <database_name>
set DB_PARAMETERS=-uusername -ppassword moodledb
REM Set name of SQL dump file
REM Set the location of your FTP server (IP address is also fine)
REM Set FTP username - the user should have write access
set FTP_USER=ftpuser
REM Set FTP user's password
set FTP_PASSWORD=ftppassword
REM Set the FTP path to where you want to copy the archive file starting from the FTP root
set FTP_DESTINATION_DIRECTORY="/path/to/FTP/destination/"

REM ================= DO NOT MODIFY ANYTHING BELOW THIS LINE ==================
REM Backup Moodle data directory
REM Backup the Moodle code
REM Backup the Moodle database
REM Upload via FTP
echo user %FTP_USER%> %OUTPUT_FOLDER%\ftpcmd.dat
echo %FTP_PASSWORD%>> %OUTPUT_FOLDER%\ftpcmd.dat
echo bin>> %OUTPUT_FOLDER%\ftpcmd.dat
echo put %ARCHIVE%>> %OUTPUT_FOLDER%\ftpcmd.dat
echo quit>> %OUTPUT_FOLDER%\ftpcmd.dat
ftp -n -s:%OUTPUT_FOLDER%\ftpcmd.dat %FTP_SERVER%
REM Clean up
del %OUTPUT_FOLDER%\ftpcmd.dat

Friday, September 14, 2012

Integrating Twitter with Moodle

This post will show you how to integrate Twitter with Moodle. Specifically, you will learn how to use a Twitter account to post announcements for your students, which will then show up on your Moodle course site. In this demo, we shall be using Moodle 1.9 and my own Twitter username, which is @karimwallani.

Here are the steps:

  1. Create a free account on Twitter (
  2. Log into Moodle and enter a course site in which you have Teacher or higher rights.
  3. Turn editing on and add a “Remote RSS Feeds” block.

  4. In the block, click on the “Click here to configure this block to display RSS feeds” link.
  5. On the page that opens, click on the “Manage all my feeds” tab.

    manage all my feeds
  6. Under “Add a news feed URL”, enter the following URL:

    Replace USERNAME with your desired Twitter username. In this case, the URL becomes:
  7. Under “Custom title”, add “My Twitter Feed”, for example.

    configure this block
  8. Click the “Add” button.
  9. Click the “Configure this block” tab.
  10. Select your desired options, but make sure to place a check next to “My Twitter Feed”.

    configure this block
  11. Click the “Save changes” button.
  12. Once you are back into your Moodle course site’s main page, turn editing off.
  13. That’s it! Your Twitter feed block is ready!
  14. Go back on Twitter and start postings tweets containing announcements or pretty much anything you want (as long as it’s 140 characters or less). You will see that the latest 5 tweets (which is what we had set earlier) will show up in the block, In my case, here is what that final result looks like, at the time of writing:


Sunday, June 17, 2012

My presentation at "U-TECH: Technology Ideas and Possibilities for Empowering 21st Century Youth"

Here is a link to my presentation at "U-TECH: Technology Ideas and Possibilities for Empowering 21st Century Youth", an IT seminar held on June 16, 2012 at Muhammad Ali Jinnah University (MAJU) in Karachi, Pakistan, which aimed to empower 21st century youth through technology:

Your feedback would be highly appreciated. Thanks!

Saturday, March 3, 2012

Converting YouTube Videos for Nook Color

This tutorial will show you how to download YouTube videos* onto your computer and then convert the videos to make them playable on a Nook Color e-reader.

* While most YouTube videos can be downloaded and converted for Nook Color playback, some YouTube videos have special restrictions on them, which prevent them from being downloaded onto computers.


  1. A Web browser with access to and
  2. Java (Download from
  3. HandBrake (Download from


  1. Go to and search for your desired video clip. For this tutorial, we will be using (How to Take Blood Pressure).
  2. Copy the URL of the video clip by clicking into the address bar of your browser, selecting the entire URL, and then pressing Ctrl+C on your keyboard to copy the selected text.
  3. Go to, and paste the URL into the textbox at the top of the page.

  4. Press the “DOWNLOAD” button next to the textbox. If you are presented with any security warnings, you can accept them.
  5. Click on the “Download FLV” link. It doesn’t matter whether you select the 240p or 360p or any other quality.

  6. You will then be prompted with a Download dialog box, so save the file to convenient location on your computer.
  7. Once the download completes, open HandBrake.
  8. In HandBrake, click on the “Source” button, then “Video File”, then find the video clip in FLV format that you downloaded, and then press “Open”.

  9. Click on the “Classic” preset under the “Legacy” heading.

  10. Under the “Destination” heading, browse to the location where you would like to save your file, then press the “Save” button.

  11. Make sure that the video’s width is less than or equal to 854, and the videos height is less than or equal to 480. Adjust as necessary. Videos with dimensions greater than 854x480 pixels are not supported in the Nook Color.

  12. Press the “Start” button to start the conversion process.

  13. When the conversion is done, a message will be displayed at the bottom.

  14. The video has now been saved to the location you specified, and can now be transferred over to your Nook Color via the Nook Color’s data cable.

Sunday, August 21, 2011

Turn your Nook Color into a full-blown Android tablet

The Nook Color’s hardware is too good to be tamed by Barnes and Noble; it can do a look more than display e-books.

In this post, I will show you how to turn your Nook Color into a full-blown Android tablet. Following these instructions will not hurt your Nook Color because we will be running Android from a microSD card. If you want to use your Nook Color’s default operating system, just take out the microSD card and reboot your Nook Color.

This post is based on instructions available at, which aren’t that easy to follow. So, this is my attempt at a better, step-by-step guide.

What you’ll need:


  1. Desktop or laptop computer with a USB port (I used a laptop running Windows 7, but it should work on earlier versions of Windows as well)
  2. Nook Color and its data cable
  3. microSD card of 1GB or higher


  1. 7-Zip ( or go to and get the latest version)
  2. Image Writer for Windows (
  3. Size-agnostic SD Card CyanogenMod 7 installer (
  4. CyanogenMod – a free, community built distribution of Android 2.3 (
  5. Gapps – Google Apps (


  1. Install 7-Zip
  2. Right-click on Image Write for Windows ( and, using 7-Zip, extract it to a folder on your computer’s desktop
  3. Right-click on Size-agnostic SD Card CyanogenMod 7 installer (generic-sdcard-v1.3.img.gz), and, using 7-Zip, extract it to your computer’s desktop
  4. Turn on your Nook Color and put your microSD card in it, then connect the Nook Color to your computer via the Nook Color’s data cable
  5. Open up My Computer and make sure you are seeing two additional entries (one for the Nook Color and one for the microSD inside the Nook Color)

  6. Make a mental note of the drive letter assigned to the microSD inside the Nook Color (in my case, it is I:)
  7. Open Image Writer for Windows which you extracted to a folder on your desktop, click the folder icon and find Size-agnostic SD Card CyanogenMod 7 installer (generic-sdcard.img), select the the drive letter assigned to the microSD card (e.g. I:) and write it to the microSD card.

  8. Close Image Writer for Windows
  9. Using Windows Explorer, copy CyanogenMod ( and Gapps ( over to the drive where your microSD card is without renaming either of the two files

  10. “Safely remove” your Nook Color from your computer, then unplug it
  11. Power off your Nook Color by pressing the Power button (located on the top left of your device) and Nook logo (shaped like an upside-down U) for a few seconds
  12. Restart your Nook Color
  13. If you did everything correctly, the Nook Color will boot from the microSD card, install CyanogenMod and Gapps (showing you a bunch of text in the process) and then shut down
  14. Restart your Nook Color
  15. That’s it – now your Nook Color is a full-fledged Android tablet!