Downgrading Subversion from 1.9.3 to 1.8.13, Ubuntu 16.04

I needed to run tests and fix an issue with Subversion 1.8, and on my recently-updated machine running Ubuntu 16.04 (Xenial), Subversion was installed as 1.9.3, which was the only version in the xenial repository.

So, a quick post of what I did, since googling produced no clear answer.

Download the 1.8.13 .deb files for subversion and libsvn1.

Install the latest from xenial repository (probably no changes, if you have Svn 1.9.3 installed):

% sudo apt-get install libapr1 libaprutil1 libsvn1

Remove libsvn1, because it is 1.9.3:

% sudo apt-get remove libsvn1

Remove (uninstall) Svn 1.9.3

% sudo apt-get remove subversion

Install downloaded packages “manually”

% sudo dpkg -i ./subversion_1.8.13-1ubuntu3_amd64.deb ./libsvn1_1.8.13-1ubuntu3_amd64.deb

Check version (should be 1.8.13):

% svn --version

Check the package:

% dpkg -l | grep subversion

And that’s it.

How to Order at a Restaurant

I recently went on a solo road trip (2700 miles), so I was able to practice ordering in a variety of new restaurants.

First, if you’re out, go to places other than what you’re used to. On my trip I avoided all chains (with the lone exception of Culver’s, which we don’t have in my area), so nearly all of the menus were new to me.

There are a few options when ordering. One is to order the dish you are not crazy about, i.e., that is something you might like. And if it’s a dish that that restaurant specializes in, go for it. Like many people, I generally dislike liver and onions, but one of the most memorable dishes I’ve ever had was exactly that, at a place renowned for it.

Try not to order what you make at home, or what you usually get. A million places make hamburgers (and I’ll humbly submit, mine are better than nearly all of them). So no burgers. No spaghetti. No meatloaf, etc. Try oysters, shrimp, and scallops (especially if you’re near the sea, or near a place where they get frequent shipments, i.e., a transportation hub).

The best is to ask the waiter/waitress, and don’t ask “what do you recommend?” First, from what I know of the restaurant business, they often are supposed to recommend certain dishes, often what is selling slowly or which for they have excessive ingredients.

It is recommended that with a doctor don’t ask “What do you think I should do?”. Instead ask “What would you do?” Similarly, ask the wait staff what they like most on the menu, which is different than asking “What do you [i.e., your manager] think I should eat?”

That is also a good approach when going to ethnic restaurants, to avoid being steered toward food that they think people of your (different) ethnicity would like. (I had a bit of an argument with a waitress in a Chinese restaurant, when I ordered pork bellies with Chinese spinach, from the “Chinese” section of the menu, and she tried to dissuade me, insisting on the kung pao chicken, which ironically was the first dish I ever had in a Chinese restaurant, many years earlier. And I quite liked the pork bellies, to her surprise.)

Another of my techniques is the three-finger selection. I splay my hand and drop it onto the menu, and I have to order one of the three dishes my fingers are pointing to.

I also recommend learning your wait staff’s names, and using them. I haven’t worked in that industry, but I’ve read and heard that it is exhausting and literally thankless. Being more personal with them is a great way to connect and converse, and I’ll selfishly admit that it has personal benefits: at an excellent meal on my trip, I talked at length with both the manager and the bartender. On my final bill, they comped me for one beer (Kwak, my favorite beer, and on tap), and dessert (pecan pie made with Gulden Draak, another of my favorite beers).

When eating out, it should be an adventure. After all, that’s one of the main reasons to go out, right?

Fakir 0.0.1 released

The initial version of Fakir has been released.

This gem is somewhat small, but contains some functionality that I’ve needed in various projects, such as getting a random element from an array (thus Fakir::Array#rand), and getting non-repeating random numbers, i.e. where [1, 1, 1, 2, 2] is actually random, but doesn’t look random, in the same way that [heads, heads, tails, tails] looks less random than [heads, tails, tails, heads].

Fakir::Random#rand goes even beyond that, with support for a “window” in which a number will not be repeated. Thus with a window of 3, a number will not be repeated within 3 invocations of rand.

This gem was developed for seeding Cabin Notebook, and I hope it’s of beneficial use for others.

Cabin Notebook and Fakir

After postponing for years I’ve been working on a website that I haven’t found the equivalent of, Cabin Notebook, which is currently populated (seeded) only with random data.

I’ve been using the excellent Faker Ruby gem, but found its random data to be … too random. That is, I didn’t want truly repeating random data, such as its wide variety of prefix+first+middle+last+suffix names and phone number formats (“Dr. Millie Beatrice Houndhouse III”, “(812)-555-1213” and “1-312-555-9696”), and having the same random number be used repeatedly (such as subsequent labels of “Photo #2”, annotating different photos). Fakir will also support a more flexible version of Array#rand, so that a random element will not be returned within N invocations of that method.

So I’ve created the fakir gem, which supports data that are not quite so random. It’s in the beginning stages, but I plan to have it soon be fully-featured enough to seed the data at Cabin Notebook.

Earlier anacron jobs

For whatever reason, anacron is set to run its daily jobs at 7:30 in the morning:

# /etc/cron.d/anacron: crontab entries for the anacron package

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

30 7    * * *   root	start -q anacron || :

The first time I encountered that was when I was working at that time of day and noticed the sluggishness of my machine. It seemed that locate was the heavyweight process, so I changed anacron to run at 4:30 a.m, modifying the last line in the file:

30 4    * * *   root	start -q anacron || :

New Z shell blog

I’ve started a blog exclusively about the astonishingly powerful Z shell.

Check it out here: Focus on Zsh.

The goal is to find some of the more interesting and complex examples of Zsh code, and to break them down, explaining them line by line. Despite having worked with Zsh for many years (over a decade), I consider that I’ve barely scratched the surface of what it can do, and, not finding many instructive Zsh resources, have decide to create one.

Please take a look, and I look forward to your feedback.

No dots in cron scripts?

I added a little script to /etc/cron.daily, sayhello.sh, while I sorted out how to integrate my backup script (tresync) into the list of cron jobs run daily.

The odd thing is, the script never ran. I could run it as “sudo /etc/cron.daily/sayhello.sh“, but it didn’t run with the rest of the cron jobs.

Lo and behold, I found the answer, which is actually on the man page for run-parts:

If neither the –lsbsysinit option nor the –regex option is given then the names must consist entirely of ASCII upper- and lower-case letters, ASCII digits, ASCII underscores, and ASCII minus-hyphens.

Which means: you cannot have a dot in the file name.

That seems quite counterintuitive, but perhaps there is a reason that I just don’t understand.

Printing the middle N lines of a file in Linux

While working on my “e” alias in my aforalias project, I want the show only the entries of zip files, that is, without the header and footer sections. The “e” alias also shows the entries sorted by name, unlike the behavior of “unzip -l“, which displays:

Archive:  gradle-1.12-all.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
<entries>
---------                     -------
102761855                     9503 files

Thus I wanted to print lines[3 .. lines.length – 3].

Lo and behold, there’s a way to do that with “head” and “tail”, as follows:

unzip -l $1 | tail -n +4 | head --lines=-2

tail -n +X” means “start printing at line X”, where 1 is the first line of the file (not 0).

And “head --lines=-X” means “print all but the last X lines”.

Not the most intuitive pair of commands in this context, but they can be quite helpful.

A for Alias

In Zsh (and other shells), aliases may be the most important feature for increased productivity.

A simple rule is this: the more often you run a command, the shorter it should be. I’ve written about this before, in Efficient Way to Improve Console Productivity.

I have a number of one-character aliases:

G='| glark'
H='| head'
L='| less'
M='| more'
S='| sort'
T='| tail'
a=alias
c=clear
h='history -5000'
l='ls -CF'
t=cat

I’ll write later about those nifty uppercase ones (and yes, there is the alias “a” for “alias”, but for now, I’ll just show them with examples:

alias G -g '^.='

That was the command that I ran to generate the list above. It expands to “alias | glark -g ‘^.='”.

find src -type d S

That finds all directories and pipes them to sort.

There are three “families” of commands that I run the most often:

  • diff – diff files
  • eye – look at/in files on the command line
  • find – list all files/directories matching a pattern
  • open – open files in editor, browser
  • search – look in files

So I have been writing one-character scripts/functions (in Bash) for each of the above, where the script understands context as well as the targets.

For example, “s pluralize” run from a directory that contains a “Rakefile” will expand to search (using glark) only for Ruby files.

e program.tar.gz” is the equivalent of “tar ztvf program.tar.gz“, and “e program.zip” lists the zip file, with entries sorted by name.

d dir1 dir2” runs a recursive diff on the directories, and “d path/to/file ../dir2” will diff “path/to/file” against “../dir2/path/to/file”, if the latter file exists. I do this to avoid the tedious repetition of comparing one code base to another (such as two branches, when merging them): “diff path/to/file1 ../dir2/path/to/file1“, “diff path/to/file2 ../dir2/path/to/file2“, etc.

Although this project is in its early stage, and the output is still rough (i.e., containing debugging output), it already has been quite useful, so I thought I would share.

The project is at Github here.

Life Organization: Recording

The eight categories can be great for organizing one’s life, and just as good for keeping a record and keeping one’s life in balance.

To review, the categories:

  • Physical
  • Professional
  • Social
  • Solitary (or Recreational, Hobbies)
  • Maintenance
  • Mental
  • Emotional
  • Financial

Keeping a daily record (journal, diary) can be an excellent feedback loop.

To do so, write out each of the categories and add to each section a description of the related activities for each. It can also be beneficial to simply record one’s overall self-assessment, as a number, thus quantifying the process.

The scale can be like that of the (US) school system, A, B, C, D, F, or a number from 1 to 3, or 1 to 5.

My preference is to use a modified 1 through 10 scale, where the lowest rating is actually a 6, meaning essentially no activity, and 10 is an absolutely perfect episode, perhaps when reaching a long-term goal. For some reason, it feels less “negative” to give something a rating of, say, 2, whereas 6 doesn’t seem so self-critical.

For example, a day of no exercise, bad diet, and poor sleep would be a 6 in the physical category. A day (night) of good sleep and a decent diet would be a 7 (or average). A moderate amount of exercise could bring that to an 8, and reaching a monthly goal (such as running a 10K) would be a 9. A life goal, such as running a marathon, would be a 10.

Similarly for the professional category: a complete day off, a 6. A moderate amount of work, a 7. A productive day: 8. Very productive day: 9. Starting one’s own company or being promoted: 10.

I actually have rated a category a 5 at times, for what is a counter-productive day, such as overeating with no positive physical efforts. But that is rare.

I prefer to write these in the morning, after my coffee and reading time, and before starting any other activities for the day. That is the time where I find that my mind is shifting from reflecting on the day before to gearing me up for the day ahead.

One of the best effects of this system is that knowing that the feedback loop exist can make a person “tip” from bad to good decisions. For example, if a day is winding down and the current level of their physical category is a 7, that person might decide to go for a walk or to forgo that second helping at dinner, in order to bring them up to an 8.

It comes down to the maxim: What gets measured gets managed.