10 posts tagged “catalyst”
Since the last release of SSHMenu went so smoothly, I thought I might as well do another...
SSHMenu is somewhat of an enigma - it's a GUI tool for people who work at the command-line. In theory it shouldn't appeal to the point-and-click crowd (since they don't use command-lines) and it also shouldn't appeal to the command-line crowd (since they don't use GUIs). Of course the world is not black and white and most people choose the combination of tools that work best for them.
I lean strongly towards the command-line myself and yet I developed SSHMenu because I wanted a GUI solution to a particular problem. I wanted to be able to easily initiate a new SSH connection in a new terminal window. I wanted the ability to define the position and size of the new window and to use colours to indicate the class of machine the window was connected to (eg: production vs test vs development). The solution that worked for me was to implement an applet that provides a menu of frequently used connections.
It turns out that there are some people who also want to be able to set up profiles for frequently used connections, but they don't want to use a menu. When they're typing at a command prompt and want a new SSH window, they don't want to reach for the mouse - they'd prefer to type a command. Release 3.18 of SSHMenu adds a feature to support this group of users. Now they can use SSHMenu's GUI dialog for the infrequent task of defining a new connection, but for the frequent task of initiating a connection they can use the command-line.
Here's an example. Say you have a server called 'fitzy' that hosts your web development environment. Perhaps you frequently connect to this host to run 'tail' against the Apache error log. Since the lines of output tend to be quite long you prefer to use a small font and a wide window positioned across the the bottom of your screen. You can set that all up using SSHMenu's 'Host' dialog:
And now you can initiate the connection in a new window with this command:
sshmenu-gnome fitzy
Of course 'sshmenu-gnome' is rather a long and unweildy command to type frequently so it's likely that you'd alias it to something shorter like 'connect' or 'sshm'. The SSHMenu distribution includes a bash completion function called _sshmenu which allows you to do tab completion of host definition titles from the command line. If you set up an alias for the main command, you'll want to associate the completion function with your alias as well:
alias sshm=sshmenu-gnome
complete -F _sshmenu sshm
So there you go. If you like to use multiple terminal windows it might be a useful addition to your toolbox.
I finally got around to pushing out a new release of SSHMenu. It includes some bug fixes, minor tweaks and one particularly cool new feature. As I'm sure you'll recall SSHMenu is a very simple GNOME panel applet that provides a menu of hosts for you to connect to via SSH. Point ... click ... shell window appears:
The disadvantage of course, is that you have to define at least some of those things - you can't use SSHMenu to connect to a host unless you've defined a connection. Following a suggestion from Chris Siebenmann, release 3.17 has changed that. Now the applet includes a handy little text entry box. Type a hostname in the box, hit Enter and you're connected. Even better, the text box does auto-completion so if you've connected to a host before then you can type in the first few letters and select the host from the list:
- hostnames you've typed in the box previously
- hosts that are already defined in your menu
- an option to take the hostname you've just typed and add it to your menu
Now for the bad news ...
You can't actually use this cool new feature yet. Earlier this year Detlef Reichl did some work on the Ruby-GTK bindings to add some features to the panelapplet library that he needed for his teatime applet. His patches were accepted and released in version 0.19 of the bindings. Two of those patches are required to run the new features in SSHMenu. Version 0.19 of the bindings has made it into Debian 'unstable' and hopefully will be in the next Ubuntu release. Until then, if you want this feature then you're going to have to build the libraries yourself.
And finally ... while I was developing this new feature I took the opportunity to move the source code from Subversion to Git. What a blessed relief!
Just in case there's a programmer left on the planet who hasn't seen this link:
James Iry's ‘A Brief, Incomplete, and Mostly Wrong History of Programming Languages’
Yes, it's geek humour but it's very funny geek humour!
This link has been doing the rounds. Apparently it's hilarious. I like to think I have a sense of humour, but I just don't get the joke.
My best guess is that it's 'funny' because the text doesn't fit in the box. There are two fairly obvious possibilities: either the box isn't big enough or the text font size is too big. Either one would be trivial to fix with a line of CSS. In fact you could easily do it in such a way that if the user chose to increase their browser font size the box width would increase too. An alternative possibility is that the wrong text is in the box. The box might have been designed to contain a certain type of data and the text that's ended up there is not what the box was designed to cope with. Maybe in this case the best thing to do is to simply hide the 'overflow' since it shouldn't be there anyway. Once again, you can achieve that easily with one line of CSS.
Still guessing here, it's probably also 'funny' because this would never happen if you laid out your page with tables instead of CSS. I'm not sure if that's actually true but if you did specify a width on your table and then you put data in it that was too big then most browsers would ignore your width setting and increase the table size. Is that the right thing for the browser to do? Probably not. It certainly has the potential to screw up the rest of your page layout and relying on the browser to do something other than the specific thing you asked it to do would seem a risky proposition at best.
The whole tables vs CSS 'dichotomy' is nonsense anyway. They are not mutually exclusive and they each have their strengths (I certainly don't want to try and lay out tabular data using only CSS). At least with CSS you have this option:
"In practice, the conversations that are most widely heard in the tech community are full of inaccuracies, manufactured drama, ignorance, and unbridled opinion."
It's a good read and Alex has some great ideas about what you can do to improve the state of technical discussions in today's social media forums.
Wellington Perl Mongers had a fun evening last week - our annual Lightning Talk meeting. As usual the talk schedule was looking pretty thin in the days leading up to the event but with a bit of encouragement people did step up and the evening went well. The talks covered a range of Perl modules; a bit on Erlang and CouchDB (thanks Lenz); mountain biking and mapping (Donovan); and Perl on the iPhone (Tobi). We even got to see the beginnings of Matt's robot army (doesn't look like we have anything to fear yet) and Srdjan gave us his sermon entitled "If statements considered harmful". I asked Matt to take some photos. The lighting wasn't great so not many came out but here's a montage:
As a group, it's clear that there's one key thing we can all do to improve our delivery - turn and face the audience. The one exception pictured is the guy speaking without slides.
As Brenda pointed out, the coverage by TV3 of the S92A protest at parliament this week was terrible and totally missed the point. I would like to comment on their site but the signup system seems to be broken and I can't log in. So instead I shall ineffectually shake my fist at them from a distance via my blog ...
As one of the people involved in the protest at parliament I would like to clarify that MY objection to this law has nothing whatsoever to do with downloading music or movies on the internet.
If someone accused me of stealing a car then the police would investigate the facts, a judicial process would be followed in which my guilt would need to be proven to the satisfaction of a judge and jury, and I would have the right to a defence and if necessary an appeal.
With this new law, if someone accuses me of downloading copyrighted material without appropriate permission then the police are not involved, there is no judicial process, I am assumed to be guilty unless I can prove myself innocent and the punishment will be handed down by my ISP.
I know of no other law on the NZ statutes which presumes a person guilty unless they can prove their innocence and which bypasses judicial hearings and appeals processes in favour of having punishments dished out by a commercial entity.
This is bad law which sets dangerous precendents. THAT is what I was protesting against.
This Tuesday evening (Feb 10th) Wellington Perl Mongers are very pleased to welcome Jacinta Richardson and Paul Fenwick from Perl Training Australia. They're over here on vacation (as well as for Baa Camp) and have kindly offered to come along and speak at our February meeting.
Jacinta and Paul are active members of Melbourne Perl Mongers; were instrumental in getting the ODSC (Open Source Developers Conference) off the ground in Australia and have spoken at other conferences including SAGE-AU, Linux.conf.au and OSCON.
So what are they going to be talking about? Well it might surprise you to hear it's not about Perl. Jacinta is going to tell us how to give a good talk. And Paul is going to tell us about the 'Illustrated History of Failure'.
So rock on up to Catalyst for a 6:00pm start and lets make these Aussies feel welcome.
A colleague encountered an odd problem with some Perl code the other day. It took us a while to realise what was going on, you'll probably work it out much quicker ...
Here's a simplified version of what we were dealing with:
use strict;
use warnings;
eval {
my $obj = SomeClass->new();
die "Code Red!\n";
};
if($@) {
print "Exception caught: $@\n";
}
else {
print "No exception occurred\n"
}
We both expected it to output:
Exception caught: Code Red!
but instead we got:
No exception occurred
You probably worked it out straightaway but for the record, here's what was happening ...
The die statement did generate an exception and the message was stored in $@. Of course the code in the eval block stopped executing immediately but when control flow exited the block, any lexcial variables declared in the block went out of scope. In this case there was only one: $obj. What we didn't realise is that $obj's class defined a destructor method ('DESTROY'). This method is called when the object goes out of scope and apparently in our case the method
wrapped something in an eval. Whatever that something was, it completed without generating an exception, so $@ ended up empty - indicating no error and overwriting the exception message that our code put there..
So, if you write a destructor method and it needs to use eval, please remember to use local($@) to restore the previous value of $@ when your routine completes.
I pushed out a new release of SSHMenu the other night. Given that it's been over a year since the last release you might wonder what monumental new feature prompted the release - and that would be a sad story.
The truth is that I fell off the "Release often" wagon. There have been a number of very minor changes. The most important is a patch to disable drag-n-drop for reordering menu items (because it's buggy and can cause a busy loop). The reason I hadn't rolled up a release and pushed it out was simply because it was 'hard'. Not really hard of course, just not trivially easy. I couldn't just push a button and have the release go out. Rolling up a tarball was automated with a makefile but creating the .debs and adding them to the APT repository involved manual steps. As did the updates to the RDoc documentation files. To make matters worse, some of the files involved in publishing the .debs were not in source control and consequently were lost when my hard disk died last year. So even though there were changes I could have published, I hadn't bothered because of the effort required.
So what finally prompted me into action was an unfortunate accident.
Earlier in the month, Nicolas Roman sent me an article he'd written for the SSHMenu web site. He's been using Terminator rather than GNOME-Terminal and had hacked SSHMenu to support the Terminator command line arguments. So I added his article into the source control for the web site and ran the publish script - at which point everything went horribly wrong.
SourceForge made a few changes to their project web hosting and shell access last year. So my first attempt to publish did nothing. Once I'd sorted out the new username and directory path requirements I ran the script again. It mostly worked, but because it used rsync and because the APT repository files and generated RDoc files were not in source control and not present in my local tree (due to the disk crash) the rsync deleted those files off the server. Oops.
I didn't have a copy of the original .deb files. I could have regenerated them but if I was going to that trouble I decided I might as well roll up a new release. So I worked out what steps I previously performed manually, added them to scripts in the project source control and pushed out a new copy of everything.
So every cloud has a silver lining. Accidentally deleting the public repository file prompted me to fix up my processes for making a new release. And the moral of the story: if you can automate something you probably should. It'll mean you don't have to remember the manual steps and will also make it easier to delegate that task to someone else if required.