Indians in Victoria experience three times as much crime

I set out to discover whether media reports of violence against Indians in Australia are overblown or accurate. I was surprised by the result.

The recent murder of Nitin Garg lead to a flare-up from Indian media outlets about the dangers of violence towards Indian students studying in Australia. This follows on from a spate of similar activity in 2009. My belief was that a media frenzy has created the impression that Indians are disproportionately the victims of violent crime. Seeking to dispel this myth, I went in search of hard evidence.

To begin with, there were 43971 crimes against the person (PDF) in Victoria in 2008/09 (Victoria Police). For a population of 5,427,700 (ABS) that is a rate of 1 crime per 123 people. Police in Victoria say that 1447 people of Indian descent were victims of crime in the twelve months to October 2009. 2006 Census data puts the Indian-descended population of Victoria at 52,854 giving a figure of 1 crime per 37 Indians. Even allowing for population growth to 60,000 Indians in Australia, this seemingly leaves Indians in Victoria at three times the risk of crime as all other Victorians.

Now, there are all sorts of problems with my methodology. For instance:

  • Are Indians in Victoria from the same demographic spread as the rest of Australia, or do they skew younger? (Younger people are more likely to be victims of violent crime.)
  • Have I undercounted the Indian population of Victoria? Census data ought to include international students (of whom nearly 100,000 are Indians nationwide), but does it?
  • When police are quoted saying 1447 Indians were “victims of crime”, is this the same as the official statistics’ category “crimes against the person” or does it include property crime as well?

What other mistakes have I made, and how much are they likely to affect the numbers? I wish I had better data, to begin with.

I’m not really in a position to answer any of these questions, but these numbers certainly opened my eyes. I think more details should be sought, but on the face of them I’m no longer convinced that violence against Indian students is a media beatup.

How to stop the autoplaying videos on Fairfax websites

Summary: Install this Greasemonkey script for Firefox and the videos will stop autoplaying.

Some Fairfax news websites (including The Sydney Morning Herald, The Age and The Brisbane Times) inflict videos on their users which begin playing after 5 seconds. For instance, this story: Pakistan turn the screws on luckless Australia.

You’ll notice a couple of obnoxious things. First, you need to interrupt your browsing to hit “stop” on the video player. Second, you have to watch a thirty-second ad before the real content starts. And third, the video doesn’t start automatically if you remove “autostart=1″ from the end of that URL.

After getting fed up with this behaviour, I wrote a script to do something about it: Remove Fairfax autoplay video links. You’ll need Firefox with the Greasemonkey extension installed. Afterwards, the script will do two things without your interaction. On any of smh.com.au, theage.com.au and brisbanetimes.com.au, it will:

  • Check whether the current page URL contains “autostart=1″ and, if so, reload the page without that element in the URL.
  • Go through all of the hyperlinks on the current page and remove “autostart=1″, so any subsequent pages visited will be free of autoplaying videos.

This script is free and cobbled together from various tutorials around the web. If you like it, please share the link with your friends. In a perfect world, Fairfax would get the picture and put an end to autoplaying videos. However, I think this tactic probably makes money for them, and so they’ll continue to sell out their user experience for more money.

How to get the high score on Foursquare

My score after two days

I know that GPS-based social networking startup Foursquare is supposed to “helps you keep up with your friends, expose you to new things in and challenge you to explore cities in different ways”. But I had some free time and, with a little Christmas shopping to do, decided to see how high I could get my score.

Why would you want to do that? For fun, mainly. But also for the promotional opportunities of a #1 spot on the leaderboard (at right).

My score after two days

The way you succeed is to game two of Foursquare’s weaknesses: you can check in every ten minutes, and you get a “travel bonus” score which increases, and is awarded, after each consecutive check-in on the same day.

Note that it doesn’t matter so much if you’re visiting new places and getting the +5 new location bonus. As your travel bonus combo increases, the new location bonus becomes a mere fraction of the total points received.

You’ll need a day or two where you can travel away from home for a few hours, or a neighbourhood with a rich roster of places to visit. It helps to set a timer to remind you to check in every ten minutes. It also helps to start the day with checkins away from home, so that when you’re home in the evening you can continue with venues near your house (since you only get points for a venue once a day).

When the timer goes off, check in at a nearby location and go on with your life for ten minutes. Rinse and repeat for a few hours. After one hour, your travel bonus will be 6 points. After three hours, it will be 18. Pretty soon you can be increasing your score by over 150 points per hour. And you’ll rocket up the rankings in your city. Just change your name in Foursquare’s setting so that your first name is the domain you want plugged, and your surname is blank.

This may not work for all locations. As I’ve been active in Sydney, different rules may be in place. Foursquare claims not to award points during work hours, but the 1200 points above were mainly accumulated on a Monday and Tuesday morning while Christmas shopping. And I fully expect these loopholes to be closed, as they allow for some pretty lame activities to happen (like the ones detailed here).

This is two days’ work. A rough calculation shows that the maximum points for 24/7 Foursquaring is at least 70,000 per week. I don’t think I’ll be investigating that one.

UNSW Library Lawn in Photosynth

Today I went out onto the Library Lawn at work and took 75 images, which I then dropped into Microsoft’s rather excellent Photosynth tool, building the panorama you’ll see embedded below (or here) if you’ve got Silverlight plugin installed (unfortunately this excludes OSX):

I really was quite surprised at how quick and easy it was to build this panorama. True, walking around taking lots of photos is a bit of a drag, but the whole process took less than half an hour.

Telstra: give back my grandmother’s phone

My grandmother Lorna

Updated 18 March: Jono H at Telstra is express posting a starter kit & $60 voucher! Now assuming Australia Post does its job, this will all be sorted out by the weekend! I can’t say a big enough thank you to Jono H & Telstra for making this happen. You guys are awesome.

This is my grandmother Lorna. She’s 79 years old, lives on her own, and is completely independent. But she’s still 79 years old, and likes the security of being in contact with her family through her mobile phone. If she ever needs to, she can call us. Or if we can’t get in touch with her at home, we can call her.

That is, until Telstra cancelled her pre-paid mobile phone because she hadn’t put any more money into her account in the last few  months.

Here’s how Telstra Pre-Paid works. You buy a SIM card with a credit balance for phone calls, and put it in any phone. The balance on your account also comes with a credit expiry date, which you extend by putting more money on your account. After this date passes, your phone goes into a “recharge only period” in which you need to add more money, regardless of your account balance. After a few more months, Telstra deactivates your phone and keeps any money left in your account. (You can find out more in this document at points 3.7 to 3.26.)

My grandmother doesn’t make that many calls from her mobile phone, so she doesn’t recharge her credit very often. Why, then, does Telstra have the right to switch off her mobile phone service and pocket the money in her account? Does it put too much of a hole in Telstra’s bottom line to provide a phone service that generally only receives calls? (Telstra’s net profit in 2007/08 was $3.7 billion, up 13% on the previous year.)

Of course I called Telstra to try to sort this out. On my first call to 1258880 I was told that the service was “quarantined” on 11 March, and that it could only be reactivated after six months. When I asked about having it reactivated sooner, I was told to call 125111. I called this number, and after being transferred to the “prepaid” division was told that the phone number had been “deactivated” on 11 March, and there was no chance it was ever coming back. Impossible. So which one of these is it, Telstra?

This is all I want: to be able to hand my grandmother’s mobile phone back to her in working order, on Friday, so she can take it with her on holidays. Is that too hard to ask, Telstra? You can contact me at flashman@gmail.com or on Twitter. Here’s your chance to shine & show you’re not just a corporate monolith. Please don’t disappoint us.

HOWTO: Track user activity on your PHPBB forum

Introduction

I run a music forum called Small Night In using PHPBB forum software. Like any website owner, I’m interested in the user activity on my site. That’s why I run Google Analytics, which covers visitor numbers, referring sites, and a wealth of other useful data. Additionally, PHPBB reports the number of users, topics and posts in total and on average.

However, what PHPBB doesn’t report is potentially more useful: long-term trends in growth or decline of active users and new posts. Tracking visits in Google Analytics isn’t sufficient, because some visitors are casual and don’t return – active, registered users are the most valuable to a forum. Tracking the average daily number of posts is no good either, because it gives an average and not an ongoing series of activity snapshots.

To address both these issues, I’ve written a useful script which will allow someone with a minimal amount of PHP/MySQL knowledge to track the long-term number of active users and daily posts on their website.

The script, in brief:

  • Get the time and date 24 hours ago
  • Count how many users last visited later than that time
  • Count how many posts were created later than that time
  • Output the results

The script output is (according to the user’s needs) either a simple PHP echo() of the number to a webpage, or written to a .CSV file for easy long-term tracking and charting.

The script

The first part of the code is just database settings, which you should personalise as needed:

// Change these to your MySQL details
$host = "localhost"; // you probably won't need to change this setting
$user = "your_php_username";
$pass = "your_php_password";
$database = "your_phpbb_database_name";

The next section grabs the current timestamp and subtracts one day’s worth of seconds, as well as yesterday’s date in YYYY-MM-DD format:


$time24hoursago = time() - 86400; // Get the timestamp for a day ago by subtracting 24*60*60 seconds
$date = date('Y-m-d', $time24hoursago);

In the next section, we get the number of entries (users) in `phpbb_users` where the timestamp in `user_lastvisit` is more recent than the $time24hoursago timestamp:


// Database query, recent users
$conn = mysql_connect( $host, $user, $pass ) or die ("Could not connect to MySQL");
$rs = @mysql_select_db($database, $conn) or die("Could not connect to database");
$sql="SELECT COUNT(user_id) FROM `phpbb_users` WHERE `user_lastvisit` > '$time24hoursago'";
$rs = mysql_query( $sql,$conn );
$activeusers = mysql_fetch_array($rs);

Then we do the same thing for recent posts:


// Database query, recent posts
$sql="SELECT COUNT(`post_id`) FROM `phpbb_posts` WHERE `post_time` > '$time24hoursago'";
$rs = mysql_query( $sql,$conn );
$posts = mysql_fetch_array($rs);

Now the arrays $activeusers and $posts contain the number of users and posts. If you just want to see the results, a simple echo command will do the trick:


echo $date . ',' . $activeusers["0"] . ',' . $posts["0"];

Of course, you might be like me, and want to automate the entire process using cron. This next bit of script will write the date and number to a .CSV file called “forum_activity.csv” in the format YYYY_MM_DD,users,posts. For the following process, I’ve modified the file append tutorial on Tizag.com:


$myFile = "public_html/scripts/forum_activity.csv"; // this is the file we'll put the results in
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = $date . ',' . $activeusers["0"] . ',' . $posts["0"] . "\n";
fwrite($fh, $stringData);
fclose($fh);

Mind the file path $myFile. If you’re running this script through a web browser, you’ll want to make the reference local – that is, have the file path as just “forum_activity.csv” and place the file in the same folder as the script. But if you run this script through cron – for instance daily at midnight, as I do – you’ll want to put the full path to the .csv file or cron won’t be able to find it. Always test before leaving this running for a week and finding it doesn’t work!

Small Night In – a replacement for the Big Day Out forum

In brief: Much of the Big Day Out forum community has relocated to Small Night In after the BDO forum shutdown.

The popular Big Day Out forum was shut down early last week after the death from ecstacy overdose of Gemma Thoms at the Perth Big Day Out.

I’ve got several friends on the BDO forum and they lost a part of their community. Since I’ve got some 50GB of bandwidth, which my other sites barely use a fraction of, I set up a replacement forum called Small Night In. The site has been received enthusiastically and will remain online for as long as people find it useful.

Whether or not the BDO forum ever comes back is unknown, with complete silence on the matter issuing forth from the organisers. I’m enjoying the technical challenges of running a busy forum (and they are many) and learning a bit about community management at the same time.

The forum is an out-of-the-box installation of PHPBB3 with a couple of modifications installed. I prefer to keep things fairly simple and rely on free, community-supported software, so PHPBB is a perfect solution (as well as being the same system used on the BDO forum, giving users some continuity of experience).

Daffeidolia

She’s been seen in floor tilesbrain scans, and toast, but this is the first time I’ve seen the Virgin Mary under a microscope. Here she is at 100x magnification, in the stem of a daffodil:

Is that the baby Jesus in her arms?

Is that the baby Jesus in her arms? Click to embiggen.

I was quite surprised to see her jump out at me. After all, I had picked this daffodil completely at random from hundreds of others in a patch, and sliced off a piece of stem just a few millimetres wide, yet there she was! Of course, if it’s not a miracle, it’s a pretty good demonstration of pareidolia, which is basically what they call it when you see clouds that look like things. Hey, that Jesus Christ pita bread is currently bid on at auction for $215… maybe I should hold on to this slide ;)

A real-time aircraft collision replay

This afternoon brings the tragic news of the deaths of two women in a light aircraft collision over Casula in Sydney’s west. While it is too early to say what caused the collision, or who was responsible, the Sydney Airport WebTrak data servicelaunched just last week- can provide a real-time reconstruction of the incident from radar data.

Here are pictures from the WebTrak service, but you can see the replay yourself by visiting this WebTrak page and setting the date and time to 18/12/2008 11:22am. The location is over Casula, pinpointed on this Google map.

The Cessna, circled in red, and second plane over Horningsea Park

11:22:05am: The Cessna, circled in red, and second plane over Horningsea Park

11:23:04 - The second plane, believed to be a Liberty training flight - executes a left-hand bank

11:23:04 - The second plane, a Liberty XL2 training flight (circled) - executes a left-hand bank

11:23:26 - The two aircraft converge over the M7

11:23:26 - The two aircraft converge over the M7. At this point, the Cessna is at 488m altitude, and the Liberty at 508m.

11:23:44 - The two aircraft approach, with the Cessna at 507m and the Liberty a 513m.

11:23:44 - The two aircraft approach, with the Cessna at 507m and the Liberty a 513m.

11:23:52 - the two aircraft collide, with the Cessna spinning out of control and crashing.

11:23:52 - the two aircraft collide, with the Cessna spinning out of control and crashing.

Edit: Looks like I’m not the only one to realise this data exists: Website captures Bankstown midair plane crash. They even have a video replay.

HOWTO: Lojack your iPhone and track its location

Update: After further testing, it seems there are a couple of major problems with this setup. The first is that the iPhone doesn’t appear to update if it goes to sleep and isn’t plugged into mains power. The second is that the GPS coordinates I’m getting are wildly inaccurate for my location (varying by a few hundred kilometres) so I figure there’s something wrong with the “findme” application called below. I’ll keep looking for a better way, but for now take this article with a grain of salt.

In this article I’ll explain how to program your jailbroken iPhone to automatically upload its location to a server of your choosing at regular intervals. This will work whenever your iPhone is switched on and has a network connect (3G or Wifi).

As I’m going on holidays tomorrow, I’m going to be in situations where theft of personal belongings is a lot more likely. So after coming up with the idea this afternoon, I spent the last few hours hacking together a tracking solution for my phone. It idles silently in the background, popping up every fifteen minutes to write a latitude/longitude pair to a timestamped database on my server.

This tutorial is going to be a whirlwind because it’s 11pm and there’s so much to explain. And I have a holiday to go to.

You will need:

  • One jailbroken iPhone: I used an iPhone 3G, not sure if this is possible with an original iPhone. To jailbreak your phone, use QuickPWN. Disclaimer, warranty, own risk etc etc.
  • MobileTerminal, OpenSSH, Netatalk and cURL, installed as packages from within Cydia
  • findme, a script written by Erica Sadun and available in a binaries package on her site
  • access to a server with PHP5 & MySQL (possible with other configuration but outside the scope of this article)
  • a moderate level of coding chops – I rate this project “moderately difficult” because of the diverse areas of skill required.

The basic steps involved are:

  1. Preparing your iPhone to be messed with
  2. Teaching your iPhone to query its location using GPS
  3. Constructing a server-side script to record location data
  4. Teaching your iPhone to run the location script at regular intervals
  5. Outputting the data in a readable format

Let’s get started.

The Setup

After jailbreaking your iPhone you will install MobileTerminal, OpenSSH, Netatalk and cURL through Cydia. Then you’ll need to connect to your phone to drop files onto its disk. The easiest way is to connect over Appletalk, but if you’re handy with a command line (or don’t have a Mac) you can ssh root@10.1.1.1 with default password ‘alpine’ and your iPhone’s actual IP address (get this in settings -> network) from your PC.

Drop the findme script into /bin. Now make it executable using chmod 775 findme. When you invoke findme from the command line, it will return some XML containing your phone’s latitude and longitude, like this:

<?xml version=”1.0″?><SearchResults><Success>true</Success><Latitude>-33.887242</Latitude><Longitude>151.256718</Longitude><Method>Skyhook WiFi Location</Method></SearchResults>

(Eagle-eyed readers will noticed I’ve given myself a fancier address in this example.)

The Storage

So now we’ve got a process on your iPhone that delivers GPS over XML. The next step is to transfer that information to a database. For this part, I’m relying heavily on Erica Sadun’s iPhone Lojack article on TUAW, which goes over the same stuff as this article but using Twitter as the output channel.

What we want to do is post the output of findme to a PHP script which then posts the data. You’ll need to create a shell script and upload it to the same folder as findme. Here’s a template:

#! /bin/sh
curl –basic –url http://www.yourserver.com/lojack/index.php5 \
–data status=”`findme`” \

Save this file as ‘loc’ (no extension) and copy it to the same directory as ‘findme’. Don’t forget to make it executable: chmod 755 loc

Now, on your server at the path specified above, create a PHP file that grabs the posted status message and writes it to a database. This script assumes you have a database with a table called ‘locs’ containing two DECIMAL(9,6) fields and a TIMESTAMP field with the current time as its default entry:

< ?php

$username=”username”;
$password=”password”;
$server=”localhost”;
$database=”mylocations”;

$status = $_POST['status'];
$status = stripslashes($status);

$xml = simplexml_load_string($status);

//echo “Status: ” . $status;
$lat = $xml -> Latitude;
$lon = $xml -> Longitude;
echo $lat . ” ” . $lon;

$conn = mysql_connect( $server, $username, $password ) or die(“Err:conn”); //connect
$rs = mysql_select_db( $database, $conn ) or die(“Err:db”); //select db
$sql = “insert into `locs` (lat, lon) values ($lat, $lon)”; //the query
$rs = mysql_query( $sql,$conn );

? >

Now you should be able to invoke loc from the command line (shell, whatever) and it will send the XML to your server script, which will parse out the GPS coordinates and save them to a database. If it’s not working, try removing the comment slashes from //echo “Status: ” . $status; to see what results cURL is getting.

Timing is Everything

Great, so that script sorts out a single location upload. To be useful as a lojack, we want this upload to occur at a regular interval. For that, we’ll use the iPhone’s own LaunchDaemon service. Modify the instructions found in step 4 of the TUAW article to suit your setup. Here’s the script I’m using, com.apple.lojack.plist:

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>Label</key>
<string>com.lojack.upload</string>
<key>ProgramArguments</key>
<array>
<string>/bin/loc</string>
</array>
<key>StartInterval</key>
<integer>900</integer>
</dict>
</plist>

The 900 in the script above specifies this script will run every 900 seconds (15 minutes). You’ll need to restart your iPhone before the LaunchDaemon will work.

Output your results

It’s no good storing all this away on a server somewhere. You need to make it user-friendly. This script will query the database and print the output according to your choice: vanilla, or in tables with links to Google Maps:

< ?php

$username=”username”;
$password=”password”;
$server=”localhost”;
$database=”mylocations”;
$layout = $_POST['layout'];
$conn = mysql_connect( $server, $username, $password ) or die(“Err:conn”); //connect
$rs = mysql_select_db( $database, $conn ) or die(“Err:db”); //select db
$query1 = mysql_query(“SELECT * FROM locs”);

echo ‘<form action=”where.php5″ method=”post”>’;
echo ‘<input type=”radio” name=”layout” value=”plain”>Plain<br>’;
echo ‘<input type=”radio” name=”layout” value=”table”>table<br>’;
echo ‘<input type=”submit”></form>’;

if ($layout == “plain”) {
while ($table1 = mysql_fetch_array($query1))
{
echo $table1[0] . “,” . $table1[1] . “,” . $table1[2] . “,” . $table1[3] . “<br>”;
}
}

if ($layout == “table”) {
echo “<table border=1><tr><td>Timestamp</td><td>Latitude</td><td>Longitude</td><td>id</td><td>Link</td></tr>”;
while ($table1 = mysql_fetch_array($query1))
{
echo “<tr><td>$table1[0]</td><td>$table1[1]</td><td>$table1[2]</td><td>$table1[3]</td><td><a href=\”http://maps.google.com/maps?q=$table1[1],$table1[2]\”>Map</a></td></tr>”;
}
echo “</table>”;
}

? >

While I’d love to show you the results, I’m not quite ready to share the intimate details of my physical location with all of you. Hopefully this article can act as a guide for those with a little knowledge in all of these areas – let me know in the comments if there’s anything that’s unclear. In the future I’d like to build a way to render the data collected as a heat map, or a series of paths – but for now, I’ve got a beach to go and lie on.