09 Jul 2016, 13:38

White Australia, Blessing in Disguise

For approximately 100 years (c.1850-c.1950) Australia had a policy of preferring immigrants from Britain and European countries. The origins of the policy are rooted in the gold-rushes of the 19th century, and tensions between the majority white miners (both local and immigrant) and Chinese immigrant miners. In many cases the Chinese miners were more successful than their white counterparts due to their hard work ethic and ability to work cooperatively amongst themselves - traits that hold true today. This success, combined with the social barrier that different culture and language present, caused much resentment from whites leading to protests and riots.

The subsequent restrictions on non-white immigration were later referred to collectively as the ‘White Australia Policy’ (WAP), although this was never the official name. It should also be noted that immigrants of non-white ethnicities were never expelled from the country on the basis of their ethnicity during this period. Many Chinese Australians can trace their ancestry back to the miners of the 19th century.

Today the common narrative in academia and the media is that this policy was a bad thing, a stain on Australia’s history, and that we’ve progressed beyond such primitive and parochial ideas. To the contrary, I think the WAP has been a net positive, and modern Australians owe a debt of gratitude to the political leaders of that era for their foresight and resolve. The WAP allowed Australia to pass through its crucial adolescence years as a nation with one overarching culture - British - with other highly compatible Western European cultures being mixed in. This provided a solid foundation on which to build a national identity - something that modern Australians (of all ethnic backgrounds) can all unite around.

This is not to say that people with white skin or with european ancestry should get any preferential treatment or privileges - not at all!! It is to say however that someone from another cultural background living in Australia should be expected to learn to speak English & adopt the values of western civilisation: respect for individual rights, respect for the sanctity of life, rule of law, treating people fairly irrespective of gender, age, sexuality.

If Australia had not implemented the WAP then it is unlikely Australia would have a national identity that spans the entire continent. As such, it’s unlikely that we could have formed the commonwealth of Australia, and instead may have ended up with smaller nation states, divided by culture and language. In such a scenario, it’s hard to see how we would have withstood military interference from the likes of China or Indonesia, as it’s unlikely we would have the strong military and economic ties we currently enjoy with America.

28 May 2016, 13:38

Map Area Measurement Tool

Today a created a tool for measuring areas on maps: http://pace7.com/utils/maparea/

Map tiles and data courtesy of Openstreetmap.

08 Nov 2015, 13:38

Garmin Contour Map

For anyone who’s interested, I’ve created a contour map of South East Queensland that is suitable for use with Garmin devices (I use a GPSmap 62s).

You can download the .img file here.

To install, copy the file onto your SD card under the Garmin folder/directory. On your device make sure the map is ‘enabled’. The contour map will overlay contour lines over your main map. Have fun!

30 Oct 2015, 13:38

Classifieds

I’ve been using the Gumtree classifieds website a lot recently and have noticed some odd behaviour from people advertising their goods.

No photo

What’s the deal with so many ads not having a single photo of the item being advertised!? Isn’t it just common sense that an ad with a photo will be far more likely to get views than one without? Are these people really so lazy that they couldn’t be bothered to take a photo and upload it with their ad? Everyone has a mobile phone these days with a camera, and Gumtree has a mobile app which makes it very easy to upload photos…so there really is no excuse. I’m pretty confident if people had to pay for their advert, they might be inclined to make that little bit of extra effort.

Dodgy photos

OK, so the seller has made the effort to take a photo and upload it. Why in hell did they take the photo at night, with the item stuffed in a corner where it’s hardly visible?

Sob story

The number of ads I’ve seen where the seller tells some rambling story about their personal circumstances, why they’re forced to sell due to hard times, what they’re going to do with the money, and any number of other totally irrelevant details. Seriously, cut the crap and just give me the facts about the item already!

Little relevant detail

Some ads might have a fantastic photo, but barely any relevant details about the item. For example, I’ve seen many motor vehicles ads where the seller hasn’t bothered to list the essentials: make, model, year of manufacture, mileage

Swaps

Swaps, swaps, swaps! It seems like every second ad wants to swap their thing for some other thing. Often times, what they want to swap for is a completely different category/class of significantly different value….what are these people smoking?

No time wasters, No scammers (please)

So many ads telling time-wasters, tire kickers, scammers to stop doing….what they do. Time for a reality check - if you sell anything in a public Internet forum you will, at some point, encounter non-genuine buyers. Sellers who whinge about it in their ad are just turning off the honest buyers (at least that’s the effect it has on me).

20 Aug 2015, 13:38

Dishwasher vs Hand Wash

At the end of a dinner party recently I got up and offered to help ‘wash the dishes’. Some of the other guests responded in somewhat astonished tone ‘oh, no need - she has a dishwasher!' (she being the hostess) as if the dishes would somehow put themselves in the machine.

This got me thinking, just how much more time, effort, energy, water does a dishwasher actually save? The benefits of a washing machine (for washing clothes) is abundantly obvious to me. When you compare what people had to do prior to the invention of the washing machine with what we do now, the difference is starkly in favour of the washing machine. The benefits of the dishwasher, in comparison, are not as immediately apparent.

I should be quick to say that I have nothing against dishwashers per se. If people feel that it helps them, then great - use a dishwasher by all means. The problem I have is with what seems to be a blanket rule that dishwashers are always superior without any application of critical thinking.

This is something I would love to see a group like Mythbusters look into: setup an experiment where a standard load of dishes is cleaned via dishwasher vs hand wash, considering all the variables involved. Well it turns out that Mythbusters have already done this experiment. Unfortunately, the experiment was sponsored by a dishwasher company (!!) and so the result was always going to favour the dishwasher, duh!. Hopefully someone else will do a more fair & balanced comparison.

Other comparisons I found focused on water usage and hygiene - neither are things that I see as being major issues. Unless you hand wash under a constantly running tap, then water usage shouldn’t be that much different. On the point of hygiene, most of that seems to be scare mongering propagated by dishwasher companies! Time and effort are the two major concerns I have, followed closely by overall $$ cost.

I must confess that I have never lived in a house where a dishwasher was in regular use. I have pretty much always washed by hand as a result. When I have stayed in houses with a dishwasher, I’ve not tended to use them as I know how long it will take me to wash by hand, it doesn’t feel like a chore. I think this point is key - I’m well practiced. People who are not used to washing by hand will naturally take longer to do the job and will actually be working harder due to their hands and arms not being used to the routine. When I wash by hand, the item moves from one side of the sink to the other side in a constant, steady stream - not much slower than it would take me to place that same item into the dishwasher. I also tend to leave items to drip dry - come back in a few hours and simply put the items away, using a tea towel to wipe any damp bits. Again, not much slower than taking the item from the dishwasher and putting it away. So far, the dishwasher is slightly ahead in time saving and effort required. Then we have the pots and pans that cannot be cleaned consistently in a dishwasher. Most people I know, don’t bother trying to put them in the dishwasher and end up washing by hand. So on that point, both methods are equal. Once you add on the extra costs of a dishwasher: upfront cost, electricity usage, special detergent - the overall benefits of a dishwasher, in my mind, are marginal at best.

A case where I see a mechanised dishwasher as being superior to hand washing would be anywhere that an industrial dishwasher can be used - for example restaurants, hospitals etc. I have no doubt that at that large scale a machine will save a huge amount of time and effort. For domestic use with typical family-sized loads, I don’t see a compelling case for the dishwasher but I’m happy to be persuaded otherwise.

19 Jun 2015, 13:38

Ad Blockers and the Web

With the recent announcement that iOS9 Safari will enable the blocking of web ads, has come much weeping and gnashing of teeth from those on the web who’ve come to rely on ad-based revenue. If Apple deliver on the ad blocking, then many of these ad-supported sites will be severly impacted. I, for one, have no sympathy whatsoever. The writing has been on the wall for a very long time now.

I moved to an iPhone from Android about 6 months ago. Not because I love Apple or iPhones, only that I was given the handset. I’ve been mostly happy with the move except for the ad situation. Android supports loading Firefox browser and Firefox supports loading AdBlock (one of the first things I do whenever installing Firefox!). No such option on iPhone, so all of a sudden I’m being bombarded with ads everytime I browse the web. It was getting to the point where I was seriously considering ditching the iPhone for Android! This announcement by Apple has caused me to hold off until the full details of what Apple are planning. I don’t know what Apple’s motivations are for taking this step. If they were listening to user demand, they would have moved a long time ago. As it is, I suspect they have some other scheme cooking. Perhaps they’ll the same trick as AdBlock, and make ad companies pay to be exempt from the ad blocking. If they do that, then I’m jumping ship pronto!

If the blocking of ads causes many web sites to close down and we return to the web of the early 2000’s - simple web pages containing amateur content - GREAT!! Don’t get me wrong, I use and appreciate the ‘pro’ websites, it’s just that I don’t depend on them. If they’re gone tomorrow, I won’t miss them.

UPDATE Oct 2015: it turns out that Apple have chosen not to offer the ad blocking feature to older 32 bit devices. That included my iPhone5. Needless to say, I wasn’t shelling out for a new iPhone. I sold my iPhone and bought and brand new Android handset for less than half of what I got for the iPhone! It’s been over a month now and I couldn’t be happier - no more ads!

11 May 2015, 19:18

OpenWRT and IPv6

I just configured my home network to use IPv6. My router runs OpenWRT ‘Barrier Breaker’ which supports IPv6, so it was just a matter of switching on and configuring the functionality.

Unfortunately, my ISP does not provide native IPv6 so I’m using an IPv6 tunnel courtesy of Hurricane Electric Tunnelbroker service.

Configuring my router

The 6in4 tunnel

Hurricane Electric provide a handy auto-generated config snippet specifically for OpenWRT, so it was a simple matter of:

  • installing the 6in4 package - opkg install 6in4
  • updating my /etc/config/network file with the supplied config
  • restarting the network with /etc/init.d/network restart

For reference, my network config looks something like this:

config interface 'wan6'
	option proto 6in4
	option peeraddr  '72.52.104.74'
	option ip6addr   '2001:470:aaaa:467::2/64'
	option ip6prefix '2001:470:bbbb:467::/64'
	option tunnelid  '12341234'
	option username  'aaaabbbb'
        option updatekey 'xxxxxxxxxxxx'
	option dns '2001:470:20::2'

LAN interface

The next important step is to decide how you want IP addressing to work on your LAN. IPv6 address assignment can be done in 3 ways:

RA Only

In this mode clients get all their address info using NDP (neighbour discovery protocol). Thanks to RFC6106 RA can also contain DNS resolver information so, if that’s all you need, then a DHCP server may not be required.

RA with DHCPv6 (default mode for OpenWRT)

In this mode clients are get their primary address info via the RA, but are told to try DHCP for additional config.

NOTE: If you use this mode, then you need to ensure you have a working DHCP server aswell. Clients will attempt to solicit a DHCP address, and if the server is not running or not configured correctly then the client won’t configure properly. It seems obvious now, but this did cause me some confusion at first when my client was failing to configure due to my DHCP server being disabled

DHCPv6 only

In this mode clients are told to get all their address config from the DHCP server.

OpenWRT ‘Barrier Breaker’ uses the odhcpd process to manage both RA (router advertisements) and DHCPv6. It takes it’s config from /etc/config/dhcp. By default, my ‘lan’ config looked like this:

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv6 'server'
	option ra 'server'
	option ra_management '1'

The address assignment mode is specified by the setting: ra_managment:

  • 0: RA only
  • 1: RA with DHCP
  • 2: DHCP only

I have no need for a DHCPv6 server on my LAN so I set option ra_management '0' and disabled the DHCPv6 server with option dhcpv6 'disabled'

Configuring my client

I run Fedora 21 Linux on my desktop which supports IPv6 out of the box. NetworkManager can be configured in ‘Automatic’ or ‘Automatic, DHCP only’ modes. I just had to ensure that it was set to ‘Automatic’ and everything just worked.

Something to keep in mind with Linux clients is that, by default, router advertisements will be ignored on any interface that is forwarding traffic (routing). If you’re running Docker, then this is relevant to you! See this post for more information.

20 Jan 2015, 04:00

AngularJS: Form Validation

A common scenario when validating form input is to call back to the server to check some detail or other before the final submission. For example, where the user has been asked to select a username, we might choose to verify that the username is available ahead of time.

Rather than creating scope variables to keep track of whether or not a form is valid, we are better off using the built-in validation facility that AngularJS provides out of the box!

One powerful feature is the ability to set custom error conditions on a form field (in additon to minlength, required etc.). The following code snippets provide an example of how this can be used:

HTML

<form name="form" novalidate ng-submit="ConfirmAccount()">
	<p ng-show="form.$dirty && form.username.$error.conflict">
		Username is not available. Please try another one.
	</p>
	<input type="text" ng-focus="form.$setPristine()" name="username" ng-model="confirm.username">
</form>

form.username.$error.conflict will exist and be set to true by our controller once the username check has been performed.

Javascript

$scope.ConfirmAccount = function() {
	checkUserAvailable(user.username).then(function(result) {
		$scope.form.username.$setValidity("conflict", result.usernameAvailable);
		if( $scope.form.$invalid ) { return; }

		// proceed with form logic
	}
};

If the server returns result.usernameAvailable == false then the validity of form.username will be false, and our error message will be displayed. The "conflict" key is an aribtary label that I’ve chosen to indicate when the username is already taken, but you can choose anything you like.

06 Jan 2015, 00:20

Go: too many open files

Recently while creating a basic HTTP/HTTPS monitoring app, Pingo2, I started seeing too many open files error. This error was thrown after the app had been running for some time, and I attempted to open a new network connection.

Of course, in Unix/Linux network sockets are just files, so this error message actually makes sense in that context. First thing to do was run lsof to see exactly which files the process had open:

lsof | grep 19991
...
myapp    19991 20009 monitoring   38u     IPv4            4685252       0t0        TCP dev.example.com:44449->foobar:https (ESTABLISHED)
myapp    19991 20009 monitoring   39u     IPv4            4685250       0t0        TCP dev.example.com:45459->xxx.xxx.189.184:https (ESTABLISHED)
myapp    19991 20009 monitoring   40u     IPv4            4685251       0t0        TCP dev.example.com:45460->xxx.xxx.189.184:https (ESTABLISHED)
myapp    19991 20009 monitoring   41u     IPv4            4685253       0t0        TCP dev.example.com:44450->foobar:https (ESTABLISHED)
myapp    19991 20009 monitoring   42u     IPv4            4685268       0t0        TCP dev.example.com:44454->foobar:https (ESTABLISHED)
myapp    19991 20009 monitoring   43u     IPv4            4685266       0t0        TCP dev.example.com:45464->xxx.xxx.189.184:https (ESTABLISH
...

So, lots of ESTABLISHED network connections, each one corresponding with a HTTP connection my program had initiated. Now I was explicitly closing the HTTP response body after each connection, and thought that was sufficient for the connection to close down by itself. However it turns out that the default HTTP transport has TCP keep-alives enabled. The TCP connections were piling up in the background as a result.

Creating a custom http.Transport for the HTTP client with DisableKeepAlives: true fixed the issue.

11 Aug 2014, 05:28

AWS: Custom Centos Image

I recently had a need to deploy a t2.micro instance on EC2 running Centos. Unfortunately, there are no official Centos AMIs available that will run on the newer HVM instance types.

The AWS marketplace has several 3rd party Centos AMIs that support HVM. I used one of these as a basis for the new install.

Centos has the ability to boot up into a VNC server from which a network install can be done. Using this facility, I was able to create the custom install as follows:

  1. Launch HVM Centos instance (using AMI from marketplace)
  2. Insert into grub a new entry which will boot the VNC server
  3. Install new grub and reboot
  4. Connect via VNC to TCP port 5901 and proceed with normal Centos install
  5. ssh to new install and comment out the mac address HWADDR= from /etc/sysconfig/network-interfaces/ifcfg-eth0
  6. Create an image from the instance

The grub entry I used is as follows:

title Centos Install (PXE)
root (hd0,0)
kernel /boot/vmlinuz.cent.pxe vnc vncpassword=xxxxxxxxxxxx headless ip=dhcp ksdevice=eth0 method=http://mirror.centos.org/centos-6/6.5/os/x86_64/ lang=en_US keymap=us xen_blkfront.sda_is_xvda=1
initrd /boot/initrd.img.cent.pxe

This needs to go before your existing boot entry. Replace vncpassword value with your own. Note the xen_blkfront.sda_is_xvda=1 - this is required so the Centos installer can map the correct device name for your block device.

To apply the new config, run the following commands:

# grub
grub> device (hd0) /dev/xvda
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Thanks to this post on Sentris.com for the PXE boot idea.