“No Comment!”: removing story comments on Australian news sites

bigjobs Posted at 2:26 PM December 15, 2010
The big question is WHY does Julia want the boat people here? I would hazard a guess and say its was the same reason Obama leaves the mexican border open. And the same reason Britain has been flooded. Doesn’t take a rocket scientist to work it out.

OK, that does it. I’m sick of getting to the end of a news story and being confronted by that element of the public which led Winston Churchill to say, “The best argument against democracy is a five-minute conversation with the average voter.” I can’t say for certain why our newspapers have given over their stewardship of journalism to the rabble, but I’m fed up with the garbage that passes for ‘debate’ on these sites.

Here’s how to remove comments from Australia’s major news websites.

You will need a version of AdBlock: AdBlock Plus for FirefoxAdBlock for Chrome or Adblock for Safari. This is an extension which typically removes advertisements, but can be instructed to remove the comments sections of news sites, too.

Instructions for Firefox:

  1. From the “Tools” menu, select “Adblock Plus Preferences”
  2. Under the “Filters” menu, select “Add filter…”
  3. Paste the following line of text and press enter: smh.com.au,theage.com.au,brisbanetimes.com.au,nationaltimes.com.au,watoday.com.au,domain.com.au##div.cT-comments
  4. Repeat steps 2 and 3, pasting the following line of text: news.com.au,dailytelegraph.com.au,heraldsun.com.au,adelaidenow.com.au,themercury.com.au,couriermail.com.au,ntnews.com.au,thepunch.com.au##div.comments-group,div.article-comments,div#comments,div.feedback-comment
  5. Click “OK” to save your changes.

Instructions for Chrome:

  1. Click the spanner icon in the toolbar, navigate to the “Tools” submenu, and select “Extensions”
  2. From the list of extension, click “Options” under AdBlock
  3. Under the “Blacklist” tab, click “Edit” next to “Manually edit your filters”
  4. Paste the following text on the first line: smh.com.au,theage.com.au,brisbanetimes.com.au,nationaltimes.com.au,watoday.com.au,domain.com.au##div.cT-comments
  5. On a new line, paste the following text: news.com.au,dailytelegraph.com.au,heraldsun.com.au,adelaidenow.com.au,themercury.com.au,couriermail.com.au,ntnews.com.au,thepunch.com.au##div.comments-group,div.article-comments,div#comments,div.feedback-comment
  6. Click “Save”

Instructions for Safari:

  1. Click the “AdBlock” icon on the Safari toolbar.
  2. Under the “Blacklist” tab, click “Edit” next to “Manually edit your filters”
  3. Paste the following text on the first line: smh.com.au,theage.com.au,brisbanetimes.com.au,nationaltimes.com.au,watoday.com.au,domain.com.au##div.cT-comments
  4. On a new line, paste the following text: news.com.au,dailytelegraph.com.au,heraldsun.com.au,adelaidenow.com.au,themercury.com.au,couriermail.com.au,ntnews.com.au,thepunch.com.au##div.comments-group,div.article-comments,div#comments,div.feedback-comment
  5. Click “Save”

You’ve now blocked comments on most Fairfax and News Limited websites, as well as their ads.

If it turns out you want comments on any of these sites, just remove that domain from the blacklist. Let me know if any of these filters stop working, or if there are additional sites you’d like to see edited. Also, I’d love to see a developer turn this fix into a proper browser extension – it would be much easier for non-technical users to manage.

(This post was inspired by Carol, who has excellent taste.)

Disabling autoplaying videos and flyovers on smh.com.au and theage.com.au

Summary: This article contains instructions on using AdBlock Plus for Firefox and AdBlock for Chrome to remove autoplaying videos and the flyovers panel on several Fairfax sites. (Update: Instructions for Adblock for Safari below.)

Readers on popular Fairfax Media properties smh.com.au and theage.com.au will have noticed some obnoxious traffic-driving mechanisms introduced to increase revenue at the expense of user experience. Videos that start automatically, and panels that fly in from the side of the page when you’re done reading articles, are just the latest distractions added to a crowded and often incoherent news site. Since Fairfax doesn’t provide the choice to disable these nuisances, we’re forced to take it into our own hands.

You will need to install one of the AdBlock extensions linked above, depending on which browser you use.

Instructions for Firefox:

  1. From the “Tools” menu, select “Adblock Plus Preferences”
  2. Under the “Filters” menu, select “Add filter…”
  3. Paste the following line of text and press enter: smh.com.au,theage.com.au,brisbanetimes.com.au,nationaltimes.com.au,watoday.com.au,domain.com.au##div.cT-imageMultimedia
  4. Repeat steps 2 and 3, pasting the following line of text: smh.com.au,theage.com.au,brisbanetimes.com.au,nationaltimes.com.au,watoday.com.au,domain.com.au##div.cN-flyIn
  5. Click “OK” to save your changes.

Instructions for Chrome:

  1. Click the spanner icon in the toolbar, navigate to the “Tools” submenu, and select “Extensions”
  2. From the list of extension, click “Options” under AdBlock
  3. Under the “Blacklist” tab, click “Edit” next to “Manually edit your filters”
  4. Paste the following text on the first line: smh.com.au,theage.com.au,brisbanetimes.com.au,nationaltimes.com.au,watoday.com.au,domain.com.au##div.cN-flyIn
  5. On a new line, paste the following text: smh.com.au,theage.com.au,brisbanetimes.com.au,nationaltimes.com.au,watoday.com.au,domain.com.au##div.cT-imageMultimedia
  6. Click “Save”

Update: Instructions for Safari:

Courtesy of Under_Exposed in the comments section:

There is an Adblock for Safari as well… This installs an icon on the Safari toolbar which you click on to bring up a browser page where is you then click on “Blacklist” and follow steps 4 and 5 and 6 from the Chrome instructions produces the same results.

You’ve now removed videos and flyovers from these sites:

  • smh.com.au
  • theage.com.au
  • brisbanetimes.com.au
  • nationaltimes.com.au
  • watoday.com.au
  • domain.com.au

As a bonus, you’ll stop seeing the advertising on these sites as well.

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.