Mar 052013

I’ve discovered the fantastic yearbox plugin for Dokuwiki, which is superb for my electronic lab notes.  However, implementing it neatly required me to change the filename of every log entry from the last few years.  In my old Dokuwiki system, each log had a filename like


I needed to keep the directory structure, but change each filename from two digits to the form “2013-01-07-ljr.txt”.

It turns out to be fairly straightforward with some clever bash tricks.  I changed into the log directory and used this command:

 for i in `find -name '??.txt'` ; do mv $i ${i%/*}/${i:2:4}-${i:7:2}-${i:10:2}-ljr.txt; done

Here the first part finds all files with names of the form “??.txt”.  Then each file is renamed with the “mv” command.  The ${i%/*} gives the file path with everything after the last “/” removed (ie it gives the subdirectory of the file).  Then the rest of the parentheses give extracted parts of the filepath string.

All files stayed in their own directories, and were renamed with additional information from their directory path.  Easy!  Well, not unless you know the details of string manipulation in bash – which I don’t.  I found enough information to do this after looking here and here.

Mar 052013

I often use the “-” symbol to separate parts of a long filename.  For example, my photos are systematically named things like “20130214-1123-34_some_event.jpg”.  For filename maintenance I regularly use the rename command, which allows me to do things like

rename some another *

which would replace the word “some” with the word “another” for every filename in the current directory.  When I need to replace a chunk of filename starting with the “-” character, the rename command thinks I’m passing it an option.  I’ve just found a helpful answer that shows how the “end-of-options” signal fixes this problem.  This signal is simply a double dash “–“.  For example, this command

rename — -11 -10 *

would change the timezone on a bunch of photo filenames.

Dec 092012

In the last few weeks I have both moved into a new house and constructed hexaflexagons in celebration of Martin Gardner’s birthday.  If you don’t know what I’m talking about then you must go and watch Vi Hart’s videos on the exciting topic.  This unusual combination of activities led me to discover a remarkable Ikea-hack: the flat-pack hexaflexagon.  Excitingly, this product is available at all Ikea stores completely free of charge!  It is cleverly disguised as an appallingly practical paper measuring tape, but a small amount of construction will transform the strip into an entertaining mathemagical toy.

Nov 232012
Partition scheme with Gentoo Linux and Windows 7

By making 100 MB available for Windows to create a primary partition with boot essentials, I was able to get it happily installed in a logical partition without even disturbing my Gentoo Linux installation.

Almost 10 years since I removed Windows from my computer and gave the whole hard drive to Gentoo Linux, I had a specific reason to put it back on. Naturally I’ve gone through a few computers in the last decade, but the flexibility of Gentoo has enabled me to transfer my Linux installation across numerous hard drive upgrades and computer changes. I have not been in the habit of leaving hard drive space for any secondary operating system.  At first I feared I would have to do a full backup and then restore my system to a new set of partitions, but found a much quicker solution where the hardest part was persuading Windows to install on a logical partition.

Continue reading »

Jul 042011
Baked pies

Tau Day is celebrated with two pi(e)s, and we couldn't let that expectation go unfulfilled.

Pi is wrong. This startling assertion became so abundantly clear to me last week that I was surprised it has taken this long for me to encounter the arguments. Of course, as the number of diameters in a circle’s circumference then pi = 3.141592 653589 793238 462643 383279 50288… is technically correct. But it is wrong conceptually! Mathematically it is the radius, not the diameter, which is the defining dimension of a circle.

And so a better circle constant is τ (tau) =2π. Happily I learnt of this just in time to celebrate Tau Day.

There are many excellent reasons why tau is better than pi, and I won’t bother presenting them all here. Michael Hartl makes the argument convincingly in The Tau Manifesto if you are looking for some reading, but this video presents the salient points in a thoroughly entertaining way.

If you’re strugging to catch on to tau as the new circle constant, then maybe this musical representation of the number will help.

We dutifully and cheerfully celebrated Tau Day with two pies, and it is a shame that next June 28 is a year away. I guess that is a full year in which to extol the virtues of Tau.

And there’s another job to do. The 36 digits of pi listed above were written from memory. I have them firmly lodged in my brain as a result of a friendly competition in grade 5. Now I’m going to have to memorise at least 37 digits of tau!

Apr 282011

Quite a bit has happened since I wrote my last post here.  I’ve moved from Canberra up to Cooranbong, and am still trying to unpack the last of the boxes.  This move was the cause for quite a serious outage of this website, as my webserver needed to be packed and transported and unpacked.  Oh, and having the internet connected to our new home took far longer than anyone expected.

Another new thing is my current position as a full-time lecturer in physics.  I have returned to Avondale College of Higher Education where I did my undergraduate degree, this time to teach for a year.  I’m enjoying lecturing, and it is excellent professional experience to have.

Finally, and most dramatically, we have a new member in our family.  Two weeks ago Leighton Jeffrey Rogers was born, and he is currently managing to keep his parents thoroughly occupied.

Me holding baby Leighton

New baby Leighton

Jan 062011
home-made Christmas tree ornaments

Our Christmas tree was a small live sapling in a pot, and we hope to be able to use it again next year.

In our in our house we’ve decided to start a tradition of leaving Christmas decorations up till January 5, which means that we can continue to enjoy them throughout the “12 days of Christmas” (yes, the traditional period of “Christmastide” only begins on December 25).  Appreciating this duration in our season of Christmas might even help avoid the commercial and materialistic extremes of what Bill Bailey has called the “primary gifting period”.

This all means that we took down our tree last night, which is the reason for writing about Christmas ornaments now even though its too late.  Things like this could work really well for Easter too, so publishing it now gives you all time to have a go yourself. Continue reading »

Jan 042011

I’m sure you’ve experienced the frustration of trying to extract a small gadget from it’s plastic clamshell packaging.  If not, then you have avoided one of the great curses of our high-tech culture.  These tough plastic cases are fused together in a factory, in an apparent attempt to prevent any purchaser from actually being able to access their new toy.  Trying to open such packets invariably leads to a furious anger which, I was delighted to learn, is known as “wrap rage”.

This large clamshell package with two cardboard inserts was simply to hold a 1 metre audio cable until I had it at home!

Beyond being almost impossible to open, this sort of packaging leads to a deeper fury about resource management.  Hard plastic clamshells add weight to products while they are transported, so their distribution costs more energy.  If they are ever actually pried open, they are immediately rubbish.  Hopefully they will be recycled, which still requires further energy, but too often the refined transparent plastic is just sent to landfill.

A while ago I was on a holiday and decided to play a video off my laptop.  I was able to connect the computer to the large television display, but my gadget travel-bag didn’t include the required audio cable.  Since my laptop speaker is poor, I went and bought a short wire to do the job.

The cable was only 1 metre long and would have fit in a small paper bag, but instead it was housed in a typically enormous clamshell package.  Being on holiday meant that I was not suitably armed to penetrate such a sturdy exoskeleton, and much wrap rage ensued.

I had seriously entertained the idea of asking the shop assistant to open the plastic and deal with the rubbish in-store, and I think I will make that my policy from now on.

Recycled cardboard packaging, with natural string and paper loops holding cable in place.

Buying an HDMI cable recently threatened to be a similar experience, but became an epiphany when I saw a cardboard box gleaming out from between the garish plastic clamshells.  Not only was the box recycled and recyclable, but the cable was made from “components which comply with the Regulation of Hazardous Substances directive” in a factory that has an “Environment Management System certified under the international standard ISO14001”.

They even donate $1.50 from each pack sold to Landcare Australia, who empower volunteers to “breathe new life into waterways”, “bring back trees”, and “restore wildlife habitats”.  Even if only half of these claims are true, this  is an exciting future for wrapping gadgets.

Oct 062010

As I began looking at what goes into food I was surprised by the ingredients in packets of chips.  It turns out that different flavours vary wildly in terms of ingredients and additives, and there are general patterns that apply across many brands.  Perhaps the most surprising thing of all is that good old plain salty chips are remarkably simple and natural! Continue reading »

Sep 202010

I have not written much here about food.  In fact, the only post that would come close was a report on the success of our verandah-garden some time ago.  Recently I’ve been doing a bit of thinking about food and what goes into it, which all started with some research into those little numbers that typically appear in the “ingredients” list on the side of food packets.  I was sure that lots of those numbers stood for fairly ordinary food items, but I had a suspicion that some of them were hiding nasty un-foody chemicals.

It is fairly easy to identify the numbers which are simply shorthand for regular ingredients, as their names are familiar.  Number 330, for instance, is nothing more mysterious than citric acid.  Trying to sort out the more unpleasant additives is a much more difficult challenge.  Chemicals must be approved before they are allowed to be used in food, but there are some officially approved additives which can be linked to health problems.  The difficult part is that most of these cases are only documented anecdotally, and it is easy to find conspiracy theorists who massively over-react to the more sensible data.

The best discussion of harmful additives, exploring the science as well as many personal anecdotes, is the Food Intolerance Network website.  They have a handy summary of additives to try and avoid, which I have printed off and placed in my wallet.  I’m not claiming this list to be the definitive judgement on food additives, but it is a good enough starting point for me to perform an experiment every time I go shopping for groceries.  I’m trying to find out how easy it is to live without eating “bad numbers”.

bread loaf on cooling rack

Making food from scratch is the best way to be sure of what goes into it.

I  have to admit that I’ve been surprised by the ubiquity of unpleasant additives.  Preservatives are especially widespread, and can be found even in many “health” foods.  There are some particularly interesting “results” of my experiment that I will be writing up and sharing here over the next little while.

Perhaps it isn’t obvious why I’ve chosen to write about food in this “Changing the World” category.  However, I believe that global health and personal health are related.  It seems apparent that sustainable interaction with our natural environment will maintain the most abundant way of living.  There’s little sense aiming for a planet that will support life to the full, if we’re eating ourselves to death or depression or distraction.