Fun with unix: Fortune

The old ones are the best, so they say, and this is definitely the case with fortune. At the command line, type “fortune” and see what you get. Mine read

“Next Friday will not be your lucky day. As a matter of fact, you don’t
have a lucky day this year.”

This and other random nuggets of information, quotes or entire randomness will be output by this program. You can combine this with cowsay to great effect, for example:


fortune | cowsay

________________________________________ / Q: Why is Christmas just like a day at \ | the office? A: You do all of the work | | and the fat guy in the suit | \ gets all the credit. / ———————————————————— \ __ \ (oo)\_______ (__)\ )\/\ ||——w | || ||

Paste that line into your .bashrc or equivalent and ensure a little chuckle, or maybe complete bewilderment, every time you log in!

Posting with images in Joomla!

The other day I was helping someone post to a website that I set up using Joomla! , and thought that others might find this tutorial helpful.

Start with the “Media Manager” button on the front page. This is so you can add all the images. Directories can be added here to manage images – I found that adding images to subdirectories inside the “stories” folder made them available to add to articles.

To add the images, use the “choose” button next to the “file upload” box. Choose your image and then click on the “upload” picture above (not an obvious place for a button, I know!). Your picture will appear in the grid below. Upload all the images you like.

Now you can publish them to the site. Click on “home” in the top left and then “Add New Content”.

Start by unticking the “published” box on the right hand side of the screen, this means you can work on it as much as you like before it appears on the site, and it is safe to use the “Save” button at the top without it being visible online yet.

Not far to go now – just dropping those images into a story. Click on the images tab on the right hand half of the screen, and use the subfolders drop down box to find your folder. These will be listed in the “gallery” box. Add these images to the “Content Images” box by selecting them in the gallery box and clicking the arrows. The order in which the images are listed in the content images box is the order in which the images will appear on the page … either add them in order or just add them all and use the up/down buttons to get them straight.

Now give the article a name and put it into a section. Write what you want to in the “intro box”, and when you are ready to add the next picture, click on the “insert picture” tab. This is less confusing than it sounds, use the “preview” button at the top to keep track of what is actually happening.

When you are finished, choose the “Publishing tab” in the right half of the screen and tick the “published” and “front page” boxes. If you want to save it at any point, or it checking before it goes live, don’t tick these boxes. Either way, make sure you use the “Save” button at the top.

Hope that helps someone.

Fun with Unix: Cowsay

Another in the “Fun with Unix” series (see the one other post so far on mesg), today’s episode covers a little trick that goes alongside messages.

Here it is:

 _______
< hello >
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

The code to output the above is:

echo "hello" | cowsay

You can tell cowsay to use a different picture, how about this one:

echo “hello” | cowsay -f elephant _______ < hello > ———- \ /\ ___ /\ \ // \/ \/ \\ (( O O )) \\ / \ // \/ | | \/ | | | | | | | | | o | | | | | |m| |m|

Or even:

echo “hello” | cowsay -f daemon _______
< hello > ———- \ , , \ /( )` \ \ \___ / | /- _ `-/ ‘ (/\/ \ \ /\ / / | ` \ O O ) / | `-^—’`< ‘ (_.) _ ) / `.___/` / `——-’ /
<——. __ / __ \
<——|====O)))==) \) /====
<——’ `—’ `.__,’ \ | | \ / ______( (_ / \______ ,’ ,——-’ | \ `—{__________) \/

My files are in /usr/share/cowsay/cows so have a look what you have.

Of course you can use these in conjunction with write that I mentioned last time, by using something like:

echo "hello there" | cowsay -f hellokitty | write kevin

Enjoy :)

Damn Small Linux for a Damn Small Laptop

Tied up with the various issues we’ve had recently with houses, I’ve got a new project. Its to turn my (mother’s) very old laptop into a dumb terminal we can have in the basement in the new house. The kitchen is in the basement and I’m keen not to bring any more hardware into that environment that we need to, just because kitchens are full of liquids and grease.

I’ve got a Toshiba Satellite 210CS, complete with its original “Optimized for Windows 95” sticker. It celebrated its twelfth birthday this year so its not doing too badly! Its had a couple of upgrades from its original configuration – it has a 1GB hard drive, a PCMCIA wirless card that will talk to our 802.11b router, and a memory expansion to take it to 24MB of RAM. The processor is a Pentium 120Hz and judging by the fact that it thinks its June 2nd 2005, its CMOS battery is flat.

On Sunday night (its a bank holiday here so we’ve had Monday off as well) we installed Damn Small Linux (DSL) onto it and hoped for the best. The most impressive thing about this is always trying to boot anything new. This machine predates real PCMCIA standards and predates USB; it has a CD drive but can’t boot from it and often won’t read written CDs. It does have wired network on PCMCIA but can’t boot from that either. And it has a floppy drive … somewhere. So we managed to find the floppy drive, and another machine with a floppy drive in it (we were quite surprised to realise the server has one), and even unearthed a floppy disk in the house. Which is more impressive than it sounds as all our stuff is in storage!

DSL went on like a dream but wrongly guessed the size of the screen on the laptop so on the first attempt when I thought it had stopped and I pressed return a few times to shift everything up the screen a bit, I discovered I had answered “no” to the question “would you like a boot loader?”! So we did that again and now its working fine.

Even more impressively, the DSL installation is happily driving the PCMCIA wireless card, out-of-the-box. Last time we re-installed this machine (we think 3 or 4 years ago) we gave up with getting a binary distro working and Kevin compiled some special Gentoo for it. I was impressed how painless this was, so a big thanks to the DSL people, I must send them some fanmail. Or money, maybe.

The plan is just to use the command line to ssh up to the main in-the-house server and use that for checking mail. We can use lynx and command-line chat equivalents if we get desperate too :)

1 If you were hoping for an update, we’ve commissioned the searches but must complete by the end of May to avoid losing the mortgage. Watch this space.

Awards Night Excitement

Last night was the netball awards night, I took the present for my coach and prepared for a night out with the girls. What I wasn’t prepared for was actually winning something! I’m Shipley Netball Club’s “Most Promising Newcomer”, which is a fantastic honour and I’m very very excited to have won!

The award is a glass with a wooden stand … as I was out for a few drinks afterwards its in the care of Janet at the moment so I shall post photographs when I reclaim it!

Posted in Uncategorized | 1 Reply

Stopwatch Cosy

Its the end of the netball season and I’ve been trying to think of a gift for my coach who has been fantastic this season. With my usual comic timing, I decided yesterday that a new stopwatch with a countdown feature would be a good present for a sports coach.

Its not very personal, though, is it? So I’ve made it a cosy:

And since I’m an engineer, I’ve also photographed the alternative setup which allows the cosy to be stored buttoned onto the string while the stopwatch is in use.

Happy end-of-season, Lynda, thanks for everything!

Fun with Unix: Writing Messages

This is the first in a mini-series of articles about using Linux/Unix to do things other than view logs and edit files. I’m 26 and find that many of my peers weren’t exposed to Unix servers at university, so they miss out on this. If you have any suggestions of things to include in the mini series, let me know please!

Write messages

So to pop up a message on another user’s PC, you’d usually use MSN, right? Well if you’re both logged into the same server there is another way. Just echo your message and then send the program write to get it to the person. Like this:

echo “Hello Kevin” | write kevin

Kevin will get a message on his screen which says:


Message from lorna@server on pts/1 at 22:14 ...
Hello Kevin
EOF

Silence please

To turn off receiving messages, you need to change your mesg setting, by setting it to n:

mesg n

Not surprisingly, you can turn it back on with:

mesg y

That’s today’s installment, have fun!

Mouselessness

Not to be confused with houselessness which I have also been doing a lot of recently, today mouselessness is the name of the game. Inspired by this recent post on Coding Horror here are my thoughts on using a computer without a mouse.

RSI Risk

I posted a while back about last years brush with RSI and it really did seem to settle down for a while. I changed jobs and that also seemed to help for the first few weeks, then start to get worse again. I do concur that the mouse is the root of all hand-related evils at the desk, and use one as little as possible.

Working without the mouse

There are a lot of things you can do without a mouse. I use Opera as my main browser, it has keyboard navigation and I can surf for hours without touching the mouse at all.

There are lots of keyboard shortcuts for Windows (see Jon Galloway’s excellent mouseless computing article for ideas), which I started to get better with. These days however I’m using Linux at work and use a variety of quick shortcuts to help:

  • I use all four desktops, with Ctrl+1, Ctrl+2, Ctrl+3 and Ctrl+4 to get me to where I want to do. Its really good and fast – especially when I remember to press control with my right hand and the number with my left!
  • Opera, as mentioned above
  • Katapult, which is a KDE application which allows you to type Alt+Space and type the program you want to run, it even autocompletes
  • Vim. I do all my development over ssh and running vim. No dragging and dropping of files, no dragging to highlight to copy and paste, no icons to click on to format or open another file. Absolutely everything can be done without moving hands from keyboard and I have to say that spending the time with the cheat sheet and getting better with it was the best thing I’ve done since I taught myself to touch type in my teens. Not only does it save my hands, I’m also faster than my colleagues for most things. If you haven’t tried it for a few years and think is a basic text editor you might be stuck with on a server somewhere, then look again. GVim is available for most platforms with tabbed editing and its got code folding and autocompletion too.

Alternative input

At work I have a microsoft keyboard that I quite like but which has keys which go quite deep when you press them which isn’t ideal. I need to try changing hands with my mouse, but I also have a beautiful Kensington Pro trackball which is excellent. Its a bit strange with the main button in the bottom left below the ball but the ball is good and big and it is good. At home I rarely use a mouse and have a little external keyboard which has shallow button movement when it is pressed – which seems OK.

Mouseless computing

Its perfectly possible to do a lot of everyday actions without the use of a mouse. Getting up to speed with the shortcuts for the applications you use will take time – but I shall be taking the advice from the Coding Horror article and learning a new keyboard shortcut every day from now on. I am switching back to my trackball and will take time and effort to get my desk set up better – and I’ll let you know how I go. In the meantime, tell me whether you have had similar problems and what your favourite keyboard shortcut is. I think mine is Ctrl + G in Opera – to turn off stylesheets.

Offer Accepted (sound familiar??)

We’ve bought a house! If you think you may have read this before, perhaps you’d like to read one of the three previous offers posts.

In an interesting twist, we’ve had an offer accepted on the same house we had an offer accepted on last time, for an amount that takes into account the work that needs doing on it and that we can get a mortgage for. So at least its different!!

Watch this space for more disasters excitement :)

Three Things I Saw At Chester Zoo

We went to Chester Zoo on Easter weekend, which was great apart from the humongous traffic queues to get in. Still they seemed pretty well organised and since we chose to arrive mid-morning on a beautiful bank holiday weekend then it was always going to be busy!

The zoo itself has a great repuation for treatment of animals and its successful breeding programmes, and was a nice place to visit. There were lots of people with their kids as well and it seems a very child-friendly place (I don’t have kids, I have no idea).

Anyway, here are the three things I saw (one of them twice because I love them!)

Black and white ruffed lemurs!

One Jaguar (I shrank the photo before I realised he would get so small … look closely in the middle!)

And a sealion.

We had ice cream and it was a lovely day :)