Thursday, March 22, 2018

Coding and Gardening

Warning: metaphors ahead! May be inappropriate or stretched.

Reading through student proposals for Google Summer of Code yesterday, I took a break from sitting in front of a keyboard to get some gardening done. We've had a few windstorms since I last raked, and with spring beginning, a few weeds have been popping up as well.

One of the issues I've been reminding almost every student about is unit testing. The other is documentation. These are practices which are seen as not fun, not creative.

Raking isn't seen as fun or creative either! Nor is hunting and digging the wily dandelion. But I rake away the dead branches and fir cones, and snag those dandelions because later in the season, my healthy vegetables and beautiful flowers not only flourish without weeds, but look better without litter around them. In addition, we chop up the branches and cones, and use that as mulch, which saves water and keeps down weeds. The dandelions go into the compost pile and rot into richer soil to help transplants be healthy. In other words, the work I do now pays off in the future.

The same is true of writing unit tests, commenting your code, and keeping good notes for user documentation as well! These are habits to build, not onerous tasks to be put off for tomorrow. Your unit tests will serve you well as long as your code runs anywhere. The same is true of your commented code. And finally if you code is user-facing, user documentation is what lets people use it!

So students, please remember to put those necessary bits into your proposal. This along with good communication with your mentor and the entire team are absolutely crucial for a successful project, so bake these into your plans.

More zsync magic for LTS updates

I wrote before about how to update superceeded ISOs using zsync, and it's time to do that again, now that 16.04 LTS has the latest point release, to .4.

So the new command needed, after cd /path/to/iso is

cp kubuntu-16.04{.3,.4}-desktop-i386.iso && zsync http://cdimage.ubuntu.com/kubuntu/releases/16.04.4/release/kubuntu-16.04.4-desktop-i386.iso.zsync

The magic I didn't fully understand was the {.3,.4} part. Now I get that it is saying copy the files ending in .3 and replace them with files ending in .4.

I wanted also to point out that zsync is also invaluable for testing, because Ubuntu spins daily ISOs. For instance, on the qatracker such as the most recent for testing the above point releases, http://iso.qa.ubuntu.com/qatracker/milestones/386/builds there are a number of small CD icons. When you click on one, you are led to a small page with for instance, the following links to get xenial-desktop-amd64.iso:
HTTP http://cdimage.ubuntu.com/kubuntu/xenial/daily-live/20180228/xenial-desktop-amd64.iso 
RSYNC rsync -tzhhP rsync://cdimage.ubuntu.com/cdimage/kubuntu/xenial/daily-live/20180228/xenial-desktop-amd64.iso 
ZSYNC zsync http://cdimage.ubuntu.com/kubuntu/xenial/daily-live/20180228/xenial-desktop-amd64.iso.zsync 
GPG signature http://cdimage.ubuntu.com/kubuntu/xenial/daily-live/20180228/MD5SUMS.gpg 
MD5 checksum http://cdimage.ubuntu.com/kubuntu/xenial/daily-live/20180228/MD5SUMS
The http link will download via your browser to your ~/.Downloads folder unless you have set that otherwise. Fine if you want your testing ISO to be there. If instead you do zsync by

cd ~/Downloads && zsync http://cdimage.ubuntu.com/kubuntu/xenial/daily-live/20180228/xenial-desktop-amd64.iso.zsync

in the commandline, you will see a remarkable difference in how long it takes to download the second and subsequent times. Rsync does roughly the same thing. For these you do not need the "copy" cp step.

Get familiar with zysnc and use it more. It will save you time and make you more productive.

(originally posted a couple of weeks ago, but to my genealogy blog by mistake)