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.

Advertisements

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.

zsh Event Tricks

I’ve been a Z shell (zsh) user for perhaps 15 years, being a tcsh user before that.

Unfortunately, it appears that there is no zsh book from my preferred technical books publishers, O’Reilly, Pragmatic Programmers or Manning. Thus my knowledge is from the zshall man page (all 15,000+ lines, when you can find it) and from experience.

I’d like to share a few examples of what one can do with this shell, and I’m going to go from most to least recent in what I’ve found and used.

The latest thing that I learned is how to get previous arguments. I’d known about “!!” to get the previous full command line, so if I needed the second argument, I’d do “!!<tab>”, then backspace (or search back, i.e., “<ctrl>r”) to the end of the argument, delete (“<ctrl>k”) to the end of the line, then move to the beginning of the argument “<alt>b”, then delete word-by-word “<alt><backspace>” through all the other arguments that “!!<tab>” expanded to.

What a mess, although doing that a few hundred times made it easy, although far from efficient.

So when perusing the 15,000 zshall man page (one day I’ll make that my summer reading) I saw that one can write “!!:2” to get the second argument of the previous line. Hurrah. Note that, of course, arguments are zero-indexed.

And the leading “!!” can be of the form “!-3”, meaning “the third most recent”, and “!-1” is the same as “!!”.

I haven’t used this much, but the word designators (the argument after the “:”) can be a range, so for the second through fourth argument of the command before last, the command would be “!-2:2-4”. If there is no starting number for the range, e.g., “!!:-2”, then that is the same as 0 through N, the first N+1 arguments from the earlier command.

In action, this looks like:

designators

Another form of syntax, as seen in the example above, is !N, where N is the number of the command line to reference. In the example, 3066 is the command line in history, so !3066:3 refers to the fourth word in that command.

In a subsequent post, I’ll discuss the prompt that you just saw, and why having the command-line number is useful.

Efficient Way to Improve Console Productivity

One of the principles of efficiency when programming is to avoid unnecessary repetition (DRY), be it in code, or in physical and mental tasks. My goal is to write at least one tweak per day to my environment, whether a macro in my editor (Emacs), or a shell script or alias in my console environment, which is Z shell. (Note that this applies to other shells also.)

Reading Matthew Might’s article on console hacks inspired me to use that to quickly and easily find candidates for aliases and functions in Z shell.

The following command sorts the history by frequency of use:

% history -1000000 | cut -c8- | sort | uniq -c | sort -n | tail -15

The output from my recent work with DoctorJ is:

     11 cd ~ijdkproj
     12 gitpullall
     12 myprod.rb
     12 rake
     13 ..
     14 gitdfs
     15 c
     15 la
     20 sd
     24 scrub
     27 git status
     28 git push -u origin master
     37 git diff
     39 ls
     51 gct
     52 gitdelta.rb

(If you’re wondering what the “..” command is, that’s an alias for “cd ..”.)

In the frequency list the salient command in terms of length is “git push -u origin master”, executed 28 times. So we can consider an alias for it, such as “gpom”, and see whether it already exists as a function, alias, or program:

% which gpom
gpom not found

Since it doesn’t already exist, we can add it to the list of aliases (mine are in ~/System/Zsh/aliases.zsh):

alias gpom=’git push -u origin master’

On Github I’ve posted my Z shell configuration, with the updated aliases file here.

… and Back to Gnome from KDE

I recently switched from Gnome to KDE, after a couple of Gnome quirks proved to be quite irritating. However, KDE became even more bothersome. Specifically the performance was dreadful. This is a new(ish) machine, just a few months old, with a six-core processor, 8 GB of memory, and an SSD, so I expect good if not extraordinary performance. However, under KDE the response within windows was very sluggish, on the order of a second or two to scroll down in applications.

Fonts were also a problem, where the fonts under KDE, for both KDE and Gnome applications, lacking smoothness. Despite much fiddling of font preferences, I could not get them to look as good as they do under Gnome.

Switching back to Gnome hasn’t resolved its irritations, although it’s put them in context. The main problem is that to get the title and task bars working properly (showing the currently focused application) I have to restart the window manager after login, and after launching Gnome Terminal I have to switch in and out of each tab so that the focus of the cursor is correct.

Emacs and Copying in X

One of the most annoying things I’ve found with GNU Emacs and other programs in X is that copying/cutting doesn’t work with the X clipboard, by default.

The fix is to rebind the cut and copy shortcuts to the equivalent X clipboard functions:


(global-set-key "\M-w" 'clipboard-kill-ring-save)
(global-set-key "\C-w" 'clipboard-kill-region)

New Machine

My faithful primary home machine, castor, after 4.5 years, was showing its age, and was especially sluggish with Eclipse, which with I’d begun dabbling in Android work. (Past tense, since I’ve put Android on hold while working on a different project, DiffJ).

So it was off to newegg for the parts for a new machine. The main criteria were speed (CPU and disk), and cost, preferably under $1000, and ideally under $900. (OK, actually ideally would be $0, but that’s quibbling.)

Without much elaboration, here’s the final setup:

Case – Antec 300 Illusion

This is for my newly-claimed, newly-painted, newly-furnished (thank you, Ikea!), and newly-decorated home office, where “home office” no longer means “table in the kitchen, and desk in the bedroom”. Since I have the tendency to start working early in the morning, I wanted a machine with lights. (The missus was no fan of the blue nocturnal illumination in the bedroom, so the lights of my Sonata case had been taped over.)

The Illusion does provide no shortage of illumination, with three bright lights, good for my wee-hour stumbling into the (home) office. And at $70, it was quite affordable.

Motherboard – ASUS M4A89GTD PRO/USB3

I’ve gone with Gigabyte and ASUS exclusively, and the Gigabyte motherboards supporting 6.0Gb/s SATA were not favorably reviewed on newegg, so this time it was ASUS’s fortunate turn. I also wanted onboard video, DVI specifically, since after getting a work machine with DVI, I’ve noticed the difference. ASUS motherboards are easy to work with, so this was an easy choice (after an hour or two of reading reviews). $150 at newegg.

CPU – AMD Phenom II X6 1075T

I generally prefer AMD for cost to performance, and this was very highly rated at cpubenchmark.net. At $175, it was right at the point of what I wanted to spend.

PSU – OCZ ModXStream Pro 600W

I’m not a gamer, and don’t have 6 SLI cards in my machines, but I wanted something above 500 watts. I’ve had a couple of failures of Antec CPUs, which I’ve exclusively used before, so I was looking for a modestly-priced alternative, and this was $75.

Memory – Kingston 8GB (2 x 4GB) DDR3 1333

To me, memory is memory, and the other web sites (Crucial, Corsair) were klunkier, so at $85, Kingston was king.

SSD – OCZ Vertex 2 60G

After working with an SSD, I’ll never use anything else for development. (Well, not until the next better alternative comes along.) At $105, this was pricey, but less so than the others. And it was from the same manufacturer as the PSU, appealing to my OCDness.

HDD – Western Digital Caviar Black WD1002FAEX 1TB 7200 RPM SATA 6.0Gb/s

$85 for one terabyte, and I use only WD drives, so this was an easy choice.

DVD – ASUS DRW-24B1ST/BLK/B/AS Black SATA 24X DVD Burner

Mostly a ???, but same manufacturer as the motherboard. $25.

Network adapter – TP-LINK TL-WN851N PCI Wireless Adapter

I’ve had good luck with TP-Link and Linux. $27.

Keyboard – Microsoft Natural Ergonomic Keyboard 4000

The only Microsoft anything in this system, but I find their keyboards so much better than Logitech, and at $42, the 4000 is my favorite. Actually, I wanted the 7000 (wireless), but newegg wasn’t keeping them in stock. Maybe some day.

Mouse – Logitech M510 Black 5 Buttons Tilt Wheel USB RF Wireless Laser Mouse

Again, I’m not a gamer, but like the right-handed, full-sized mice the most, and opted for Logitech, at $40. I like my other mice, all Microsoft, but it’s becoming more difficult to find a non-“mobile” (read: small) mouse, and my big mitts don’t work well with those.

Assembly was straightforward, other than my being a bit befuddled by the EATX auxiliary power cord (8 prong, not 4), which resulted in black-screen at first boot. After some head-scratching (and reseating some dislodged memory), all was well.

Linux Mint is what I’ve been using for the past three or four machines, because It Just Works. No RPM fuddling, enabling restricted repositories, etc. Just boot, install, and off we go.

The trickiest part was how to mount and partition the SSD and HDD. Here’s mine, where the SSD is sda, and the HDD is sdb:

    /dev/sda1 on /boot type ext4
    /dev/sda5 on / type ext4
    /dev/sdb1 on /home type ext4
    /dev/sdb6 on /var type ext4
    /dev/sdb5 on /tmp type ext4
    /dev/sdb8 on /srv type ext4

That way the OS is on the SSD, as is /tmp. I do my development under /proc (it was /Files and /Depot, but I’m fighting the FHS less now).

The machine smokes, but only in the figurative sense. Far faster than before, and on par with my Intel X8 box.

Migrating from Fedora 5 to Linux Mint 10

My four-year-old system, castor, was in dire need of upgrading, so based on the pleasant experience of installing Linux Mint on my latest laptop, I decided to switch from Fedora to Mint.

I’ve been a long-time Fedora user (and before that, Red Hat, going back to version 4, as I recall). It has always felt very “solid” yet incomplete. By that I mean that after installing Fedora, I’ve had to go install all the various media packages, adding livna and rpmfusion (?) to the RPM configuration, finding the plugins, MP3 support, and whatnot.

I’ve wanted an out-of-the-box (“It Just Works”) distribution for a while, and Mint seemed to have it: all the media packages, plugins, proprietary drivers, etc. So that’s what I installed on my laptop back in January, with Mint 8, and I was willing to do it again, with the latest version, Mint 10.

Overall, Mint 10 looks much better than 9. Granted, that may be because this installation was on a 24″ monitor running at 1920×1200 resolution, but even the themes look better. My primary complaint with Mint is the usage of so much light green — probably my least favorite color — but that has been toned down for a background of metallic grey — my favorite color.

The out-of-the-box experience was great. There was some dorking around with setting up the disk partitions, since I prefer hardware- and software-independent disks, meaning that I can take (and have taken) a drive from a fail(ing) box, pop it into a good one, mount it, and pull all the files off, without the added stress of having to configure it via software. A failed RAID controller years ago set me on the path of resisting the easy of using LVM, and going the more difficult route.

One aspect of the older versions of Fedora was that I could choose the option to install every available package during installation, and never need to track down packages in the middle of working on a project that called for additional software. Of course, that resulted in many packages I didn’t need, cluttering up the menus, but I figured it was worth the long-term benefit. It also avoided the pre-yum hassle of RPM hell.

But that changed around Fedora 9, as I recall, where only a minimal set of packages were installed. So that was another strike against Fedora.

If you haven’t figured it out by now, yes, I have no lack of laziness (nor impatience nor hubris). I want to boot the machine with the installation DVD, click a couple of boxes, hit “next” a few times, walk away, and sit down an hour later at a machine ready to work and/or play (both the machine, and I).

Mint solves much of that issue. However, there is the need to find the correct packages, but the synaptic package manager is so easy to use that it’s essentially trivial.

So, some minor issues here, which others may encounter:

mplayer

Running videos with mplayer -fs resulted in many errors such as:

X11 error: BadAlloc (insufficient resources for operation)

But this works properly: mplayer -fs -vo x11 -zoom

XEmacs

Listing directories with many entries became very time-consuming, a problem with dired.el. Additionally there was cruft at the end of the listing, evidently output from the change in how dired uses ls. So I added this to my .xemacs/init.el file:


(add-hook 'dired-load-hook
  (lambda ()
    (set-variable 'dired-use-ls-dired
      (and (string-match "gnu" system-configuration)
           ;; Only supported for XEmacs >= 21.5 and GNU Emacs >= 21.4 (I think)
           (if (featurep 'xemacs)
               (and
		(fboundp 'emacs-version>=)
		(emacs-version>= 21 5))
             (and (boundp 'emacs-major-version)
                  (boundp 'emacs-minor-version)
                  (or (> emacs-major-version 21)
                      (and (= emacs-major-version 21)
                           (>= emacs-minor-version 4)))))))))

Eclipse

One of the main reasons for my upgrade was to do Android development. However, after installing Eclipse and the Android Development Toolkit, there were errors when creating a new Android project:

…/platform-tools/adb: No such file or directory

Fortunately (for me) a friend had run into the same problem a few days ago, and this showed the fix to get the i386 compatibility libraries:

apt-get install ia32-libs

Rails

In short: Rails 3.0.3 (the current version) does not seem to run Rails apps written in 2.3, as is my site. So I downgraded by installing the 2.3.5 version of the Rails gem, and it works properly.

knock patch

Yesterday I had to get the knock program, for access to a more-secured external machine. The RPM was retrieved from here, a source RPM. I installed the RPM, then untarred it from ~/rpmbuild/SOURCES/knock-0.5.tar.gz. The next step was to run the usual “./configure”, “make”, “sudo make install”, but there were problems compiling, the first ones necessitating the installation of the libpcap-devel RPM. The second compilation error:

~/Programs/knock-0.5% make
gcc -g -O2 -g -Wall -pedantic -fno-exceptions -D_GNU_SOURCE -I. -o src/knockd.o -c src/knockd.c
src/knockd.c:134: error: ‘PATH_MAX’ undeclared here (not in a function)
src/knockd.c: In function ‘parseconfig’:
src/knockd.c:438: warning: unused variable ‘line’
src/knockd.c: In function ‘get_next_one_time_sequence’:
src/knockd.c:695: warning: unused variable ‘line’
src/knockd.c: In function ‘sniff’:
src/knockd.c:1386: warning: unused variable ‘parsed_stop_cmd’
src/knockd.c:1385: warning: unused variable ‘parsed_start_cmd’
make: *** [src/knockd.o] Error 1

required a change to src/list.h, to add the line: #include <limits.h>. Here is the patch file:

diff -ur knock-0.5/src/list.h knock-0.5-fixed/src/list.h
--- knock-0.5/src/list.h 2005-06-27 00:32:49.000000000 -0400
+++ knock-0.5-fixed/src/list.h 2010-06-24 12:52:50.644596951 -0400
@@ -21,6 +21,8 @@
#ifndef _PAC_LIST_H
#define _PAC_LIST_H

+#include <limits.h>
+
#define FREELIST(p) { list_free(p); p = NULL; }

/* your average linked list */