return to OCLUG Web Site
A Django site.
October 14, 2009

Pythian
pythian
» Perl Module Dependencies: how to require the latest, and nothing less

Recently, hanekomu was contemplating how to make subsequent installs of a Task::BeLike module upgrade its dependencies to their latest version.

The idea is intriguing. It’s not something you want to do for a typical module, but it makes sense in the context of Task::BeLike. If you care enough about a module to put it in your Task::BeLike, you probably care enough to want to upgrade when there’s a new version out there.

Alas, I think hanekomu’s proposed way of doing it is flawed (mind you, the debate is still going on as of the writing of this entry, and I can very well still be proven wrong). But after some pondeferous chin scratching, I might have come with a cunning alternative to it.

Let’s say that in your Build.PL (the logic would be the same for a Makefile.PL) you have your dependencies stashed in %dependencies. Something akin to:

%dependencies = (
    XML::LibXML      => 0,          # any version will do
    XML::XPathScript => '1.42',     # 1.42 or higher
    Moose            => 'latest',   # nothing but the shiniest!
);

All we want to do, really, is to switch the latest for, well, the latest version available. Surprisingly, that something that is almost as easy to do than to say:

for my $mod ( keys %dependencies ) {
    next unless $dependencies{$mod} eq 'latest';

    require CPANPLUS::Backend;
    state $cb = CPANPLUS::Backend->new;

    $dependencies{$mod} = $cb->module_tree( $mod )->package_version;
}

Yes, that’s really all there is to it. A little further hacking later, I have incorporated the functionality to my own Task::BeLike::YANICK module. The way I implemented it, installing the module the usual way will yield no surprise (i.e., dependencies already present are not going to be updated). But if the environment variable TASK_UPGRADE is set to true, like so:

TASK_UPGRADE=1 cpan -f Task::BeLike::YANICK

 . . . then the magic is going to be unleashed (the -f is to force the re-install, if the Task has already been installed before).

Alternatively, just to know which dependencies are out-of-date, one can also extract the distribution and do a

perl ./Build.PL --upgrade
./Build prereq_report

May 5, 2009

Pythian
pythian
» First Impressions of Kubuntu 9.04

I said I would follow up. Who knew I actually would?

I love my new PC. It’s been a few years since I did a build for myself, so I took my time lovingly feeling every piece for the tactile joy of it, and completely ignoring any printed material that came with the parts. Well, I did read the bit about the front panel connectors, that one is kind of a must when it’s not printed on the board.

For the record it consists of an ASUS M3A78-EM with an AMD Athlon 64X2 7750 Black Box. I was on a budget so I could not go for the quad core as yet, so I made sure I got a mobo that would stand some upgrades when the price-point drops. Check out the ports on the mobo, it has everything. Check out the cache on the CPU (1MB L2, 2MB L3). I am sticking with the on-board video for now; I prefer NVidia to ATI, but for the moment it will do. It fit the price.

All of that has nothing to do with Kubuntu. Since I got the parts together late, I did not have as much time to play as I would have liked, but I do know that it boots very quickly. I will time it this weekend, but it was around 15 seconds from GRUB to KDM. I did some installs of apps that were not shipped with the default desktop, such as Firefox, mplayer, fglrx, and a few other choice bits I like (which I will mention by name in a follow-up). I was fairly impressed so far.

Now for the bad news. From the get-go KDE 4.2 let me down. When 4.0 arrived with Kubuntu 8.10, I tried it for a day or two, and was very unimpressed. This time I thought it must have had some improvements, it’s now two minor revisions beyond the dreaded .0 version. While it is slightly more stable, within minutes I had had my first crash on the panel. I had several more, not hardware-related. Now these could be the fault of the applet developers and not KDE itself, but it certainly soured my first look. I will probably nuke this install and reinstall with the KDE3 remix over the weekend.

One I got fglrx running, I just had to install Nexuiz. I did buy faster hardware and lots more RAM, how else was I to see it in action? I gotta say it ran smoothly. So what if I can’t hit anything or bunny-hop my way out of danger.

Till next time, keep your clock multiplier high and your temperature low.

April 24, 2009

Pythian
pythian
» End of School with Linux; Ubuntu 9.04 Released

Hi folks. I am back for the second in what will eventually be a long line of infrequent updates. Did you miss me?

End of School with Linux

OCLUG (The Ottawa Canada Linux Users Group) is putting on an event called—you guessed it—End of School with Linux. This is happening on April 28, 2009 starting at 11am at the University of Ottawa in the SITE building, room C0136. The purpose of the event is to help people with their Linux systems, install Linux, fix issues, and just generally help out in the community. Your humble blogger will be there, manning the booth from 1200-1600, so come on down. And tell a friend, too.

More details can be found at the CSSA’s page. Click here for a map of the campus.

Also check out the OCLUG home page.

Ubuntu 9.04 Released

Ubuntu 9.04 was released today. I have not yet looked at any reviews of the release candidates, but I am on my way out to pick up some new hardware on which to install it tonight.

If you were not on the sites downloading it early today you may have to wait, as most mirrors are very busy. If you have a newsgroup account then check out alt.binaries.cd.images—the ISO for 32-bit and 64-bit are there in both desktop and server flavours. For some reason, the Kubuntu and Edubuntu releases are not in the newsgroups, but you can always install the meta-packages after installing from the main ubuntu dist using apt-get install kubuntu.

Over the next few days I will be doing an install of the 64-bit version on my hefty(ish) new system, and a 32-bit install on my sorely-outdated laptop. I will post results.

Don’t forget to check out the Ubuntu web site.

One final thought

Did I mention I am going to get new hardware tonight? It’s been years! I am blogging and doing work, but all I hear in my head is “EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE”! It’s a wonderful kind of feeling.

Till next time.

July 23, 2008

Pythian
pythian
» MS Windows Vista Tips for Administrators

I found myself, as a fresh member of The Pythian Group, losing precious moments just to change a few standard administrative settings on my new laptop with Microsoft Windows Vista. Having found the answers, I’m sharing them with you so that you can save some time, or spend it more pleasurably out in the summer.

User Account Control (UAC)

Too many prompts and confirmations for admin tasks? Set “Elevate without prompting” for “User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode” under Start -> Settings -> Control Panel -> Administrative Tools -> Local Security Policy -> Security Settings -> Local Policies -> Security Options. Ref: UAC on Wikipedia.

Windows Vista Features

By default, telnet is not installed with Windows Vista. To (re-)enable it, select the Telnet Client check box in Start -> Settings -> Control Panel -> Programs and Features -> “Turn Windows features on or off”. Then, Windows Features dialog -> Telnet Client. Now you may use telnet from the command prompt as you are used to in XP. Ref: FAQ on windowshelp.microsoft.com

Performance

Adjust for best performance (this applies to XP too). Select the radio button next to “Adjust for best performance” in Start -> Settings -> Control Panel -> Performance Information and Tools -> Advanced Tools -> Adjust the appearance and performance of Windows -> Visual Effects.

Mounting: Do not mount a local share on the same system

I’m used to creating a secondary disk partition to store all user data, but this time I forgot to do that before I filled up almost whole disk. As a workaround, I created a new folder named DATA, shared it locally, and mounted it as network drive.

At first, I was quite happy as it would save me time on data movements when a space issue occurred on one of the partitions. Later, though, I started to observe strange behaviour — freezing of the whole system, while working with data on the mounted drive (especially while doing parallel actions like file copying, installations, etc.). A few days later I gave up debugging frozen processes, and unmounted and removed the share; everything works fine now. Have you experienced anything similar?

If you know these already, I apologize, and add that if know more Vista tips, please put them in the comments below. But definitely stay tuned, more tips coming!

Have a nice one, Jan Polnicky.

June 2, 2008

Pythian
pythian
» Emacs Keybindings in Bash

Or, How to Be a Command-Line Commando

Does it surprise you to learn that I’m a Linux guy? I’ve been using Linux, to the exclusion more-or-less of everything else, since about 1999. In the past, I’ve done a little programming and some junior system administration. I’m even LPI-certified.

With this background, I’m quite comfortable working in the shell (AKA the command-line), the natural habitat of the sysadmin[1]. I frequently open a shell to do some quick work, and when I do, I use GNU’s Bash, which is the default on most Linux distributions. (I believe it’s also the default shell in Mac OS X.)

One of Bash’s features is editable command-line history, which makes your current command-line and its entire history available to you as an editable buffer. That offers a great way to streamline your work in the shell.

I suspect, however, that many shell users don’t even know about this better way. And it baffles me that many SAs I have seen in action — including some of Pythian’s own — don’t use this. They almost seem to prefer unnecessary effort — smashing away at their keyboards, repeating themselves, deleting with the Backspace key, scrolling, forwarding their cursor one character at a time, copying and pasting with the mouse, and so on. That’s a lot of elbow grease.

With Bash, or any other shell that uses the GNU readline library, you can use the following Emacs-like key-chords to make your life better. The point of this (as with so many things sysadmins and programmers do) is to save you effort, viz. typing. These aren’t all of them; they’re the ones I use:

Keys Effect
CTRL-P go to the Previous command in your history
CTRL-N go to the Next command in your history
CTRL-R Reverse-search through your history
CTRL-S Search forward through your history
CTRL-A Move the cursor to the beginning of the line
CTRL-E Move the cursor to the end of the line
CTRL-W delete a Word backwards
ALT-D delete a word forwards
CTRL-F move the cursor Forward 1 character
CTRL-B move the cursor Backward 1 character
ALT-F move the cursor Forward 1 word
ALT-B move the cursor Backward 1 word
ALT-_ undo

It takes a little learning to get these under your fingers, but it’s worth it. Too often, easy-to-use GUIs get us started quickly, and then leave us handicapped in our work. Spending the time to learn how to use capable tools pays off.

If you don’t want the default Emacsisms, there’s a vi-mode too — try set -o vi. I am a vi guy (in addition to a Linux guy), so I don’t mind modal editing, except that in the shell, there’s no way to tell which mode I’m in at any moment. Some commando out there might have put together a fancy custom PS1 prompt that shows vi-modes, but I really haven’t gone searching.

If you’d like a more thorough read about this, try the Bash Emacs Editing Mode (readline) Cheat Sheet or “man readline”.

1. As it happens, knowing how to use Unix text tools such as grep, sed, and wc (to name just three) is very helpful to a writer, too.