« May 2007 | Main | July 2007 »

June 30, 2007

Key new contacts

Our networking event on Thursday evening was a great success; many new contacts were made and everyone was very busy from just after 6 all the way through to 9 ... spending no more that 5 minutes with each other company present.

Each individual contact was an opportunity to explore another local business, and to see if and where we could work together to our mutual benefit; certainly we left with a series of follow ups / meetings that have allowed us to source some really tricky items locally, and I know that in turn our hotel and conference facilities are now known that much wider

We are holding another Speed Networking Event on October 16th - this time covering not only the town of Melksham, but also the local owns of Devizes and Trowbridge. We look forward to another full house of 20 companies.

Posted by gje at 01:25 PM | Comments (0)

More about Graham Ellis of Well House Consultants

June 29, 2007

Westbury Bypass - how it would effect Melksham

There is a proposal (perhaps slightly more than a proposal now!) for a bypass to take traffic on the A350 road that heads North - South through Wiltshire out of the town of Westbury and route it to the east of the town, quite close to the Westbury White Horse.

I had a chance to pop in to an exhibition in Westbury while it was open to the public yesterday. It was very well and professionally laid out and the case for the bypass was persuasively presented. And that is exactly as you would expect from a show laid on by the supporters of the plan, including the consultants and council who are advocating it.

I come from a town that's a few miles north on the A350 (Melksham) , and I'm worried that improvements to the route of the A350, such as a Westbury Eastern bypass, will draw new traffic even above any natural growth into the area, and onto feeder roads. The exhibition's diagrams confirmed that such a draw of extra traffic is expected - it shows a 42% rise in HGV traffic on this trunk road heading north out of the area, beyond the bypass.

Speaking with two of the experts present, I understand that the various studies on the road impact that were being shown have only looked as far north as the Semington Roundabout - still several miles south of Melksham. And that worries me, as I can imagine places such as Beanacre and the North Melksham area going into gridlock if the majority of the extra HGV traffic tries to get through there on existing, unimproved roads.

I was down in Exeter at a public enquiry on Tuesday (first time I've even been to one!) and shocked at the 200 to 300 million figures that came up for improving the A350 all the way from Warminster to the motorway. A more managed approach, and making full use of the parallel rail corridor - maintained to mainline standards, but with just 2 passenger trains a day (07:00 and 19:35 from Westbury) and existing earthworks if it needed to be doubled to take more freight would be a much more sensible option.

What is needed, then? Some improvements and perhaps extra road sections for sure, looking at critical points between the M4 motorway and Warminster as a whole. But not a major upgrade that sucks an extra 42% in from surrounding areas. And that in association with the train improvements.

Someone commented to me that a bypass - in 20 years, if fossil fuel runs out, would be a superb cycle path for anyone who wants to see the countryside on the northern flank of Salisbury Plain.

Posted by gje at 03:34 PM | Comments (2)

June 28, 2007

Substitute operator / modifiers in Perl

Perl's substitute operator lets you replace a Regular Expression with another string within a target string. For example

$hello = "Grating";
$hello =~ s/a/ee/;
print "$hello\n";

Will turn Grating into Greeting within the $hello variable. You'll note that you can use almost any special character in place of the "/" delimiter, and that (unusually but not uniquely) the =~ operator in this use actually changes the content of the incoming variable.

There's a further "twist" to the substitute syntax too. What are those extra letters that you sometimes see at the end? If you add a "modifier" letter after the final delimiter, you can alter the behaviour of the whole substitution.

Modifier g is Global - replace ALL matches not just the first
modifier e is Execute - perform the output string as a piece of code
modifier i instruct Perl to ignore case in matching
modifier x tells Perl to treat spaces in the regular expression as comments
modifier s tells Perl to have . (full stop) match new line as well as anything else
modifier m tells Perl to have ^ and $ match at embedded new lines within the string.

Here's an example showing the syntax and effect of the e and g modifiers:

# Use of the s (substitute) operator
# Showing the "e" and "g" modifiers
 
$text = 'a little \piece of \bread and butter';
print "<b>Base text</b> $text\n";
 
$textcopy = $text;
$textcopy =~ s/(\s.)/uc($1)/;
print "<b>Single default substitute</b> $textcopy\n";
 
$textcopy = $text;
$textcopy =~ s/(\s.)/uc($1)/e;
print "<b>Substitute and execute</b> $textcopy\n";
 
$textcopy = $text;
$textcopy =~ s/(\s.)/uc($1)/g;
print "<b>Global Substitute</b> $textcopy\n";
 
$textcopy = $text;
$textcopy =~ s/(\s.)/uc($1)/eg;
print "<b>Global substitute and execute</b> $textcopy\n";


which generates

Base text a little \piece of \bread and butter
Single default substitute auc( l)ittle \piece of \bread and butter
Substitute and execute a Little \piece of \bread and butter
Global Substitute auc( l)ittleuc( \)pieceuc( o)fuc( \)breaduc( a)nduc( b)utter
Global substitute and execute a Little \piece Of \bread And Butter

My example uses ( .... )within the regular expression to capture part of the incoming string for use in the outgoing string, where I've reference back to it using $1. An alternative would have been to backreference to it using \1.

Posted by gje at 07:46 AM | Comments (0)


Useful link: Perl training

Business speed networking - a place tonight!

Tonight is our Melksham Speed Networking Evening for local businesses to get together, spend a just a couple of minutes introducing themselves, and then seeing how and if they should be working together. "It's amazing what you can find in Melksham" we always say, and we're also reminded that even local businesses who look at their market as being away from the town can reap huge benefits by using local suppliers.

Occasionally - (and at times it feels that it's VERY occasionally!), two incidents that we might say "oops" to come together to make something that's very right. A cancellation phone call last night, just before I left home to go out to a Chamber of Commerce meeting, left us with an unfilled seat. And a few minutes later, I was chatting with the Chamber's chair who had been wanting to come along but the date had crept up on him and we had gotten full. Problem solved.

We do still have ONE place (as a result of an earlier pull out yesterday); anyone reading this from the Melksham area / doing business here - please email me (graham@wellho.net) or call on 708225 or 793803. Should be a very worthwhile evening (18:00 to 21:00).

We'll be holding a further event on Tuesday 16th October - this time extending the reach to cover businesses based in the nearby towns of Devizes and Trowbridge, from where we get a lot of our supplies, and where many of our hotel guests visit when in the area.

Posted by gje at 07:11 AM | Comments (0)

June 27, 2007

Is this how to run a business for businesses?

Last night, I attended as observer a meeting of the regional committee of the Federation of Small Businesses. I have been a member of the FSB for a few years and on the local (branch) committee for a much shorter while; I would not normally wish to go further "up" the organisation, but agreed to an appointment as observer for this one meeting.

And a very strange meeting it was too. Our Regional Chair, who has done so very much for the FSB over recent years, had been asked to stand aside from official duties while certain issues are addressed. And the meeting proceeded as if nothing had happened. With the vice chair keeping to agenda, with what appeared to be veiled threats to keep on topic, with nothing at all being said about what had been going on (leaving newcomers such as me utterly bemused) but with all sorts of references to emails that were said to have been sent out that afternoon so "you won't have seen them if you have come straight from work" it was mightly confusing.

Frankly, I don't know exactly what it WAS that I observed. I saw one issue that I knew to be contensious passed. I saw great respect for the work of the Regional Chair - and I share that huge respect; it may have been just "skin deep" from some of the people around the table, but it's heartfelt from me, and I remain of the opinion that any issues have been blown out of all proportion (indeed, I expect they are non-issues in reallity), with a handful (at most) of people carefully fanning the flames, perhaps based on their own agendas. I do know that I did not understand the meeting, that I don't know what happens next, and that if I make any specific comments on the issue in a public place such as this blog, I am liable to be unpopular. As I say, a very strange meeting indeed!

But sitting out to one side, the meeting did convince me that whilst I'm happy to remain an ordinary member of the FSB, I find their systems, rules and goings on at a branch, regional and policy level to be complex, and the organisation and procedures to be rule-driven, controlling in character and old-fashioned and long-winded to administer. I look, too, at the central and branch costs and I wonder how the organisation as a whole stacks up on this. That's not intended to be a criticism limited to this particular organisation - and indeed much of it may be forced upon them by the legal framework under which they have to operate); I have seen similar scenarios elsewhere - if you look to Rotary, to Chamber of Commerce, and so on.

I think it's astonishing that the Chair has been placed to one side in mid-year when it would have been more appropriate to wait until the organisation's year end in the autumn to look to the next chair based on proper vote and not something else (I don't know if the words "coup" and "kangaroo court" are relevant or not). I'm going - I think - to sit out this year, but not offer myself for committee service even at a branch level next year.

Posted by gje at 04:08 PM | Comments (0)

How NOT to oversell a hotel

[Part of my report into that strange day - 26th June 2007 - index]

<rant>

It's 4 star, it has a posh Bradford-on-Avon address, and it has "Best" in its chain name. But if this is the best that B-o-A can do, as seen at last night's FSB Regional meeting, then Melksham can do far better. An excellent opportunity, again, to see what's done by others and learn.

A sit-down dinner for just under 40 people, and we were crammed into a room that's perhaps two thirds of the size of our "Wilts". I would have felt comfortable seating perhaps 30 people in that room for a seminar / presentation but 40 for dinner was over the top. 6 per table, 3 each side; being in the middle, I felt I had to syncronise my eating arm movements to those of my neighbours very much as I would expect - economy class - on an airline flight. Except this was a swish hotel with four stars and not the cheap seats on a flying bus.

I also noted that part of the room was taken up with a tea / coffee service area, restricting room further and making it even less comfortable at the corner. Seminar / presentation? Yes, there was one of those set up AS WELL in the room, with a group of 6 young enterpreneurs telling us about their school company with the aid of projector, laptop computer and display panels.

The room was just off the hotel's reception ... and I noted with a wry smile that the reception counter was being used as a counter for the food that awaited service to our group. I suspect it waited there quite a while, as the beef stew (and it was tasty!) came with a skin over the gravy by the time it reached us.

After the meal, we took a five minute comfort break while the same room was re-organised into a big conference table for the meeting to follow. Nothing wrong with that re-use of the same room ... but the tables (I didn't look under the cloth!) were clearly of different origin / heights and there were a couple of steps of perhaps 2 or 3 inches across the table. Didn't actually make a huge difference but my goodness it looked tacky!

You'll see my account (if I post it - it may be a private meeting that I cannot describe in detail for legal reasons) of the meeting separately. What you won't see on the "meeting" side is my comment about just how noisy it was. Outside was a large wedding party (in fact, they were all over the hotel) and smart-dressed young ladies, gentlemen in kilts, and others laughted, joked and shrieked on the lawns just outside. We tried closing the windows; the sound muffled for a couple of minutes, the temperature rose .... and one of the windows sprang open again under its own weight ... much to the amusement of attendees at what was otherwise a very turgid meeting.

My / our lessons? Don't cram. Don't sell clashing events in too close a proximity. Ensure you can serve the food fresh and not with the gravy dried to a crust. And ensure that you have parking for all as well.

Now - under normal circumstances I would be inclined to give the hotel the benefit of the doubt over an unexpectedly big booking / clash, and / or raise it with the staff and manager. As an attendee, I didn't feel that was my place, and having had a previous email correspondence with a second hotel in the same management group a couple of years ago, I know that it's standard group practise - in fact I think I'm free to share the experience of last time with you too!

Dear Sir,

My wife, my father and I at your Clevedon hotel on Saturday night last, and we were very disappointed. I raised a couple of matters with senior staff and management, but didn't feel that they were able to answer adequately or resolve the issues. I'm taking the extraordinary step of dropping you this note to give you a taste of our experience; we provide customer service in our own business, and I know that I would want to know if any of our clients got what they felt was a service that was well below par.

The Walton Park's advertising describes it as a lovely hotel where you can eat a meal in the restaurant looking out over the Bristol Channel, relax in friendly atmosphere, or in one of 45 spacious bedrooms, most of which (it is said) have sea views. It says that you have ample parking and a team of award winning chefs ....

Perhaps all this is true, but little of it was available to us on our visit due to a wedding. We had to eat off conference tables in a back room. We couldn't park in the car park and had to search for street parking. We were given tiny back rooms that didn't fit your descriptions. We had to push through crowds and parties which made it far from relaxing.

The staff serving your "non-wedding" customers tried to be helpful, but were being trained on the job. We sent back one dish that was incorrect, didn't bother with a second such error, nor did we comment on food that was medicocre at best - it certainly wasn't "only finest local produce". This was a special weekend away so we really didn't want to ruin what atmosphere there was, nor did we want to make a scene once we knew the score. We ended up laughing things off as best we could and taking comfort in the fact that we weren't alone in receiving this treatment.

At breakfast, we were allowed into the restaurant and seated at a back table, with Dad's chair sticking into the entrance doorway where all the wedding guests were giving their room numbers for breakfast. A request for a better table was denied. When we checked out, the one receptionist was having trouble sorting out the bills of the various Griffins ahead of us and grumbling about how hard it was with everyone with the same name, and the reception / lobby area was doubling as a smoking room. The rest of my party waited outside while I was obliged to queue in the smoke.

I'm sure that on other occasions the Walton Park is a lovely hotel, but I do feel that you had grossly overbooked your facilities at the weekend, and you did not have adequate trained staff. I would much preferred that you had warned me of the wedding when I phone to book. We could have chosen another weekend when you able to provide the service you advertise to your "rack rate" guests. As it was, we all agreed that we would have done far better at a Travel Inn / Brewsters for the night, spending about 130 pound between the three of us rather than just over 200 pounds.

As I said at the start, I'm writing to let you know about this because I know that in your shoes I would want to know. Please do feel free to ask for any more specific details from me if you like.

Yours faithfully

Graham Ellis

And here is the response which, in hindsight, is probably a pretty standard letter ...

Dear Sir,

I am very disappointed to read of you dissatisfaction following your visit to our Walton Park Hotel, Clevedon. Disappointed and surprised because we are very proud of our Walton Park Hotel.

Your communication has been discussed with the Management Team who are obviously embarrassed at the points you make, particularly that they were 'not able to deal with the issues'.

Clearly we let you down on this occasion and I am very sorry. I would hope that you will give us another chance, and if so, I can promise you a substantially reduced rate. Our Sabrina COX will check availability and make those necessary arrangements should you so wish.

Yours Truly

D.J.Williams
Group Operations

</rant>

OK:

a) At Well House Manor we do not do wedding receptions. We don't have the space, we don't have all the facilities, and we could not do a good job.

b) We have and know the limits on our parking and rooms. I have a full house of TWENTY FIVE in "The Wilts" tomorrow night which is less than half the density that the Leigh Park applied for a seated-at-tables event. We can go up to 2/3 of their denisty (40 guests)

c) When a room is in use at near-capacity, serving and other facilities to be provided from outside the room.

d) A maximum of one large group at a time. And if that large group occupies over 60% of the facilities, whatever's left over is NOT to be greed-sold to any other organisation or individual guests who don't realise there's a "biggie" going on!

All this is not to say that we get it perfect - we don't. But we can sure as heck do our very best, put anything raised right a.s.a.p, and put ourselves in our customer's shoes so that we can spot any obvious problems before they're problems.

Posted by gje at 12:28 PM | Comments (0)

An afternoon at a public enquiry

[Part of my report into that strange day - 26th June 2007 - index]

Enquiry in Public into the Regional Spatial Strategy

You'll probably look at that title and say "Eh?" and "WHAT?". The Regional Spatial Strategy has been prepared by the South West Regional Authority as a plan for where the part of the country from Swidndon to Penzance, and all points between, should be going for the next 20 years. With a wide variety of opinions, the Enquiry in Public is being held in Exeter, with a panel of 4 examiners taking inputs from pre-signed-up interested parties, the SWRA representative having a chance to come back at the end of each sub-section to comment.

The RSS document itself is a hefty tome, and appears to be so generalised as to be incomprehensible at times. But in fact it's full of tightly worded paragraphs which I have no doubt may be quoted back and referred to as policy in the coming decades ... as in "we can't do that because it's not allowed by the regional policy" to some sensible ideas. So distant, general and obtuse but perhaps worth some effort.

But what an expense and effort is the "EIP"! Some 100 people were in that room in the Poshest Hotel in the centre of Exeter. Around 30 were seated at the square table - the examiners across one end, and other bodies down the sides and across the opposite end. And rows of seats behind allowed other briefers to observer and talk to their representatives during sessions.

I was there at the invitation of the a group who are opposed to current plans for a bypass to the east of Westbury (their informaion) to answer a single question, worded as follows: "Does the draft RSS give adequate weight to the contribution that the existing rail network might make to the reduction in car travel, particularly in the Bristol area".

There were 7 such questions scheduled for the afternoon, and this was the third one. And the afternoon already started 20 minutes late after a morning over-run. Two questions had been discussed and there was just a few minutes left until what I had been assured would be the finishing time, but the session chair carried on never the less, asking everyone to be brief, and postponing the remaining questions to the following day.

How did I do? Frankly, I don't know. It's one of those scenarios where everyone is looking to score points with the inspectors. I do know that nearly everyone one who spoke - every single person but with one exception - stated that the RS draft did NOT make such adequate weight. How could it possible do so when three of the regions's railways (including that from Swindon via Melksham to Westbury) had been left off the maps? When talk of investment in the plan was non-explicit in transport modes and talked about improvements as if they were to be road only? But the technical / transport stuff is a subject for elsewhere. (draft of my comments)

I was struck by the organisaion and cost of the enquiry. This was just one afternoon on 10 weeks of public hearings - 50 days. So that's 5000 man-days. About a half of those were civil servants / public sector employes of some sort, paid for out of my taxes and yours. Few of them (if any) will live very close to the hotel in Exeter, so many are commuting long distances or staying over. Let's say that a civil servant "place" costs 200 pounds a day for his / her salary, plus a further 150 a day for hotel and subsistance or travel. So that's the best part of a million pounds for the civil servant part of the audience.

But that's only a tiny part of the cost, isn't it? The civil servants are all prepared and briefed, aren't they? I would guess at one day in their office / preparing for each day at "the show". And I would estimate that there's a further team member back at base, putiing in the same time, for each one on the stand.

I wonder how much that room costs to hire? I know I paid 1.50 for a cup of instant coffee during the afternoon break so it was NOT all a freebie (but I have no doubt that those present at public expense will claim back!). And looking wider, the drawing up, printing of the RSS and all the other activities probably make this EIP pale in cost into insignificance. I really hope it's worth it; I utterly appreciate the need for a strategy going forward, but I really wonder at the methodology.

Partial list of organistions attending ...

Government Office South West
Regional Development Authority
Highways Agency (but no rail equivalent noted)
South West Regional assembly
South East Strategic Authorities
North East Strategic Authorities
West of England Strategic Authorities
Somerset and Devon Strategic Authorities
Pensinsula Stratrgic Authorities
Confedearion of British Industry
Pegasus Planning
Poole Harbour Commissioners
Bristol Ports Authority
Campaign for the Protection of Rural England
Transport 2000
Friends of Suburban Bristol Railways
Westbury Bypass Alliance
Bristol Civic Society
Friends of the Earth
Natural Enland
SW Chamber of Rural Transport
Campaign against South Bristol Ringroad

Posted by gje at 09:03 AM | Comments (0)

An oddball day. Strange experiences!

Yesterday was the oddest day in a long while ... and probably one of the least productive in an immediate sense. But I'm going to use words like "interesting", "educational" and "thought provoking". Little did I realise when I set out soon after 9 a.m. that it would be nearly 11 p.m. before I got home. And - because of the volume I could write - I'm going to post up each section separatetely if, as, when I get a chance. I'll add archive links here for you to follow through ...

Public Transport nightmare to get to Exeter link - forum post description

Enquiry in Public into the Regional Spatial Strategy link - description and comments on enquiry

A very strange meeting of a local business organisation link - outsider's view of the FSB regional meeting

How NOT to do it - another hotel that takes more customers than it can handle link - report and a note of previous experiences

Posted by gje at 08:54 AM | Comments (0)

June 25, 2007

Ensuring that our tutor answers YOUR questions

On our public courses, we get a wide variety of delegates - ranging from those with very little prior knowledge of the subject that they're learning right through to some delegates who are attending more to "dot i's and cross t's". And then the subjects that we teach have such a huge variety of different uses that what's important to one delegate may be less important to another. So how do we ensure that everyone gains as much as possible from our courses? Well - there are a few things that we do which might not be quite the same as other training suppliers.

• We limit public courses to just 8 delegates. This ensures that the tutor has good time during practical sessions to discuss specific needs with each and every delegate, and that there is plenty of time during lectures and demonstrations for us to address and answer immediate questions that arise without taking the presntation off topic.

• The tutor (and other technical staff as appropriate) join the delegates on the course at lunch, giving the relevant members of our team a chance to answer questions and issues you may have in much more depth than is possible during class, and also giving our team the chance to let you talk about your own requirements in much more depth to that the course can be better directed from that point onwards.

• You are able (and welcome) to use our resources prior to the course starting in the morning, and after the course finishes each evening. If you're staying at Well House Manor, there is no limit to the hours you can put into this - you'll have access to the library and training room at 3 a.m. if you need it

• And as if that isn't enough, the tutor is usually available from well before the course starts in the morning (8 a.m. for a 9 a.m. start) until well after the course finishes (on most evenings, he's around until 6 p.m. at least). At the very least, there will be extra availability on half the days of a course.

Posted by gje at 01:49 PM | Comments (0)

June 24, 2007

FolksFest Bristol - German beer, Bratwurst and music

Yesterday ... a trip to Ikea in Bristol (for tables for an event we're holding this week) left us frustrated and speechless, and Ikea loosing themselves some business. Yes, they had what we wanted. Yes, there were 24 in stock. But no, we couldn't have them as they were stacked on a high rack and the staff couldn't get them down for us while there were customers about. Carl went off to get the manager to see if there was anything they could do (like ship them to us!) but came back with a negative response; Lisa noted that the manager didn't even bother to come and explain to his customers in person.

Plans had been to go on to a wholesaler we use regularly to purchase further supplies that we need, but after that frustration neither Lisa nor I really felt "in the mood", and found ourselves parking at Castle Green at around 6 p.m. - just for a stretch of the legs and some fresh air. Imagine our suprise, with Glastobury festival running nearby, to find a German FolksFest in full swing.

Link - other Bristol Castle area pictures

Posted by gje at 05:47 PM | Comments (0)

Heavy duty hole punch

In the past years, we've punched holes through some 40 metres of manuals!

Our electrical punch packed in on us a week ago after seven years of sterling service, and after investigating the cost of repairs it proved more cost effective for us to replace it with a brand new unit.

A few small changes in the design of the new unit, but it's another heavyweight (i.e. almost impossible to pick up) piece of machinery that should see us through into the next decade.

Posted by gje at 05:03 PM | Comments (0)

Speaking at St. Catherine's College, Oxford University

This is St Catherine's college at Oxford University - built just on the outskirts of the City, and venue for the 12th Oxford University IT Support Staff Conference last Thursday, where I was fortunate to have the opportunity to be invited to speak.

There are hundreds of IT staff at the University, and this annual day takes a lot of organising; my congratulations to those organisers for pulling off a big event seamlessly. Here's the main lunch hall, with around 250 delegates. Many old friends of ours there - even on this small picture I can look and see quite a number of people I've got to know well as they book or attend our niche courses.

Facilities for my talk? Excellent - I was prepared for any evenuallity as I've learnt is necessary in this business ... everything I needed on my local laptop in case there was an issue with internet connectivinty, but of course OUCS have the excellent OWL / OWL Visitor system and had a wireless and wired account set up and available for me in less than a minute.

My audience gathers ...

With a choice of four separate "tracks" for each part of the conference, and at the end of a long day, I was delighted to have well over 50 sign up for my somewhat oddball "technology behind a geek hotel" talk. My choice of subject, but based on a seed sown in jest by one of the OUCS staff. I was aware of a lot of protentially high-tech specialist talks and wanted a contrast for people.

How did it go. Well - it was fine (but not, IMHO, excellent). I had been asked not to make it too commercial and I probably took that request too much to heart - dumming down good points that should have been raised. And the audience size is an order of magnitude bigger than I'm used to.

But then perhaps I'm being too harsh and self-critical. I had sat in on an earlier talk in the same room to get a feel for the atmosphere of the place, the logistics from an audience viewpoint and, frankly, had found a talk on "saving the planet" (which turned out to be all to do with using archiving systems that could be kept on line, but unpowered, for years) dry to the extend of stiffening the audience and nearly sending me to sleep ... I had sat through that and I can re-assure you, 100%, that my audience didn't have a chance to drift. Questions throughout. Points being made, members of the audience interacting ... laughter occasionally, and more excellent questions at the end.

Yes - perhaps I should uprate one notch from just describing it as "fine". It was cool. Still room for improvement, mind you; each such event is a learning experience and requests come in from varous quarters these days. The very morning that I went up to Oxford I got a request to speak in Ely at the start of November, sharing a platform with some nationally known and respected figures. Perhaps you'll see more of me on "the speaker" circuit in the future.

But I want to end today with a big THANK YOU to my friends at OUCS for the opportunity. I look forward to seeing you next time there's a training requirement we can help you with.

Posted by gje at 09:32 AM | Comments (0)

June 23, 2007

If I say 'I am fine', what do I mean?

What comes after breakfast and lunch? ... a question I asked on Friday's Perl course; rather than a straightforward answer, I was invited to choose between tea and dinner. And having selected "tea" and asked of what it might consist, I was reminded that tea is a very different meal in different parts of the UK ...

Last night, I'm ashamed to admit I was watching a very old edition of "Family fortunes". The contestants had to name 6 ways of saying "it is cold" as chosen by the studio audience; I came up with "nippy" but overlooked "parky" which I should have known, bearing in mind my more northern roots. But there you go; I was probably far closer to the mark than others I live and work with who - by contrast - would have come up with American or Polish terms far better than I could even hope to do.

Working in a company / living in company where my slant on English is not necessarily everyone else's, I have to ensure that I talk clearly at times and remember that certain words have - err - different levels, especially adjectives representing degrees of quality. Let's have a scale of five levels, should we?

The tops!Magic, Excellent, Wow
 Great, Cool
 Fine, Good
 OK, Acceptable
Oh Dear!Rubbish, Poor, Unsatisfactory

There's a lovely smell coming from the kitchen so I'm going to cut off and grab some brekkies. Perhaps I should come back and quantify "lovely" a little later?

Posted by gje at 10:28 AM | Comments (0)

June 22, 2007

Fancy going to Glastonbury?

It's the weekend of the Glastonbury Festival ....

Me? I think I'll stop indoors. [[Picture taken by one of my Perl delegates - Tom Dyes - and reproduced here with his permission]]

(One of my own pictures ...)

Posted by gje at 05:11 PM | Comments (0)

End of File on a Java BufferedReader

How do you sense if a BufferedReader in Java has reached the end of file? Like so many "things Java" it's easy enough to do ... once you find that vital method in the lists of thousands of calls!

There's no "eof"; there's no checking the input to see if you got nothing back after a read as that happens when at the end of file AND at embedded blank lines. But the ready method tells you if you have data available of not - and that's the one to use.

Here's a sample piece of code in Java to echo the first 12 lines of a file, and to count all the lines in the file too.

File myFile = new File ("access_log.xyz");
BufferedReader newFile = new BufferedReader(new FileReader(myFile));
int k=1;
while (true){
  if (! newFile.ready()) break;
  String next_line = newFile.readLine();
  if (k<12){
    System.out.println("Line Number:"+k+" - "+next_line);
    }
  k++;
  }

Posted by gje at 06:56 AM | Comments (0)


Useful link: Java training

June 21, 2007

The kind spirit of Melksham

It's one of those days where I'm posting short, at the end of a long day. Well - actually I've had a couple of long days ...

But I do want to record a bif THANK YOU to Mr and Mrs x for the lift from Chippenham Station after I missed the one and only evening train that comes down our way. They heard me asking about the "Glastonbury Special", and getting a negative answer, and approached me to offer. Even ran me to my own corner.

There are some wonderful, kind people in Melksham. Reminds me (not that I need reminding) why I love the place.

Posted by gje at 08:14 PM | Comments (0)

June 19, 2007

What proportion of our web traffic is robots?

We welcome search engines to our site - to index our content and point their visitors back to us where appropriate, but such search engines are a means to an end and not an end in themselves. How much traffic to our web site is true visitor traffic, and how much is automata?

Our Current Visitors page allows us to take a snapshot of the HTML and PHP pages that use our standard template that have been called up, and from where, in the last five minutes. The database records which browser was in use, the referring page and the country of origin and makes a fascinating read.

Our Most Popular Pages display looks back at yesterday's log files and tells us where people have visited - and a bias towards a particular page will tend to indicate heave real traffic as automata tend to spider evenly.

Pie charts for the last 4 weeks give us a variety of other statistics, and we have many additional reports from this source and extra information we can call up (password protected or from our own URLs only) on the earlier reports.

And here is another interesting pointer - a graph of log file size for the last four weeks

We noticed a distinct weekly "cyclic" flow in this graph (it will automatically update as this blog archives, so you may not see it if you come back here in 2008 or later!) and as automata run 24 x 7 for the most part, we're pretty sure that the peaks and troughs are caused by real visitors.

I started with the question "What proportion of our web traffic is robots? when perhaps I should have asked "What proportion of our web traffic is generated by real human beings browsing at the time?". From the current peaks and troughs on the graph, and the other evidence, I'm guestimating that the figure is somewhere between 40% and 65%, with a very high proportion of that being business rather than home users.

Posted by gje at 06:44 AM | Comments (0)

June 18, 2007

Trying things in Python

Are you used to writing long sections of code to validate user input? Perhaps you are, or perhaps you have shortened such code over the years using Regular Expressions where you can specify a pattern to be matched. One regular expression can replace 30 lines of other code.

But in Python, Java and some other languages there's an even more elegant alternative in some circumstances - exceptions. The idea is that you try to perform the action you require on your input data rather than 100% validating it first. If the action works, great and if it fails you catch the exception and handle the error condition in that block.

Like an example? Here's a piece of Python code to read an integer from the program's user, and to keep re-prompting if the user enters a value that cannot be treated as a legitimate integer.

while 1:
  val = raw_input("give an integer ... ")
  try:
    ival = int(val)
    break
  except:
    print "an integer is a WHOLE NUMBER! "
print ival

Posted by gje at 07:14 AM | Comments (0)


Useful link: Python training

June 17, 2007

Outputting numbers as words - MySQL with Perl or PHP

Oracle's in_char function lets you convert numbers into a text string, but it's an unusual facility to have as as built-in; there's no such facility (as far as I know) in MySQL but you can get around this easily enough within your controlling application - the Nums2Words module on the CPAN (in Perl), and a similar module on the PEAR (for PHP users) does all the hard work for you.

Here's a Perl example:

use Nums2Words;
@testvals = (7, 12, 153, -19, 1234007, 0.7,
  3.1415, 666.62, -176.75, 10.6e15);
foreach $number(@testvals) {
  $t1 = ucfirst(lc(num2word($number)));
  print "$number = $t1\n";
  }

When you run that, you get

earth-wind-and-fire:~/jun07 grahamellis$ perl n2w
7 = Seven
12 = Twelve
153 = One hundred fifty-three
-19 = Negative nineteen
1234007 = One million, two hundred thirty-four thousand, seven
0.7 = Zero and seven tenths
3.1415 = Three and one thousand, four hundred fifteen ten-thousandths
666.62 = Six hundred sixty-six and sixty-two hundredths
-176.75 = Negative one hundred seventy-six and seventy-five hundredths
1.06e+16 = One and six thousand, sixteen millionths
earth-wind-and-fire:~/jun07 grahamellis$

A web search lead me to similar code in Java, and no doubt there's someting in the Cheeseshop if you're a Python programmer. Lesson to be learnt - look around before you re-write code!

Posted by gje at 07:25 AM | Comments (0)


Useful links: Perl training, PHP training

June 16, 2007

A review of a week and a trip to Brugge

It's been a long week - a course in Brugge at the begining of the week, and a f-u-l-l day in London yesterday where I was presenting Python as a series of six one-hour lectures to a somewhat larger group, rather than the traditional course with plenty of time for practicals which do give me a bit of a break. So Saturday morning has been spent with a longer-than-usual lie in bed and a bit of low key sorting out of all those pictures I have taken this week.

There are very different ways of taking photographs, of course. Some photographers line up pretty ladies to shoot them at odd angles:

whereas others take a more relaxed attitude, working there arms hard lifing glasses for the periods that no picture is passing by:

I've tried to capture some element of the character of the place in pictures, and taken some more "documentary" pictures to show what the city is about:
 
which you would think was all chocolate and lace from the central shops. But I HAVE taken some of the "pretty" pictures too. And there I come to a problem - WHICH one picture shall I show you here? I'm going to show this scene:

and encourage you to link to other pages (which will come up in separate windows) here, here, and here.

Posted by gje at 12:13 PM | Comments (0)

June 15, 2007

Horses of Brugge

 

When I updated the Horse's Mouth archive the other week, I found that I had a lack of appropriate horse pictures to use for illustration - I guess there are just so MANY things around that we think of as being quite common and yet ... look in a picture library ... and you'll find them lacking.

And then in the following days and weeks, you'll find excellent photo opportunities for all sorts of occasions. And so I bring you "Horses of Bruges".

Posted by gje at 06:25 AM | Comments (0)

June 14, 2007

Bathtub example

I wrote a few days ago about the bathtub effect. Shorten code and it becomes easier to read. Shorten it too much and it becomes silly. Here's a Perl script that I wrote to report on all lines in a log file from host computer "seal" with a status code (next to last field) over 399:

open (FH,"../access_log.xyz") or die;
while ($line = <FH>) {
   if ($line =~ /^seal\s/) {
      @parts = split(/\s+/,$line);
      if ($parts[-2] > 399) {
         print $line;
      }
   }
}

And here is a shortened application which - if you look at it byte by byte - can do the same thing!

#!/usr/bin/perl -pa
(/^seal\s/&&$F[-2]>399)or$_=""

My point? Something IN BETWEEN would be, by far, best for the typical Perl programmer to understand and maintain.

Posted by gje at 06:26 AM | Comments (0)

June 13, 2007

Sur le Continent

I'm in Brugges, in Belgium, for a few days. [[And wrote this on Monday ...]]

A busy weekend at the hotel. A quick conversion of BR4 from twin to double on Saturday, followed by sporadic checkins and we had every bed taken that night. And a sporadic (or, rather, spread) breakfast on Sunday left us tight for time with our planned midday departure for the 4 p.m. ferry out of Dover. In the end, we were over 30 late away from Melksham, but the roads were clear of major problems and we made Dover in a little under 3 hours.

I'll fly when I have to. But give me a choice, and I'll choose another mode - by rail or boat if that's an option, otherwise by car. So "near Continent" trips like this one to Brugges - less that an hour's drive from Dunkerque and only a few miles inland - are a real pleasure. Once past the London area, and on to the M26 and M20 the pleasure / holiday feeling starts. The rolling Kentish countryside with the North Downs off to the left, with great gaps cut by the Darenth and Medway rivers, down to Ashford and Folkestone where the Downs collide with the English Channel and the road soars up through a brief tunnel to the green and windswept hilltops.

Dover always strikes me as a strange town. Faded and downright derelict Victorian buildings, building sites, and that great Ferry port ("Europe's busiest") within the breakwatered harbour. Sweeping in off the Downs, it's all laid out in a circle below with a couple of Cruise Liners moored up at the West end vacated by Dover Marine station, and the huge paraphinalia of the car ferry post at the Eastern End.

The coming of the Channel Tunnel did bring some changes here - the passenger services from "Marine", the Hovercraft, the Hydrofoil, services to Zeebrugge and Oostende are gone. But there's still a P and O / Sea France / Norfolk Line choice. And we chose Norfolk Line; they were the one I have never used until now, and it seemed logical as Dunkerque is nearer to Brugges than is Calais.

 

The boat loaded well, left on time. Friendly staff, typical (but verging on the better than typical) ferry food, and a smooth crossing. And, thank goodness, a chance to take a break from driving and almost anything else; yes, there *were* people working on their laptops but we took the calculated opportunity to relax. Sunlight at Dover gave way to murky weather on the way over and a grey arrival in Dunkerque. Well - they call it "Dunkerque" but really it's at a remote spot some 10km out at flat and bleak area called Loon Plage. Rather reminded me of catching the boat from Gothenberg which was also pretty darned remote!

Have you ever tried to buy Petrol in Belgium on a Sunday? Our tank was neardrained by the time we reached Dover, and the brief section of road to (and along) the Motorway in France didn't take in any services. There was an petrol station coming up in a few miles, but when we got there, what a queue! There must have been a dozen or more cars lined up for the few pumps, and the line wasn't moving either. Never mind - we're not far from Oostende; I'm sure there's fuel we can get there. How wrong can you be. We found a petrol station that had clearly been shut down for many years, another that was probably just closed for Sunday, and who more with automated machines to buy on "plastic". But alas not the regular plastic - one seemed to exclusively use a Belgian Bank card, and I could swear that the other was a fuel club with their own cards ... ONLY. A big chart showing no Visa, no Mastercard, no Maestro ...

You'll see that we DID make it to Brugges. A calculated gamble of going back on to the Motorway, and we did happen upon another filling station in a few miles, and in time. We would have queued - we would have queued for hours - had we had to. But, as if by some miracle, there were plenty of pumps and few cars. I'm beginning to wonder if the Belgians have solved the fossil fuel problem and are able to run their cars on water or air.

Many is the time that I've travelled the road from Calais, past Brussels and Leige and Aachen to drive to German destinations. But until last night, I had never actually stopped more than a very short while at any of them, let alone ventured a few miles off to places like Brugges. But what a gem - a town that's centuries old and of great character. Lovely canals, magnificent buildings. After sunset is not the bet time to try to capture a place on photos, but I had a go; I hope to show you some of those, and other pictures taken earlier in the long evenings, in the next few days. Daytime pictures? Sorry - as ever, I'm here to give a course as you've probably guessed!

Posted by gje at 06:20 AM | Comments (0)

June 12, 2007

Commenting a Perl Regular Expression

The x modifier on the end of a Perl regular expression causes all spaces in the regular expression to be treated as comments (rather than matching exactly). This means that you can lay out your regular expressions much more cleanly.

And wherever you're allowed white space, you can add comments from # to end of line. So the following code (for finding Belgian car registrations in a line of input) is valid:

while ($info = <>) {
        while ($info =~ /
                \b
                ([A-Z]{3})      # capture letters to $1
                -?
                (\d{3})         # capture digits to $2
                \b
                /gx             ) {
           print "Yes, $2, $1\n";
        }
        print "And that's your lot\n";
}

Note that you should NOT use the regular expression terminator (/ in our example) within the comments you add ... and if you REALLY want to match a space, you should now use \s for any space character or \x20 for a single space.

Posted by gje at 11:37 PM | Comments (0)


Useful link: Perl training

June 11, 2007

Where am I?

This might be quite easy (and there are some clues around ...)

Travelled yesterday (so it's NOT Wiltshire), checked in to a hotel, training nearby today.

Posted by gje at 06:03 AM | Comments (2)

June 10, 2007

Some progress on the train campaign

I try not to bore readers of this page TOO often with my tales of local train services (or the lack of them at appropriate times) here in Melksham. Whilst it's something that I am involved with in various ways, it's not really "Open source tips and techniques", nor friends and familiy life - having said which it's made us some great friends.

However, I write today with more optimism that I've had in an age as it seems like all the key players - Depratment for Transport, First Great Western, and Wiltshire County Council have moved on from the original "tough - it won't be changed and you won't have the service that's needed" approach based on outdated statistics and demonstrably incorrect projections of them. We're now in a position where everyone says that it's going to be hard to sort the issue but there's a real chance of starting with some good steps this December. And they're all putting effort and goodwill into making it happen To all those parties, thank you. To everyone who's helped support - thank you. I WILL still be calling for further support as the service returns, and we need to make sure that people know about it and so use it. Not only REGAIN, but RETAIN.

What gives me that optimism? Here a dozen, plus, updates

1. After the Save the Train meeting in March, the County Council has agreed to set up an 'experts / professionals' group to push the service provision issue ahead, and this will be chaired by Fleur de Rhe Philipe. I also have a positive letter from Dr Keith Robinson, the chief executive, who I met in person recently.

2. The Department for Transport are now looking very seriously at improving the service - I spent well over an hour on the phone with one of the top civil servants, and I understand that he and several colleagues have had further long meetings with the local transport authority. The answer that *I* got (and the concensus) is no longer to tell me that the current service is appropriate, but to acknowledge that it's not working and needs major positive amendment.

3. At the AGM of the Melksham Rail Development Group (yesterday evening), Andrew Griffiths of First Great Western told that FGW have no extra resources to make available from this December, BUT they have worked up a draft timetable that would take out 3 duplicated trains south of Salisbury (the Southampton stoppers that would, if they remained, double up on the new SWT local service) and use those trains instead to run from Salisbury up to Swindon and back. I've not seen details, but I understand it looks excellent for the morning, and unravels a bit later in the day. Andrew confirmed crew shortages - that even if they hired another train, they would not have the drivers, who it takes a year to train. Andrew also confirmed that extra freight is using the line via Melksham, and that this could start to limit available paths for passenger trains

[[Aside - I applaud First in pushing this timetable forward, the DfT in their new and serious look, and the County for their actions and help too. All acknowledge this as being a step in the right direction rather than a final solution - perhaps that will come at December 2008?]]

4. There have been discussions between the officers of the Melksham Railway Development Group and the Save the Train campaign, as the activities of the two could be seen to be converging. We're working in close co-operation (I have taken on the role of Vice Chairman at MRDG, confirmed at the AGM), and of course Peter Blackburn - chair of MRDG - is vice of Save the Train. The groups are, though, and will remain distinct. "Save the Train" is very much concerned with train service across Wiltshire and Mendip whereas the MRDG, as the name implies, is very much Melksham based and extends from the service to the envoirs of the station too.

5. The Melksham Railway Development Group has submitted a bid for lottery funding to complete the road from Spencer's Gate to the station in Melksham. This would provide a circular route via the station over land already reserved for the purpose and allow bus services such as Melksham' s town bus to connect with trains. It would also easier access to the station from North Melksham, and bring a restraurant and conveninence store within a short walk for traveller's use. The bid is via "The People's Millions" - an ITV show where the shortlisted bidders are showcased and the winner is selected by public vote.

6. Asda have announced that they plan to open a new store in Melksham, at West Country Farmers (that shop will remain, though). This offers a good opportunity to work with the store to provide rail access and facilities for the mutual benefit of their customers and railway users, and I understand that the company has a good reputation for being a community player.

7. A suggestion that we run a seaside special this summer from Swindon / Chippenham / Melksham to Weymouth - perhaps by extending the first Sunday train from Westbury - has been declared a non-starter by First who have no capacity for specials, even at the weekend. We are currently investigating whether we can arrange a coach for a part to join that train at Westbury, leaving from Melksham station and returning to there by train at the end of the day.

8. There is every intention of running a Santa special this December; although advised to plan well ahead and use the current service, we don't feel its practical on the limited trains available (21:38 is too late to get the kids back to Melksham, and what WOULD they do through the early evening?). So this will probably be a last minute planning job.

9. MRDG now has a website - www.mrdg.org.uk - and a subcommittee will be working on content and publicity. Key subjects will be the lottery bid, the station's history and other Melksham Specific issues.

10. I have JUST (in the last couple of hours!) booked a table for the two campaigns at Melksham's "Party in the Park" on 14th July. We'll have a 5m x 3m pitch ("a lot of space") to put the case; I'm happy to be on the stand all day (open from 2 p.m. to "fireworks") and would be delighted to have any other VOLUNTEERS - please - along ;-). Excellent chance for publicity. Other events are fastmoving at the moment; we'll see if we're selling seats to Weymouth, congratulating the decision makers and publicising the new services to come, or handing people postcards to lobby with!

11. Sion has agreed (I think - you did agree, didn't you Sion?) to join the committee of the West Wilts Rail Users Group in order that they have a continuing voice / input from Melksham. I was delighted to see their new Chairman, John Ingram, along at yesterday's meeting - we're all pushing very much in the same direction.

12. Wiltshire County Council have provided extra subsidy / support to Stagecoach for the X49 bus service (Trowbridge to Swindon) which last year carried roughly the same number of passengers as used the train (WCC press release figures for bus, FGW's for train). It is good to see the county's acknowledgement of the importance and growth of this corridor. The bus takes 95 minutes and serves neither Melksham nor Chippenham; the train takes just 35 minutes. I applaud the County's decision - it should make a decision to support the train too into a no-brainer. Although the support for a train seat is said to cost three times what it costs to support a bus seat, the train is 3 times faster so that makes it a level playing field, doesn't it?

13. Some fares (including Melksham - Chippenham and Melksham - Swindon) have recently been LOWERED. This means that a Chippenham to Melksham single is now just 2.80. The lowest return fare offered to London if you book on the day / train remains 105.00. For booking ahead, the FGW site lists 20 different single fares - most of them "book ahead" and with very limited availability. These tickets must be posted (extra charge) or collected ahead of time from a ticket machine at Chippenham (or other more distant) station.

14. Melksham's Tourist Information Centre has put in a lottery bid to become a transport hub - allowing it to sell a wide variety of travel tickets (rail tickets too - PLEASE - including the "book ahead" ones I have just mentioned.

Posted by gje at 08:28 AM | Comments (0)

Melksham businesses - networking together

[[An Advertorial - is that the term - for our Speed Networking evening.]]

Melksham is a bustling town, and you can find almost any products and services you need if only you know where to look and who to speak too. And what better than to buy local - support the local economy, and get local support from your neighbourhood business?

We're hosting a BUSINESS to BUSINESS speed networking event at Well House Manor (48 Spa Road), starting at 6:15 on Thursday, 28th June where each business gets five minutes to meet each of 19 other businesses. It's all about making contacts on the evening - a chance to establlsh a first link to those other professionals in town who you may need to reach at some stage in the future, or indeed who you might have a desparate need for next week.

The event is hosted by Well House Consultants, who have provided specialised computer programming training in the town since 2000, bringing visitors from all over the world to learn languages such as Perl, Python and PHP. We're just an example of the sort of business that you might have not known even existed ... you might need advise on online ordering or booking systems written in these languages ... and we're right here!

We're limiting attendance to the SN12 postcode area, and to one place at the table per company - there's a 15 pound charge to cover our costs including a light buffet supper. If you have two delegates who want to meet up with people as a pair, that's fine (but the limit) at 20 pounds.

More information? See Speed Networking Flyer or email Christine Sivier



Update - 22nd June 2007 We're now fully booked for Thursday, 28th June, but will run another event in the Autumn (Tuesday 16th October 2007) for another group of up to 20 Melksham businesses. It won't be the same old faces each time either, as we'll only be taking a maximum of 5 "repeat" bookings, and (for events further in the future) no-one three times in sucession

Posted by gje at 07:08 AM | Comments (0)

June 09, 2007

Melksham Art Cafe

Melksham Art Cafe opened its doors in the Market Place (attached to the Town Hall) a week or two back, and if providing "coffee shop" style service and a selection of vegetarian lunches (Open 10 to 4:30, Monday to Saturday)

On the week's course just gone, our delegates preferred a light lunch and we visited a number of places including the Cornertone Cafe, the Art Cafe, Ashers, and we went out of town one day to the Three Magpies at Seend. Each was a great success; See here for pictures and other information on all of them (and a couple of other places too!)

Posted by gje at 09:02 AM | Comments (0)

Perl - functions for directory handling

Perl has many built in functions for file and directory handling and you should use them in preference to shelling out in your scripts because:

• They work across operating systems (at least as far as is practical)

• They are much more efficient as there's no extra processes being started and stopped all the time.

I've added a source code sample to our web site which shows some of these in use ...

cwd to find out where you are
chdir to change your current directory
-d to check is a symbol is a directory
opendir and readdir to read through a directory's content

Sample output:

earth-wind-and-fire:~ grahamellis$ perl chdirddemo
We are in /Users/grahamellis
We are now in /Users/grahamellis/jun07
Directory entry count: 24
We are now in /Users/grahamellis
Directory entry count: 390
earth-wind-and-fire:~ grahamellis$

Posted by gje at 07:48 AM | Comments (0)


Useful link: Perl training

Object Relation Mapping (ORM)

Another technical term? Yes - this one is a formal name for how you convert a database into Objects - applicable to any OO language (Perl, Python, PHP, Java ...)

Let's reduce it to basics.

* SQL Tables become object classes
* Table rows each become individual objects
* Individual columns become attributes.

OK - perhaps you've been doing it for years .... I know I have, though not so formalised. It's nice to have a buzzword now to impress people with! But there's more to it than that.

By writing code to formalise the conversion of data held in databases to objects, you can add a layer of abstraction and move the need to write SQL code within your application our to a separate module - very possibly a module that's already been written and placed on the CPAN or in the Cheeseshop or PEAR.

In Perl, there have been a number of ORM modules placed on the CPAN; the current "flavour of the month" is DBIx::Class. A year or two back, it was Class::DBI, which you'll still find in use on some legacy applications. Both DBIx::Class and Class::DBI rely on Tim Bunce's DBI module internally, so they can be used with the same wide variety of databases that DBI/DBD supports.


When you map a table onto a class, you'll note that your code repeats the definition of the column names in the Perl code (or Perl configuration file if you're being really good). But the programming axiom is "don't repeat anything" and if you're feeling REALLY clever, you can use DBIx::Class::Schema::Loader to pick it up from the database - as the cost of a little inefficiency in that the extra database enquiry is made every time you run your Perl. And THAT inefficiency can be prevented with dump_to_dir.

Posted by gje at 07:17 AM | Comments (0)

June 08, 2007

Asda opening large new store in Melksham

Breaking News in Melksham is that Asda, the supermarket chain, is looking to build a large supermarket with 28000 square feet, 250 parking spaces and create 300 jobs on the outskirts of the town at "West Country Farmers" near the railway. Currently, we have a smaller Sainsbury's and a Somerfield in the town itself; the nearest big out of town supermarkets being at Chippenham and Trowbridge.

A Committee of the Melksham Chamber of Commerce met here at Well House Manor yesterday evening, and the subject came up. The chairman wondered at my sources as he thought he was breaking the news ;-). However, we [Lisa and I] did then learn how the Chamber supported Leekes when they brought their out of town store to Melksham, and how the local retailers objected strongly and set up their own organisation to take the opposite view. So the new supermarket may cause a few ripples, and any viewpoint I take could make me less than popular in some quarters.

I'm very much in favour (personal view; I do not speak for the chamber). We need a good, easily accessible, large supermarket and I don't see it pulling too much business out of the town. With the exception of Sainsburys (and Somerfield, who have had an offer made to them for their place anyway, I am told) there are no direct competitors in town and the banks, hairdressers, antique shops, takeaways, restaurants, pubs, chemists, optitians, and other specialist shops really have little to fear.

With planned population growth from 24000 to 32000 in the next 20 years, such a store is well justified. There IS a need for expanded local shopping rather than the 7 mile trek by car to Trowbridge or Chippenham. The location very close to the railway station also encourages me, as it allows a true transport hub to be in that area of town, with the town bus and perhaps other services calling as Leekes, Spencer Gate shops, Melksham Station, and Asda each 30 minutes.

Posted by gje at 08:11 AM | Comments (0)

Perl, the substitute operator s

In Perl, the s (or substitute) operator allows you to match a regular expression and replace the part of your incoming string that matched with another string. Your incoming string should be specified to the left of an =~ operator and is changed in situ. For example:

$sample = "The cat sat on the mat";
$sample =~ s/.at/dog/;

Would replace cat (as "." means any character) with dog. It would stop at that point, as the s operator only changes a single occurence unless a g for global modifier is added on the end. So

$sample = "The cat sat on the mat";
$sample =~ s/.at/dog/g;

Would give you The dog dog on the dog

• if you don't specify the variable that s is to work on, it works on the contents of $_

• if you add an e modifier, it performs the output string as a perl expression and substitues in the result.

• if you specify $1 or \1 in the output string, you'll mean the first captured part of the incoming string that matched, and so on.

• if you use the value returned by the substitute operator, you'll find that it contains the number of changes made.

There's an example of all of these features just added to our web site here

Posted by gje at 07:02 AM | Comments (0)


Useful link: Perl training

June 07, 2007

Bathtubs and pecking birds

I have learnt of something called the "bathtub" effect in the last year or two. A complex new product has a teething period during which support requirements are high. The requirement drops away (like - into a bathtub) as the product gets more mature, but then the curve rises again as the product becomes lief expired. In other words, maintenance is lowest midlife. It happens that this was taught to me about railway trains, but I see it elsewhere too.

A program can be written in a very longwinded way. We see that especially in a language like Perl, as written by newcomers converting from C who use few of the extra facilities and end up with a huge piece of code that's hard to maintain - "can't see the wood for the trees". It's sensible to shorten the code and use some of the new facilities - into the bathtub of less support - but then the code can end up getting so short that it's obtuse. Up goes the support aspect. Look at your code and see where in the bathtub it lies!

The "pecking bird" is one of those water fed ornaments in which water drops into a container at one end of a balance. When the water holder gets full, the balance tips over and the water empties, so that the balance goes back for the next cycle. Translated into code? Let's say you want to print out 4 values per line - pour them into a Perl list using push, and have a print statement that tips them out and clears the list when there are the 4 values in there. The Pecking Bird algorithm!

Posted by gje at 08:43 AM | Comments (0)

June 06, 2007

for loop - how it works (Perl, PHP, Java, C, etc)

When writing a program, you'll often want to repeat a block of code, counting up through a table or performing a block of code with an input value (loop counter) that goes up 1, 2, 3, 4 etc.

You COULD do this using a while loop, but this means you have to specify each of
• how to start (initialise) the loop counter
• how to test the loop counter to see if it's completed
• how to alter the loop counter each time round
and to do each of these separately means that the maintainer of the code is going to have to look in three places at once to work out what's going on.

Most languages have a for loop construct which pulls all three elements into one statement, for example:
  for ($k=0; $k<25; $k++) {
which means START at zero, REPEAT the loop while $k is less that 25 and before EACH SUBSEQUENT test and loop add 1 to $k.

Here's a diagram to show how that works

The GREEN shows the initial entry to the loop, where the initial value is set and then the condition is tested.

The ORANGE shows each subsequent time round the loop, where the last clause (the increment) is performed before the condition is retested

and the RED shows how the loop exits once the condition has gone false. You'll note that a for loop CAN exit straight away, since the test is done on entry as well as each time the last clause has been run.

Posted by gje at 10:02 AM | Comments (0)


Useful links: Perl training, PHP training, Java training

Judging the quality of contributed Perl code

So you're going to download a module from Perl's CPAN. Good - you've learnt the first rule which is to re-use code that someone else has written, and NOT write your own. But then you have another conundrum - which of the dozens of modules that look as if they should be suitable should you download - which are reliable and of good quality, and which are, frankly, naff?

You can't measure "Quality". Can't put an objective number on it to rank modules. But you CAN monitor features that you'll find in well written and well maintained modules and measure those, and such a measure will be an INDICATION that a module is likely to be to a high standard. That's been christened Kwalitee - sounds like quality, but not quite the same! You'll be interested in CPANTS - The Comprehensive Perl Archive Network Testing Service.

The CPANTS service at http://cpants.perl.org is a testing service which uses automatic criteria to rank CPAN modules. The presence (or otherwise) or readme files, manifests, configuration files, etc is one of the criteria used. Then the presence of tests, a versioning system, POD documentation (for ALL the methods, please!) and POD that compile properly too is measures. A module is scored better if it has "use strict;", and it's also scored higher if it's a prerequisite of someone else's module.

If you're a CPAN contributor, you can of course write your code to get a high Kwalitee rating without it being high quality - that's rather like cheating the rankings for a search engine - and you can even use the Test::Kwalitee module that lets you check out your ranking before you submit. I probably shouldn't even tell you about the guy who has a CPAN module who will, at a price, declare your module as something that his depends on ...

Posted by gje at 07:21 AM | Comments (0)


Useful link: Perl training

June 05, 2007

Sunday afternoon


Sunday Afternoon, and an "airport run" to pick up delegates for this week's course. And we took a rare (at the moment) opportunity to leave a couple of hours early and drive around, taking in the East Somerset Railway at Cranmore. [more pictures]

Posted by gje at 08:35 AM | Comments (0)

June 04, 2007

What are factory and singleton classes?

Do you find some of the OO terminolgy baffling? Once you've learnt about constructors and methods, inheritance, overloading and polymorphism and statics, you might think you're there. Then someone mentions a "factory class" or a "singleton" ...

Fear not - factory and singleton classes are posh names for something you would naturally write anyway, applied to certain techniques so that they can be described in OO design texts, project specifications, and articles such as this.

A SINGLETON is a class for which only one object member ever exists; you can create a class that's a singleton by writing the constructor so that it returns a truely fresh object the first time you call it, and a reference to the same object should you call it again. We have an example (in Python, but it applies to any language in principle) here

A FACTORY is a class who's constructor returns an object which might be in one of several different classes, not necessarily including the class in which it is, in theory, the contsructor. I could, for example, have a base class called "accom" for accommodation, subclassed to "hotel" and "campsite". If calls to the "accom" constructor return a hotel or a campsite (depending on constructor parameters), then that accom class is a factory. We have an example of a factory (in PHP, but it applies to any language in principle) here. There's also an exanple in Perl ... the class containing the factory method is available here, sample code that calls it here and the other class that may be built here

Posted by gje at 05:59 PM | Comments (0)

June 03, 2007

Five of the best - pictures from London

My day in London yesterday ... and I have returned with so much technical information and so many picture I don't know where to start and which to leave out. Here are some pictures ... with links to more pages of similar if you like them. Technical stuff to follow in the next few days!


The Notting Hill and Holland Park area


Travelling First Class - a rare opportunity at a bargain price for once.


Paddington Station - beautiful architecture where it's hard to take a bad picture.


White City


Hyde Park and Kensington Gardens

Posted by gje at 12:00 PM | Comments (0)

An update on Perl - where is it going?

I need to update myself from time to time; web sites, magazine, books, delegates, technical friends and customer requests are all part of the equation; the final part is attending the - occasional and strategically chosen - high level conference or teaching session given by the specialists - the people who each know one specific technology inside out, usually to the exclusion of appropriate alternatives. And so it was I found myself yesterday at Dave Cross's London Perl Mongers teach-in, hosted by the BBC in White City. Dave styled the day as "turning Intermediate programmers into advanced ones" and notes (correctly) that it was a very tall target for six hours which included a lunch and two other breaks.

Dave DID teach me one or two (OK - let's be fair - one or two dozen) things during the day. But also gave me, as a long time Perl user and tutor, an insight as to where and how the use of the language has developed and is going. What did I notice and pick up "Management overview" mode.

• There was no - not a bit - of teaching of the Perl LANGUAGE as such; the majority - the vast majority - of the time was spent on covering modules, modules on the CPAN, and CPAN facilities. And the other - minority but significance of time - was spent looking at quality (or should I say Kwalitee, Dave?) of code / modules, and techniques, technologies and buzzwords in OO design, configuration file use, and the like.

• All day, there was only a single brief reference to Perl 6 - and that was Dave's comment that he really hasn't looked at anything Perl 6 in a while. There were more references - far more references - to Rails and Ruby which I think he views as an upcoming and perhaps significant force. And a couple of references to PHP, "put down" a little in the way that seems to have become traditional for the Perl Uber-Geeks.

• A few days ago, I asked "is Perl dying out" in this column, and produced data showing, strongly, that this is not the case. Dave produced a similar, strong, case (based on job vacancies) to show that it's live and kicking; there are more Perl jobs than advanced Perl programmers out there - so there's still very much a case for our Perl courses - the next one starts tomorrow - and for occasional more advanced lectures such as this one.

Dave, Thank You for setting up and providing the day, and thank you to the BBC for hosting it. I know I found it very useful, and that all the others of the three dozen or so attendees that I spoke to did so too.

Posted by gje at 08:06 AM | Comments (0)


Useful link: Perl training

June 02, 2007

New Serieses for the summer on TV

On Wednesday evening I watched a succession of exotic females entering the "Big Brother" house and I have that sinking feeling that I'm looking forward to a summer of hearing, from all and sundry sources, about the latest antics of Charley and Chanelle, and or Sam and Shabnam. There's something abou that show that - really, I can't stand. What's the point? No doubt we're in for a series of ever more headling-grabbing antics, humiliation of contestants (who, it should be noted, know roughly what they're letting themselves in for), and hours of pictures of non-people sitting around and yakking.

On Thurday evening, something of a different nature? A series of interesting birds being filmed 24 x 7, with the presenters telling us about the antics in Islay and in the Heligon House. We've got viciousness, squabbling and some truely charming moments too. Presenters (who, it should be noted know roughly what they're letting themselves in for) doing very silly things, and a pictures of people sitting around and yakking at the camera.

Until this week, I hadn't realised just how similar "Springwatch" and "Big Brother" actually are!

Posted by gje at 06:11 AM | Comments (1)

June 01, 2007

MySQL - the order of clauses and the order of actions

You specify your select command in the following order:
1. The columns you want to choose (SELECT)
2. Where you want to send the results (INTO)
3. The tables that contain the data (FROM)
4. How you want to connect those tables (JOIN, ON)
5. Which individual rows you want to choose (WHERE)
6. Bunching of individual rows together (GROUP)
7. Which bunches you want to choose (HAVING)
8. How to sort the records (ORDER)
9. How many output records you want (LIMIT)

The order that MySQL performs these tasks is as follows:
1. Joining the tables
2. Selecting individual records
3. Sorting the records
4. Bunching
5. Selecting bunches
6. How many output records you want
7. Choosing the columns to display

Here's an example that shows some of the less common clauses in use:

drop table if exists calltimes;
drop table if exists townnames;
create table calltimes (
  cid int primary key not null auto_increment,
  pcode text,
  calls text);
create table townnames (
  tid int primary key not null auto_increment,
  pcode text,
  fullname text);
insert into calltimes values
  (1, "MKM", "06:44"),
  (2, "MKM", "07:17"),
  (3, "MKM", "19:08"),
  (4, "MKM", "19:50"),
  (7, "CPM", "16:25"),
  (5, "CPM", "16:55"),
  (6, "CPM", "17:25"),
  (8, "TRO", "23:42"),
  (9, "PNG", "15:10");
insert into townnames values
  (1, "MKM", "Melksham"),
  (2, "CPM", "Chippenham"),
  (3, "BTH", "Bath");
select calltimes.pcode, townnames.fullname, count(cid)
  from calltimes left join townnames
  on calltimes.pcode = townnames.pcode
  group by calltimes.pcode
  order by fullname;

And the results:

+-------+------------+------------+
| pcode | fullname | count(cid) |
+-------+------------+------------+
| TRO | NULL | 1 |
| PNG | NULL | 1 |
| CPM | Chippenham | 3 |
| MKM | Melksham | 4 |
+-------+------------+------------+

Posted by gje at 05:45 PM | Comments (0)

What brought YOU to our web site?

10 times a day, someone arrives at our main (www.wellho.net) web site for each and every one of the terms in this table. This is an analysis of the search terms used in the 28 days up to yesterday, with the number of occurrences listed against each word.

We often ask ourselves questions such as "Is Perl dying back, and if so what is replacing it?" and "should we be taking a closer look at Lua or emphasising Ruby more on our web site?". And reports such as this - extracted using our web log analysis tools - give us some measurement of an answer; not a complete answer as these reports are highly biased by our site content, but they do give us a drift and - when compared to similar reports from a year ago - give a much clearer drift.

35339: perl
34349: php
28657: mysql
26303: in
24718: java
20675: python
15507: to
14136: join
12116: file
11632: example
10405: tcl
7702: array
7665: left
7344: a
6538: of
5417: from
5262: how
5131: expect
5043: string
4937: script
4814: for
4746: using
4699: image
4628: and
4432: database
4405: examples
4323: c
3799: regular
3564: upload
3490: with
3404: tomcat
3334: variable
3284: sample
3189: variables
3139: ruby
3060: inner
3036: hashmap
2991: text
2963: page
2770: linux
2668: table
2656: files
2580: outer
2538: expression
2451: regex
2430: the
2416: line
2331: code
2232: html
2227: on
2224: form
2203: data
2197: read
2090: remove
1984: is
1941: command
1932: input
1926: arraylist
1905: list
1878: tables
1864: into
1845: web
1729: loop
1713: sql
1709: passing
1697: images
1668: handling
1643: apache
1619: select
1550: program
1545: output
1517: character
1510: url
1488: shell
1486: date
1478: if
1463: tk
1456: regexp
1448: multiple
1438: telnet
1434: ftp
1427: expressions
1418: two
1418: save
1417: programming
1413: tuple
1373: sort
1354: check
1354: objects
1353: insert
1334: replace
1318: global
1297: windows
1285: dictionary
1284: query
1264: arrays
1252: store
1245: case
1229: server
1223: stringtokenizer
1222: get
1218: decimal
1206: unix
1186: class
1160: right
1157: time
1147: dimensional
1146: what
1120: thread
1104: number
1088: cgi
1083: joins
1068: unique
1046: printf
1044: function
1038: an
1037: last
1031: write
1007: reading
988: grep
964: use
962: object
953: search
952: id
949: process
921: pdf
915: convert
912: redirect
911: by
911: new
907: 2
902: vector
895: exists
889: user
886: javascript
883: find
872: training
861: application
855: picture
853: loops
849: map
846: another
842: pass
839: match
833: refresh
824: button
821: lines
817: resource
815: display
807: numeric
795: excel
791: ssh
789: open
788: load
784: commands
777: error
774: threads
760: hash
754: ping
751: count
748: oracle
742: directory
735: format
722: split
720: jsp
713: stdout
711: bash
709: delete
709: blob
706: writing
701: system
701: source
700: stderr
695: spawn
694: switch
690: session
688: link
687: hex
686: xml
686: pictures
681: module
674: characters
671: difference
670: pivot
667: environment
666: download
665: or
659: print
659: wiltshire
658: create
656: between
655: word
651: 2d
632: value
631: test
623: $_
623: copy
622: keyboard
620: run
606: values
601: running
598: not
591: lists
590: seconds
590: email
588: double
583: functions
581: course
580: programs
579: places
577: substring
576: language
576: reference
575: gui
573: frames
572: melksham
569: tcl/tk
569: call
563: change
563: operator
558: compare
552: quiz
548: csv
548: simple
546: binary
544: servlet
543: send
540: uploading
540: sorting
539: egrep
532: newline
529: set
524: undefined
521: header
520: interface
520: xrange
517: hashset
507: as
507: one
507: return
507: scripts
506: add
503: dynamic
502: size
501: through
498: char
497: where
495: submit
495: smtp
485: retrieve
484: calendar
481: while
479: php.ini
475: cannot
475: socket
469: null
468: else
466: update
462: access
460: numbers
455: codes
454: rename
447: bless
440: foreign
438: information
438: space
437: column
437: parameters
431: php5
429: classes
429: scope
425: shopping
424: cart
423: formatting
423: key
423: name
416: do
416: stdin
413: php4
405: statement
405: sensitive
404: #3
401: threading
399: strings
397: generator
395: log
391: mail
390: x
387: duplicate
386: three
385: os
383: install
382: &
382: 3
375: @_
375: buffer
373: words
372: ip
371: current
369: inheritance
369: destructor
368: net
367: all
367: indexof
362: exist
361: removing
357: connect
355: many
354: courses
352: mac
349: website
348: grab
347: keys
346: raw
345: different
345: quotes
344: bristol
343: advantages
343: blank
343: multiline
342: storing
342: comparator
341: asp
341: house
340: polymorphism
339: foreach
338: relational
337: minutes
336: calling
335: comparison
332: problem
330: port
328: password
328: expect_out
328: substitute
322: extract
321: hashes
321: show
318: modify
316: tutorial
315: large
311: out
311: strreplace
311: random
309: uk
309: execute
309: first
304: xp
301: ant
297: syntax
297: index
296: mysqli
294: posix
290: conditional
287: cookie
285: forms
285: method
283: external
282: i
281: learn
280: balancing
280: client

And what did people search for, but just less than 10 times a day? Here are some of the words that didn't quite make our top table.

278: field
277: proxy
277: multidimensional
277: post
275: spaces
275: within
272: content
270: end
270: math
270: deployment
269: london
268: solaris
267: break
267: conversion
266: control
265: sudoku
264: samples
264: fork
263: creating
261: qt
261: recursion
261: css
261: hotel
261: special
260: getting
259: tokenizer
259: duplicates
259: mysql_pconnect
257: trowbridge
257: parse
256: ascii
256: increment
255: coding
255: oriented
253: matching
252: nested
252: login

Posted by gje at 06:18 AM | Comments (0)