This post will (hopefully) remind me in the future how to do something very simple.

A crontab is normally running one command on each line. EG:

# m h dom mon dow command
01 00 * * * /home/cronscripts/vine-warn-when-large-user-profile
05 00 * * * /home/cronscripts/vine-get-remote-pc-backup.sh
01 01 * * * /home/cronscripts/vine-samba-users
01 02 * * * /home/cronscripts/vine-database-backups

So the above jobs run at 00:01, then 00:05, then 01:01am then 02:01am.

Instead, I can run these cron tasks one after the other by putting && between each task. EG:

# m h dom mon dow command
01 00 * * * /home/cronscripts/vine-warn-when-large-user-profile && /home/cronscripts/vine-get-remote-pc-backup.sh && /home/cronscripts/vine-samba-users && /home/cronscripts/vine-database-backups

So these jobs start running at 00:01am. When vine-warn-when-large-user-profile finishes, vine-get-remote-pc-backup.sh starts immediately, and so on.

Why is this useful?

I have several backup scripts for our linux servers. Each script creates a tar archive of a directory, compresses it, SFTP's it off site, then deletes the tar archive from the server.

If the scrips all run at the same time, the server runs out of disk space. I need them to run one after the other. I can't effectively guess when to start each one. The backup can't start until after midnight and must be finished by 7am when users are likely to start work again. Some directories can take minutes to archive, compress, send, delete. Others can take 2 or 3 hours. One server also collects backups from a couple of other places, so that script has to complete before others start too.

Running this scripts concurrently means no useful transfer time is lost and I don't have to guess the time each script will take to run.

In the hope I find this post next time I'm trying to monitor a SmartArray drive controller, A fresh install of Ubuntu 10.04, installing package cciss-vol-status didn't seem to work. I couldn't even find the file on the system using 'locate'.

For some reason, it installed as cciss_vol_status (using underscores instead of hyphens).

Bad Bot go away!

| | Comments (0)

Sigh. Here I am at work on Tuesday morning. List of jobs to do being interrupted by our web server triggering over load alarms. Actually, it's been doing it for quite a while, but I've never sat down to analyse the logs to find what's happening to trigger the alarm (our gandi.net virtual server is more than powerful enough to cope, so fault finding has been low on my to do list). This morning as I walked to work I saw an overload message arrive in my email. The sun is up, the sky is blue, it's 8am. It feels a good day to fault find...

It didn't take long to find the problem. I used grep to pull out todays log entries from the apache log and put them into a temporary file


me@server4:/path_to_logs/rkbb.co.uk$ grep '06/Apr/2010' apache-log > check.txt

The bot causing the problem has a user agent of "Mozilla/5.0 (compatible; Purebot/1.1; +http://www.puritysearch.net/)", going to puritysearch.net I find a 'search engine' that doesn't appear to do anything but display adverts disguised as search results.


So, how to stop this bot. Nice bots read a file called robots.txt which tells them where they're allowed to go. Purebot didn't read the robots.txt so I couldn't excluded it there.

My next thought was to use apache to exclude the user agent. After an hour or so of trying I gave up with that (it is possible, I just didn't figure it out and took the easy for me approach). The site is running Coldfusion (actually BlueDragon) so in the Application.cfm I can check the user agent and stop processing requests from Purebot there.

<cfset useragenttest = find("Purebot",#cgi.http_user_agent#)>

<cfif useragenttest GT 0 >
  <p>Purebot banned</p>
  <cfabort>
</cfif>

The code isn't my most elegant but it works. Next time I come across a badbot (or Purebot changes it's name) I'll just updated this piece of code to ignore their requests.

speechrecognitionmicrophone.pngI've been looking at buying dragon naturally speaking from an IT supplier for typing on to the computer. It is software I heard of many years ago that converts speech into type as you speak. I had an mail offering it for only £30.00 which is less than I remember. However I like to test things before I buy them especially when it comes to software. I searched the Internet but couldn't find a trial version to download. Just as I was about to give up I discovered a webpage that mentioned windows built in speech recognition.

So I'm sitting at home to blog for the first time ever without typing a word. I've been through the tutorial and so far I'm finding it very accurate. In the first paragraph I Can Count Three mistakes, I'm sure that as I continue to use it accuracy will improve over time.

It isn't quite plain sailing, I'm having a little trouble remembering all the commands but that's no different to when I first learned to use a computer. (quick note, I was brought up with a local dialect where I use the word learnt, but the computer heard learned. I'm sure there's a blog Post about observations of my local dialect somewhere here). One thing I am glad of is that my headset microphone has a microphone mute button. The software does it by saying stop listening to stop listening, but sometimes while I've been thinking of what to say and start speaking it thinks it misheard my silence as a word and asks me to repeat.

As a beginner with speech recognition the other problem I've been having is getting the cursor mixed up with an action. For example, a moment ago I managed to select a whole section of text inadvertently and then change the format by telling the computer to use a button on the webpage.

I think I'm a long way off using this is a regular way of inputting text. I just tested my typing speed on the website and got a result of 72 words per minute. I think my current speaking speed is actually slower than 72 words per minute as I'm waiting for the computer to display each sentence as I've spoken. Those of my friends who have seen one of my presentations may know that one of my biggest floors (and there are many I know) is speaking too fast. Maybe I should record all of my presentation through speech recognition as a way of slowing myself down!

Now to see if I can publish this blog post without touching the keyboard ...

Memories of Nan Root

| | Comments (0)

Taking Nicola to swimming club tonight we were talking about memories of her Nan and that reminded me of my Nan. Two things immediately sprung to mind, the first was going to Nan's for lunch.

She'd always lay on a huge spread of food, filling a table that to a 6 year old as as big as I was (so, I imagine, about 1.5m diameter?). It had fresh bloomer bread thick cut and spread with real butter (at home we had margarine so it was always a treat). New potatoes that always tasted unique (I later discovered, it was the salt. Nan always added lots of salt whereas mum didn't, which is why it always tasted so different at Nan's). Fine bone china bowls with pastel colour flower patterns spring to mind, though not in any detail. Runner beans and peas, fresh from Granddad's flower bed. Happy days of childhood.

marsmilkbottle.jpgI then remembered the 'Mars Milk'. I guess I was staying at Nan and Granddad's for a weekend. We'd gone shopping and I asked if we could buy the 'Mars Milk'. I didn't understand what Nan was trying to tell me at the time, that the Mars chocolate bar was an advert for Mars and the milk was normal milk. I liked it enough to ask for it again though. Several years later, and Mars flavoured milk appeared on the supermarket shelves.

I don't claim that any of the above is of interest to anyone but me, but the memories are wonderfully tasty in my mind.

I treated myself to a rails training course last weekend (with Well House Consultants, rather good, I'll write about it if I get around to it). Immediately I start to create my first ruby app and I forget all the sqltypes I can use in my Model and where to look them up. As I think I'll be looking them up quite a lot, I've put them here on my blog for my later reference

:primary_key,
:string,
:text,
:integer,
:float,
:decimal,
:datetime,
:timestamp
:time,
:date,
:binary,
:boolean.

Options that I can use in my migration
I must remember to specify the decimal precision I need!
:precision [1..63], :scale [0..30]. Otherwise Mysql Default is (10,0).

* :limit - Requests a maximum column length. This is number of characters for :string and :text columns and number of bytes for :binary and :integer columns.
* :default - The column's default value. Use nil for NULL.
* :null - Allows or disallows NULL values in the column. This option could have been named :null_allowed.
* :precision - Specifies the precision for a :decimal column.
* :scale - Specifies the scale for a :decimal column.


These came from: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html

I've been meaning to write about this for a while. Many people we send images files to don't know how to view beyond the first page of a multi page tiff file in Windows XP (probably Vista, I haven't tried).

viewmultipagetifscreenshot.png

If you open a multi page tif using 'Windows Picture and Fax viewer' (the default unless another program you've installed has taken over as your preferred tiff viewer) you get an extra little drop down box at the bottom of your screen, that allows you to choose which page you'd like to view. When you go to print, you're shown a preview of each page and can choose (by tick box) which pages you'd like to print.

Our fax to email scanner creates these multipage tiff's.


An old friend on facebook asked if anyone still had the Kent Challenge Team (KCT) promotional video so Rhonda found our copy and we've uploaded it. Happy memories flood back :-)

In June 2004 we went on holiday to Australia. The photos were shared on my web site, crafted hand coded pages in the days before I used movable-type to blog. One day, I may move them into the main blog but for now they still live in their own little folder at http://www.steveroot.co.uk/australia/. Amongst the requisite family holiday photos is an aerial photo of Sydney taken from a helicopter flight.

680bound.jpg

This is 'Deco by Night', an image created by visual designer Albert Keifer. If you look really closely you can see our holiday picture in that image.... no I struggled too. The nice chap emailed a series of images to show me...

P1010105.jpg

So here's our original holiday photo. The city of Sydney, it's wide blue river, Opera House, distinctive bridge and some of the email Albert sent asking if he could use the image.

I am an illustrator, visualiser and I was approached yesterday to enter in this contest. I had the shape lying around and started working on rendering it from different angles and see how I could build an atmosphere. I was coming to a stage where I felt it needed some nice atmospheric background city to put this monumental shape in its correct feel of 'being very big and aloft'.

01-the-beach.jpg

So I started a Google Image search on birds eye view and that's how I came across your Sydney image. It immediately struck a chord and I went on to integrate it into the picture. I did not want recogniseable features since this is supposed to be a futuristich 'somewhere' place and a landmark building like the opera house would immediately distract from that and root it back to a well known place. That's why I started to do a quick manipulation (which is also part of what I do for a living) and that's how this image ended up the way it is now.

02-city-base-added.jpg

I asked nicely if I could post it on my blog (OK, it's taken almost 2 years for me to post, but I've finally got to it!) so he emailed me some of the interim images to show how the steps used to crate the image.
Click on the images to see them full size, you'll probably need to do that to see the detail of the changes

03-city-remodeled.jpg
The first image is 'the-beach' which is used for the skyline and low sun.

The second image is 'the-city-base-added', click and see the full size image and you can see how it's been flipped, cropped and laid on top of the first image.

04-main-building-added.jpg
In the third image 'city-remodeled' you can see how Sydney has been transformed into a generic city, losing the landmarks of the harbour bridge and opera house.

Finally, the computer generated image of futuristic chrome petal shapes is the top layer.

So I may have been quieter than usual over the summer, but the blog still goes on. What visitors are reading though has changed since last year when this post gave the top 4 posts. Now they are:

1. Useful Windows Shortcut key to show Desktop is still number - This was written for XP but the shortcut works in Vista too.
2. Margins and Markups - what the difference is and how to calculate them.
3. Red mushroom with white spots - a photo I took while walking
4. BBC iPlayer and it's built in Kontiki software - though I must make a new entry about this, as the iPlayer has moved on since 2 years ago. We're now watching iplayer via our Ninendo Wii! Nicola used it to watch Gavin and Stacey for the first time to see the kitchen I designed (it's the maple one, in the house set in Essex).
5. Welcome to the Christmas Party season - a review of our 2007 works christmas party.

Happy new year!

| | Comments (0)

Happy new year everyone!

It may be apparent I've not been typing a lot lately. Well, I have, just not in the blog. Having caught up with work and other real life fun things I'm hoping to post several entries that are overdue. Before I do that, some suitable geek humour that had me in fits of laughter (good job I'm the only one in the office).

Sandwich
from: http://xkcd.com/149/

(funnier for me perhaps, 'cause sudo refers to the 'root' user.... hey, it's geek humour, it'll mean nothing to 99% of the population so you'll not be perfectly normal not to understand it)

live-gps-track-via-internet.jpg Brother Dave decided to go on a cycling holiday, from Oslo in Norway to Copenhagen in Sweden. His Nokia phone has built in GPS and with a little software from http://www.mapmytracks.com/ and a not inexpensive data contract with O2 (mostly needed so we can pester him with work email while he travels) we're able to watch where he cycles in real time. You too can see him cycle slowly up hills on a scrolling map the wizz down the other side.

To find out where he is now, or where his last section finished, follow this link: http://www.mapmytracks.com/explore/author/davidjroot/latest , or visit his blog for anything else he uploads (he's going to try and geotag his photos.....).

Special thanks to the developers of mapmytracks.com, it wasn't possible to link directly to the latest route yesterday so I sent an email asking for it to be added to the wish list. Less than 12 hours later and they've added it already!

live-gps-track-via-internet.jpg Brother Dave decided to go on a cycling holiday, from Oslo in Norway to Copenhagen in Sweden. His Nokia phone has built in GPS and with a little software from http://www.mapmytracks.com/ and a not inexpensive data contract with O2 (mostly needed so we can pester him with work email while he travels) we're able to watch where he cycles in real time. You too can see him cycle slowly up hills on a scrolling map the wizz down the other side.

To find out where he is now, or where his last section finished, follow this link: http://www.mapmytracks.com/explore/author/davidjroot/latest , or visit his blog for anything else he uploads (he's going to try and geotag his photos.....).

Special thanks to the developers of mapmytracks.com, it wasn't possible to link directly to the latest route yesterday so I sent an email asking for it to be added to the wish list. Less than 12 hours later and they've added it already!

This is so I don't forget, it took me a while to not find the answer via google, guess the solution successfully, and then read the solution by chance while looking at something else.

I use googlemail (actually, google apps but let's not get pedantic).
I have a friend with several email addresses, (work, other, home, other, other).
Recently she asked for emails not to go her work address (unless they're really urgent).

When I use gmail to write an email just to her, it's easy to choose which address it's going too (and I know roughly which address is most appropriate at the time), but I have a contact group set up with her in it and those emails were always going to her work address.

There was no option when creating the group to choose which of her email addresses should be used by default. The address being used (work) was also the address that came up first when composing a message and including her specifically.

I guessed that this apparent default email address was the first contact address I'd entered for her and when I checked it was showing on the top of the gmail list of addresses for her contact record. I replaced the top of list email address with the prefered 'other' address, added the work address to the bottom of the contact list. Created a new email and using the contact group and gmail used the 'other' address' instead of her work address.

I later read 'googlemail defaults to using the first email address of a contact....'

This is a note for my future self, because something tells me I'll come across the same problem again....

The old server ran Colfusion MX 6.01, the new server is running Open Bluedragon, the near equivalent to Coldfusion 7 or 8. (Colfusion MX6.01 doesn't work properly with Apache 2, or more recent linux operating systems and I couldn't justify the upgrade cost to the latest version of coldfusion. My next big project will be to rewrite the Roots web site into an open source language though as Open Bluedragon runs coldfusion code and is open source, I might be able to develop rather than re-write from scratch, anyway, enough of that background).

Things change between program versions and to my horror I found the shopping cart wasn't working yesterday. The blame lies with me, I didn't properly test and I should have spotted it before the server move. Hey ho, 3 hours to debug and fix, and the problem was with

<cfset this = val(evaluate(listgetat(
   form.FIELDNAMES, listcontains(
      form.FIELDNAMES,"_ID_"))))>

The Fieldnames are coming out as all lowercase, and the original code was written to handle the form.FIELDNAMES returning all uppercase.

If i've a bottle of white wine at home, I'll open it and have a glass to celebrate my satisfaction :-)

Photos

  • speechrecognitionmicrophone.png
  • marsmilkbottle.jpg
  • viewmultipagetifscreenshot.png
  • 680bound.jpg
  • 04-main-building-added.jpg
  • 03-city-remodeled.jpg
  • 02-city-base-added.jpg
  • 01-the-beach.jpg
  • live-gps-track-via-internet.jpg
  • googlemail-down.jpg

 

Powered by Movable Type 4.31-en