Category Archives: Misc

Avoiding HTC Locations

I recently updated my HTC Desire HD to Android 2.3, which is quite nice.

Unfortunately, HTC has used this upgrade to force its Locations app into the system – if you select an address in Calendar, then Locations will open, even if you have another mapping application set to default.

Happily, if this is something that bothers you, there’s an easy workaround for this.

  1. If you haven’t already, install a file browser app – I use ASTRO File Manager.
  2. If you haven’t already, register an account on Android Forums.
  3. Go to this post, and download the attached file, com.google.android.calendar.apk. This is the default Android Calendar app.
  4. Plug your phone into your computer, so it appears as an attached drive, and copy com.google.android.calendar.apk to your phone. Once it has finished copying, disconnect your phone.
  5. Open ASTRO File Manager, and locate com.google.android.calendar.apk. Select it, then use the “Open App Manager” option.
  6. Install it.
  7. Go to your Apps, and open the Calendar app. The first time you open it, it’ll crash – you can just Force Close it.
  8. Open the Calendar app again, and open an event – it will ask you which Calendar app you want to use as default, select the one with the Blue calendar icon.

Okay, so there are a few steps involved, but if you’re familiar with side-loading apps, it shouldn’t take you more than a few minutes.

After this, individual events will open in Google Calendar, which does use your default mapping application. It won’t disable HTC Locations completely, but it’s the best option we have.

Finally, an open letter:

Dear HTC,

Respect system defaults.

Love,
Android users everywhere.

Below the Line Voting Data: Roll Your Own Analysis

I’ve had a few people ask where I got the data for my last couple of posts, so I thought I’d put together a quick how-to for performing the same analysis, or running your own queries. I’ve used MySQL for this, but you should be able to easily convert these statements to work with your data store of choice. (Feel free to post them in the comments!)

First of all, you’re going to need to get the raw data. The AEC provides this as a bunch of CSV files, available for download on their site. The 2010 data can be found here, the 2007 data can be found here.1 Grab the National list of Candidates, and the State Below the Line Preferences files.

Next up, create some tables to hold this data. Here’s the table definition for the candidates table:

CREATE TABLE `2010_candidates` (
    `state` varchar(3) NOT NULL,
    `party` varchar(5) NOT NULL,
    `party_name` text NOT NULL,
    `candidate_id` bigint(20) NOT NULL,
    `surname` text NOT NULL,
    `name` text NOT NULL,
    `elected` varchar(1) NOT NULL,
    `historic_elected` varchar(1) NOT NULL,
    KEY `party` (`party`),
    KEY `candidate_state` (`candidate_id`,`state`)
) ENGINE=InnoDB;

You’ll also need to create a table for each state. You could put it in one big table, but I was doing all of this on my local machine with a limited amount of RAM, so I wanted to keep the tables small:

CREATE TABLE `2010_prefs_nsw` (
    `candidate_id` bigint(20) NOT NULL,
    `preference` int(11) NOT NULL,
    `batch` int(11) NOT NULL,
    `paper` int(11) NOT NULL,
    KEY `candidate_pref` (`candidate_id`,`preference`)
) ENGINE=InnoDB;

Importing the data is pretty easy. Just run this query for the Candidate file:

LOAD DATA LOCAL INFILE "/path/to/SenateCandidatesDownload-15508.csv" INTO TABLE 2010_candidates FIELDS TERMINATED BY ',' IGNORE 2 LINES;

Similarly, run this query for each state (modifying for the correct file name and table name, of course).

LOAD DATA LOCAL INFILE "/path/to/SenateStateBTLPreferences-15508-NSW.csv"  INTO TABLE 2010_prefs_nsw FIELDS TERMINATED BY ',' IGNORE 2 LINES;

You now have all of the raw data. I preferred to make a summary table to hold the preference count for each candidate:

CREATE TABLE `2010_prefs_summary` (
    `candidate_id` bigint(20) NOT NULL,
    `preference` int(11) NOT NULL,
    `preference_total` bigint(20) NOT NULL,
    KEY `candidate_pref` (`candidate_id`,`preference`)
) ENGINE=InnoDB;

Populating this table is pretty easy. Just repeat this query for each state (note the reference to the 2010_prefs_nsw table, and the “NSW” WHERE clause):

INSERT INTO 2010_prefs_summary
    ( SELECT
        c.candidate_id, p.preference, count( p.preference ) AS preference_total
    FROM
        2010_candidates c
    LEFT JOIN
        2010_prefs_nsw p
    ON
        c.candidate_id=p.candidate_id
    WHERE
        p.state="NSW" );

Now, grabbing the preference data for any candidate is quite easy, you just need to know their candidate_id (look it up in the 2010_candidates table):

SELECT * FROM 2010_prefs_summary WHERE candidate_id=12345;

Have fun! If you come up with anything interesting, let me know on Twitter, I’d love to hear about it!

  1. I’ve contacted the AEC, but it seems they don’t have data available from before the 2007 federal election – I assume they just didn’t store the raw counting data.

Conroy and Fielding: The Battle for Last Place

The 2010 Australian Federal Election saw a battleground being drawn – between those who advocated voting Stephen Conroy last (for his “insist[ence] on pressing ahead with a Mandatory Internet Filter for Australia”), and those advocating voting Steve Fielding last. As it turned out, voters were cool with letting them share last and second last places.

Thanks to the amazing amount of data the AEC make available, we’re able to analyse how people voted Below the Line on their senate ticket. This graph shows how many people placed these two candidates at each position (click for full-size):

There are several points of interest here. For Senator Conroy, his largest spikes by far were at 2 and 8. This suggests that a large chunk of people are voting Labor first or second, probably after the Greens. Similarly, the spike at 57 would coincide with voters putting Labor last. Senator Fielding sees a similar pattern, the spike at 1 being people putting Family First first on their preferences, the group of spikes at the end would be Family First being voted towards last, the final spike at 56 being a large group of voters putting Family First as the last party on their ballot.

Far more interesting, however, are the last few places on the ballot. If people were voting by party, this should drop off significantly. Instead, we see both candidates having a significant proportion of voters1 putting them last or second last.

As I mentioned in my previous post regarding Below the Line statistics, both NSW and Queensland saw an increase in the proportion of voters choosing to vote Below the Line, a 0.37% and 0.3% increase, respectively. As the proportion of Below the Line voters tends to increase as the number of candidates decreases, one would expect Victoria to see a similar increase. As it turns out, the push for people to vote Below the Line saw a greater effect in Victoria, with a 0.89% increase. I would attribute most, if not all, of this growth to the campaigns mentioned above, and the availability of tools like Vote Below the Line.

So, what can we take away from these numbers? First of all, given that both of these campaigns were entirely word-of-mouth based, with zero advertising, they were surprisingly effective. Contacting and convincing 7-9% of voters to vote in a particular way is no mean feat. Social media certainly played a large part of this, whether it be new media like Twitter and Facebook, blogs like Crikey, or forums like Whirlpool.

Secondly, voters should see this as clear evidence that every individual does have a voice, when put together, can add up to a shout!

Finally, both of these Senators, along with all candidates, should read it as a clear message – voters do associate particular behaviour with particular politicians, and are capable of organising to send a protest vote to them.

  1. Fielding: 8.9%, Conroy: 7%

Voting Below the Line: It’s the New Black

Voting Below the Line. For a long time, it’s been the domain of the political nerds, the 3% of the population who know the policy of every party on any topic. However, thanks to the rise of sites like Below the Line, it’s suddenly become easier to plan your vote in advance, without the stress of standing in the little cardboard booth on election day, trying to remember the difference between the Australian Labor Party and the Democratic Labor Party, or the Socialist Alliance and the Socialist Equality parties.

Pushing this new trend is the idea of protest voting a particular candidate – movements have sprung up, encouraging people to vote Stephen Conroy last (for his “insist[ence] on pressing ahead with a Mandatory Internet Filter for Australia”), or to vote Steve Fielding last (for being Steve Fielding, I suspect). So, how effective were these campaigns? Well, we can’t know quite yet – the Australian Electoral Commission are yet to release the Below the Line voting data for Victoria. However, while waiting for the AEC to make it available, I’ve checked out what’s been happening around the country:

  • Victoria isn’t the only state that saw protest voting a candidate as a way to get a message across – in Tasmania, Eric Abetz (Liberals) and Christine Milne (Greens) saw an unusually high proportion of people putting them last on the ballot (in comparison to other candidates, or their own party). Similarly, Gary Humphries (Liberal) in the ACT found himself put last by a large chunk of the voting populace. Unfortunately, I’m unfamiliar with all of these candidates – perhaps someone more knowledgeable can fill me in on why they ended up like this?
  • One Nation, The Climate Sceptics and Family First are generally disliked around the country. They were by far the most common parties to be put last.
  • Despite the unending news reports describing the epidemic of voter apathy in NSW and Queensland, both states saw an increase in the proportion of voters voting Below the Line – up from 1.78% and 2.68% to 2.15% and 2.98%, respectively.
  • Around the nation, there was a general increase in the proportion of voters going Below the Line, up ~0.47% from 3.14% to 3.61%.
  • Generally, the proportion of voters choosing to vote Below the Line increases as the number of candidates decreases.
  • Tasmanians seem to be the most willing to vote Below the Line, with 19.53% of people taking the extra few minutes to do it.

Hopefully the Victoria Below the Line data will be released soon. Naturally, I’ll be analysing how Senators Conroy and Fielding fared, and bringing you the results.

As a slightly less serious aside, there are no statistics on the number of polling places with sausage sizzles. As my local church hall had no such BBQ-related facilities, I will be pushing at both a state and federal level for urgent electoral reform to be enacted – the AEC should be responsible for ensuring all polling venues have fair and equal access to the appropriate equipment and supplies required to provide voters with charcoaled meat in a slice of white bread. :)

UPDATE 2010-09-21: Victorian stats released, corrected total BtL statistic to match.

Tabs in Firefox 4 (aka, I can’t believe it’s not Chrome)

First up, if you’re not sure how, Lifehacker has a great reference on where to find your userChrome.css file.

One of the things I love about Google Chrome is that it shows all the tabs at once – even if it has to get really squishy. By default, Firefox limits them to 100px wide, then starts scrolling. Since Firefox 2.0, you’ve been able to use browser.tabs.tabMinWidth to disable this. As of Firefox 4.0b2, however, this functionality has been moved to userChrome.css. Add the following CSS to your userChrome.css to make it act the same as Chrome:

.tabbrowser-tab[fadein]:not([pinned]) {
    min-width: 1px !important;
}

Another great feature of Chrome is having the tabs in the title bar, as it reduces wasted space. Again, you can get the same functionality very easily with Firefox 4, by adding the following to your userChrome.css:

#appmenu-button-container {
    position: fixed !important;
}
#appmenu-button {
    padding: 3px 18px 3px 18px !important;
    margin-left:3px !important;
    background-color: rgba(54, 121, 166, 0.2) !important;
}
#toolbar-menubar {
    margin: -25px 100px 5px 100px;
}
#navigator-toolbox[tabsontop="true"] #TabsToolbar {
    margin: 0 125px 0 95px;
}

Note that I’ve tweaked this for Windows 7 – you may need to alter the values for other platforms. Feel free to post your tweaks in the comments!

As a bonus, here’s a screenshot of these tweaks in action – lets play “guess which websites Gary has open”.

Firefox Tabs.png


UPDATE: 2010-09-08: Firefox 4 beta 5 changed how this worked a little bit, so I’ve updated the userChrome.css code.

WordPress Shouldn’t Use nofollow

In my random wandering across the internet today, I discovered that, by default, WordPress adds the rel="nofollow" attribute to links in comments. Now, we all know the original purpose of nofollow, to try and discourage comment spam. This isn’t really relevant to WordPress anymore, though. Akismet has been supported in WordPress for quite some time. Indeed, I noticed that 2.7 comes with it installed by default. I can attest to the quality of the Akismet plugin: out of thousands of spam comments, it has let exactly one through, and I’ve had one false positive.

To that end, I strongly recommend all WordPress users install Akismet, and the DoFollow plugin. All it does is disable the nofollow attribute on external links in the comments. With the help of Akismet, you can safely do this without providing assistance to spammers.

And to everyone who has contributed to my blog in the past, my apologies for giving you your proper due. That has now been remedied.

Embed YouTube videos with XHTML 1.0 Strict code

Being a bit of a web geek, I like to keep my sites running in Strict mode for whatever HTML/XHTML version I happen to be working in. So, I was saddened to discover that the Embed code that YouTube gives doesn’t pass XHTML 1.0 Strict, due to their use of the now deprecated embed tag. Happily, there’s a way to fix this. As a bonus, the code required is much nicer than the code YouTube gives you:


    

You just need to replace the two URLs with the one for your video, and set the appropriate width/height. YouTube’s defaults are 320×265, 425×344, 480×385 and 640×505.

There you have it! It’s a simple as that. And to prove it works, here’s the same code from above:

Fed Square Microbreweries Showcase

Yesterday, I went to the Microbreweries Showcase, held at Federation Square. With 17 breweries showing their product, there were plenty to try from. Here are my notes from the variety I tasted:

BreweryBrewNotes
Arctic Fox BreweryIce Cap LagerLight flavour, with a slightly fruity aftertaste. Drinkable, but not particularly exciting.
Bridge Road BrewersDark AleA solid porter. Nice smoky flavour.
Buckley’s BeersPilz LagerVery sweet. Easy to drink.
Original AleSweet, light flavour.
Coldstream BreweryCiderBoring. Really unimpressive. Tasted like watered down apple juice.
Grand Ridge BreweryNatural BlondeA sweet wheat beer, with a hinte of orange. An excellent summer beer.
Holgate BrewhouseWhite AleA clove flavour, reminded me of spiced wine.
Big Red PilsnerBrilliant, rich red colour. Boring flavour.
Temptress Dark AleA rich porter, made with vanilla beans and Dutch cocoa. Could work even as a dessert beer.
Matilda Bay Brewing CoSebastian Reserve DunkelweizenSweet and dark, with a hint of apple. Tasty.
Mildura BreweryMallee BullBrilliant colour, uninspiring flavour.
Mountain Goat BreweryFancy Pants Amber AleSimilar to their Hightail Ale, but not quite as strong a flavour. Slighty sweet, slightly spiced. Smelled of celery, for some unknown reason.
Prickly Moses – Otway EstateSummer AleBleh. Reminds me of Carlton Draught.
Red Duck BreweryPale AleLight flavour. Nice summer beer.
Honey PorterLight porter flavour, strong honey flavour. Nice, but similar to Beez Neez, I couldn’t drink much of it.
Southern Bay Brewing CoEffen Premier LagerA fairly standard lager. Good to drink, but nothing exciting.
Sweetwater Brewing CompanyGolden BitterTastes like it should have flavour, but has been watered down instead.
Temple Brewing CompanySaisonGood flavour, reminded me of Hoegaarden. A hint of cloves.
The 3 Ravens Brewing CoDark Smoke BeerAn excellent stout. Traditional, tasty.
2 Brothers BreweryGrowlerAn American brown ale. Nice, but nothing special. Kind of a light porter.
Three TroupersPilsnerLight colour and flavour, like a Pilsner should be. Small bite in the aftertaste to keep things interesting.

All up, a good variety from some of Australia’s microbreweries. Particularly worth mentioning is Holgate’s Temptress Dark Ale, which is probably the best chocolate beer I’ve had. Buckley’s Beers also gets a second mention, for making my two favourite beers for the night, though the Original Ale just beats the Pilz Lager.

pento.net goes mobile!

With a bit of fiddling around, I’ve found a good combination of WordPress plugins for mobile support.

  • For iPhone/iPod: WPtouch. Lots of options, looks good on the iPhone browser.
  • For all other mobiles: WP-viewMobile. This one is particularly handy, because it gives you the option to define the user agent strings it should activate for. To make it play nicely with WPtouch, I just had to remove the iPhone and iPod entries.

For both of these, setting them up was as simple as turning them on. I also added the various search engine mobile crawlers to WP-viewMobile. At the moment, the list of user agent strings I have are: Googlebot-Mobile, Y!J-SRD/1.0, msnbot-mobile, MSMObot. If anyone knows any others, please let me know.

So now, if you desperately want to check my site from the road, you can read it a bit easier on your mobile screen.