Posts Tagged programming

Programming for dummies

I just stumbled across Scratch.

Ok, it’s meant to be for kids, but I like the idea. It’s basically a visual programming environment for creating animation and music.

I found this via a post on the Google research blog about “Android app inventor“. They’re planning to make a similar graphical block-based programming environment for writing android apps.

I like the idea of visual programming. The traditional code-compile-run-test-stop-change-compile-run sequence is a little boring and time consuming. I want to change something “on the fly” and see what it does.

This programming style often seems to be associated with education. Greenfoot and Alice are two examples. If I was a real engineer, I may find myself playing with LabVIEW for programming microcontrollers and whatever else real engineers do.

But anyway. A couple of years ago I started working on a visual programming environment for creating video/audio/frame based processing applications – FraMMWorks. The idea is that you have a collection of building blocks (video sources, face detection, edge detection, etc) which you join together to generate an overall video processing “chain”. You can then save the resulting code as an executable and run it anywhere.

If there’s any interest I might just spend some more time on it.

, , , ,

No Comments

Backup using rdiff-backup

I’ve been using rdiff-backup to automate my linux backups for a while now. I just recently made some improvements to my cronjob which performs a nightly backup and thought I’d share it here.

Rdiff-backup is a great application which wraps around rdiff to backup entire directories from one place to another. It’s very efficient too. Rdiff only transfers the changes to files, which means it’s great for performing offsite backups.

Only problem is that it’s still not easy enough to use – so I wrote a script to *really* automate things.

Here’s how to get it working:

  1. Install rdiff-backup on local and remote computers (apt-get install rdiff-backup for debian/ubuntu, build for windows, build for osx or build from source for anything else).
  2. Copy this script to /etc/cron.d/backup (you’ll probably have to rename that downloaded file)
  3. Create configuration directories /etc/backup/ and /etc/backup/hosts/
  4. Create the main configuration file /etc/backup/backup.conf with your settings using this template
    [sourcecode language=’sh’]
    # This is the config for a script which uses rdiff-backup to perform a nightly
    # backup of various
    # servers to this computer. It should be called via cron and should be
    # configured to send stderr to a sysadmin.
    #

    #==============================Config section==================================

    # local directory to store backups
    BACKUP_DIR=/usr/data/backups

    # location of remote host specific back up details
    HOST_CONFIGS_DIR=/etc/backup/hosts

    # Number of days to keep backups for. If unset backups will be kept forever
    KEEP_BACKUP_DAYS=62

    # parameters to pass to rdiff-backup
    RDIFF_BACKUP_PARAMETERS=”–force”

    # set to 0 for debugging information to be suppressed
    DEBUG=1

    #================================End Config Section============================
    [/sourcecode]

  5. Create a configuration file for each host you want to backup. This must be in the format of “backup.hostname” – i.e. backup.hammer.cs.curtin.edu.au or backup beans.ath.cx. You can refer to the localhost through its name too (i.e. backup.mycomp). These must be placed in /etc/backup/hosts/
    [sourcecode language=’sh’]
    # Config options for backing up remote computers
    # filename must be in the format of
    # backup.hostname.domain

    # The directory to start the backup at.
    START_DIR=”/”

    # Directories to backup. use a space to seperate.
    # INCLUDE_DIRS will have preference.
    # ie. if we include /usr/data/wilson but exclude /usr/data everything under
    # /usr/data/wilson will be backed up, but /usr/data/tim won’t be.
    INCLUDE_DIRS=”/usr/data/wilson/data”

    EXCLUDE_DIRS=”/usr/data /proc /cdrom /tmp /mnt /sys /home/squid /home/www/gallery2″
    [/sourcecode]

  6. Create an SSH key with no passphrase which will allow you to logon to the remote computer without typing a password (we will be automating this with cron remember). This link gives some details.
  7. Create a cronjob to run the script.
    30 4 * * *     root    /etc/cron.d/backups

Your remote computers should now be automatically backed up every night!

I haven’t actually tried this with windows or Mac OSX computers, but I believe it can be made to work.

, , , ,

2 Comments

Google Latitude + GoogleCar

Everyone has heard about Latitude by now. “See your friends’ locations and status messages and share yours with them.”

Ok, there’s a mountain of privacy issues surrounding it… Simple solution — turn it off. I have no intention to broadcast my location 24 hours a day. That’s just asking for trouble. But it could be very handy when you actually want your location to be known.

Anyway – what I’m interested in is how it finds your location?

Most smart phones have some sort of Location API – Here’s an example using the Symbian Location Acquisition API. Java and iPhone have similar API calls.

The other side of the API presumably uses whatever it can to get a location. GPS (possibly with the help of an A-GPS server) or some form of mobile network based “triangulation” seem to be popular.

But what if your phone doesn’t have a GPS receiver? Or you’re using the Latitude iGoogle app on your laptop? Or a desktop?

This is where things get interesting. The Latitude iGoogle app gets your location through the Google Gears GeolocationAPI which according to google, uses “your computer’s WiFi location”. What the hell is your “WiFi location”?

Well, if you can build up a big enough database of WiFi access point MAC addresses and associate each with a location, you can perform a “reverse” query to associate an AP to a location! viola! Each AP should have a 100m (or so) transmission radius, so if there are multiple APs you can “overlay” these transmission circles to get an even more accurate position.

But this theory only works if you have a lot of entries in your database and it’s regularly updated (as people add/remove/move their personal APs). How do you do this? My ideas:

  1. The Google street view car scans for WiFi signals as it drives around
  2. Every Laitude program updates the Google database while it is being used

The Street view car visits every street which gives Google a good starting point for the database. As soon as possible after this they get users to “give Latitude a try” which corrects the database with any changes since the Google car went past, making it more accurate as more users come on. To back up this Google car collection claim, I’m going to use a quote from the official google blog “Today, Latitude is available in 27 countries, and we hope to add more soon.”. How many countries do you think Google has Street View imagery for or is currently capturing? About 27 perhaps?

It’s all very clever if you ask me.

Just don’t tell anyone what Virtual Observer is currently doing with rubbish trucks…… 😉

, , , , ,

5 Comments