« September 2006 | Main | November 2006 »

October 31, 2006

Helping the miles pass

I left home at 13:45 on Sunday to get up to Inverness - estimated at 500 miles away - for an 08:30 setup and 09:30 course start on Monday morning. I always drive on such trips even though a plane would be quicker and a train would be less tiring; that's because I take equipment for each of my eight (in this case) delegates to use through the course, plus books, server, projector, my own system - not to mention a couple of changes of clothes.

For such a long drive, I pace myself; a series of little stops along the way severely adds to the time taken, but (and I stress this) I am aware that I'll start to get tired at certain points and I take a break. Always on the lookout for future timing and route knowledge information, I tend to log even the journey ...

Home, 13:45, 58647 miles ...
The "Air Balloon", 58690, 14:45
Strensham services, 58710, 15:00 - 15:05
etc
Tebay services, 58904, 18:07 - 18:30
M73 / M8 interchange, Glasgow 59029 20:13
Perth, 59084, 21:04

(OK - I've cut out an hourly note or so from that ... but it was a good evening with only a few traffic delays around Birmingham and I'm much better able to time the North of Scotland run now.)

The radio is on in the car too as I travel - I'm somewhat caught up on events in Ambridge, and I listen to the controversy of the current story line discussed on other programs. Is Ruth acting out of character? What would David have done if he had been pulled more heavily towards an affair with Sophie? Is Bert going to be alright after spending 5 hours on a wet tractor to win the ploughing competiton?

And early morning

Perth, 59084, 05:45
Dalnaspidal, 59141, 06:45
Slochd Summit, 59180, 07:24
Inverness, 59200, 07:47

"Two hours from Perth to Inverness" said a Scot on last week's course and indeed he was pretty accurate, but I'm glad I left that final stretch to the new morning - the A9 has hugely improved over the years and it no longer passes through any towns ... but there are long single carriageway stretches and some double sections and you need to have your wits about you!

Picture - Inverness at Dawn yesterday morning

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

More about Graham Ellis of Well House Consultants

October 30, 2006

Python is like a narrowboat

I'm giving a Python course today, to a team of seasoned programmers, and of course I'm coming up with a few things that are different to the languages they know. So far, we've had ...

* No switch statement
* No ++ operator
* blocks indicated via insets
* else clauses on while loops

Of course, this makes them a little nervous, although it will turn out later on that the facilities that aren't present wouldn't be at all vital in Python, and indeed they may encourage poor coding practise. And block insets and extra "elses" are so natural once people are use to that way of doing things.

But people still aren't always convinced. "What do you drive?" I ask them. "A Ford" they say (or something else). "If you switched to a Vauxhall, would it be easy?" I ask. "Not neccessarily - things will be in different places ..." is the answer but, yes, they would get used to the Vauxhall positioning in time.

Actually, Python can be very different. I used to drive a narrowboat quite regularly, and that's the complete opposite of driving a car - push the tiller to the right to go left for starters, and then remember that the boat takes a while to react as you're not controlling types straight onto the ground, but rather you're changing the direction via the water. Ah - but once you've driven a boat a few times you find there's a great natural beauty in it, and in the way it works. 8 tons can be controlled by just a gentle push with a single finger - much more efficient even that your car. Yes, that's a good desription of the beauty and effiency of Python too - Python is like a narrowboat.

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


Useful link: Python training

October 29, 2006

And so to Inverness

A short and hurried blog at the end of a Sunday morning with fascinating breakfast guests - talking about the development of HTML, and the history of the Web, with a couple of the movers and shakers behind it. Part of me is sorely tempted to quote stories but, no, I won't. I've too much respect for the privacy of the people ... just amazed (and I shouldn't be) to find them living about 5 miles from us.

It's left me short on time - the inevitable thousand things to do before I head off for the far North of Scotland - a course starts in Inverness tomorrow morning and I'll be driving up that way for the next half of the day, completing the run across the Highlands early tomorrow morning. PHP books, packed; Python books, packed.

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

October 28, 2006

Browser -> httpd -> Tomcat -> MySQL. Restarting.

I've just completed a course covering the installation and configuration of Apache httpd, Apache Tomcat and MySQL. Complete with a demonstration that has the newly installed systems visited from various browsers, talking to httpd, which talks on to Tomcat, which talks on in turn to MySQL. The MySQL responses are handled by the Servlets and JSPs running on Tomcat, and returned via the masking Apache httpd that's used for the majority of the web site on the chosen domain. This might all sound very complicated, but it's actually what happens on so many web sites which, no doubt, is why there's such a call for our deployment course.

And what happens when the server is restarted? Well - you had better make sure that all the services start up properly, hadn't you?

On a Linux / Unix system, you can add scripts that are to be run during system startup, typically to start server processes known as daemons, to the directory /etc/init.d. These scripts should understand (as a minium) a command line parameter "start" to do everything needed to start the service, and "stop" to do everything needed to stop the service. And it's no co-incicence that modern versions of apache httpd ship with a utility called apachectl that accepts these argument, apache tomcat ships with catalina.sh which also accepts these parameters, and there'a a utility script in mysql's script directory that does the same thing for that daemon.

So it that all you need to know? Not quite! Just placing the scripts into /etc/init.d does NOT cause them to be run; on system startup, when entering full multi-user mode (run state 3) or multiuser mode with windows (run state 5), Linux / unix go through the directory /etc/rc3.d (or rc5.d, or /etc/init.d/rc3.d etc ... depending on the Linux flavour) and run every file starting with the letter S in asciibetic order. Now - you do not want to copy the scripts from init.d to those other directories so the whole thing is set up by filling the "rc" directories with a series of symbolic links back to /etc/init.d. That way, you can turn daemons on and off just by adding and removing links - a very neat scheme indeed.

Here's an example of such a link in /etc/init.d/rc3.d (on a SuSE system)

lrwxrwxrwx 1 root root 10 2006-10-27 14:38 S19apache2 -> ../apache2

and that could be set up by a command such as

ln -s ../apache2 apache2

of using the chkconfig utility that's provided to help with tasks such as this ... but that's an extended story for another day!

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

October 27, 2006

A commitment we won't be making

Last night, Lisa and I went to an introductory meeting arranged by a local group, clearly looking to increase their membership - "Come and meet us and see who we are". They're a group with laudible aims, but somehow I found myself comparing their approach and technique to a time-share sale session (not that I've even been to one of those). I appreciated, really, knowing more about the group - I can now tell you that they have a worldwide organisation based in a tower block in xxxxxxx, a UK headquarters in yyyyyy, groups in our area in zzzzz and aaaaaaa, and that they specialise in fund raising for charity projects with supported examples including vvvvvvvvvv and wwwwwwwwwww. I personally felt that a president's introduction and an illustrated presentation was a reasonable level of information provision - could have done without some of the harder sell later on. And I do think they made a mistake by telling us that they had found us by buying the mailing list of a local business group's members so that they had material for their recruitment drive.

Membership isn't for us - or rather, it isn't for me. I was invited, with "and partner", and we both went. But it turns out that the group is all-male in Melksham; rules were relaxed a few years back to allow women to join, but in our area that's not happened. I wonder why - could it, perhaps, be because their very approach was to me and that Lisa was treated as an honoured and respected guest, yes, though the evening - but also as something of a fringe attendee. Apparently, the ladies of members are invited to attend alternate meetings.

Charity fund raising worries me in that I'm not always sure that the money raised reaches where the donor's told and intended. Too much gets lost in admin costs along the way, too much gets diverted to other projects / locations (some genuine) that really weren't part of the original plan, some gets used to fund projects that should be funded by government or employers (see the seepage of lottery funds in this country to projects that would have been government funded in the past), and some simply gets lost in greed, corruption and mis-management along the way. Sadly, that can even happen locally - we were tempted to help out with a 600 pound 'need' locally a year or two back but, frankly, got scared off when the fund needed rose to 1200 pounds then to 2000 pounds without any explanation. "This is a good way to make money - let's milk it" perhaps???

Neither can I commit to a further 2 evenings a month (they "only" meet fortnightly) with an annusal fee in three figures and a cost of each meeting in two. I wondered what proportion of that is syphoned off by central admin. Oh - and 60% attendance is required by the constitution. As a club for retired gentlemen, who have plenty of spare time to socialise and go round with buckets asking people to give money, it works - clearly, it works as they have bbbbbbbbbb members worldwide. But I'm at the opposite end of time management, looking to find how I can make better use of what little I have.

Lisa and I decided it was a "no" in the car on the way home - actually, I think we had both concluded the same thing before we left. I've sent a thank you and good wishes to the group. Both wishes are genuine; it was indeed a fascinating evening, and may they be long lived and successful. But it's just not our style.

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

October 26, 2006

Not proud to be British

I'm proud to be British. Correction - I'm usually proud to be British, but there are times that I squirm with embarrasment at what we do to visitors to our country.

Last night (or, rather, early this morning) I was up at Chippenham Station meeting 3 people off the train due in at 00:56 - they had flown into the UK in the evening and made their way from Stanstead, rebooking tickets for each leg of the journey as they went. And they were in a state of some shock as the said that they hadn't realised it would cost 200 pounds for them to get from Paddington to Chippenham.

I feel that they have been ripped off. And ripped off by a system that seems to be set up to maximise its income from those who don't know the tricks and techniques for getting a good fare. Looking at the same journey for the same time next week, the online booking service is telling me about no less that 27 different fares available for that single journey and, guess what, my delegates were charged the highest possible fare. With a premium of 1.1 billion pounds to be paid to the government, First Great Western has to maximise its income - but is this selling of overpriced tickets to vulnerable groups who know no better really a morally acceptable way of doing it? And is this the way to encourage the tourist business?

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

October 25, 2006

Of course I'll tell you by email

It's about the time that I should be writing the next issue of "Of Course" - our twice yearly newsletter about Open Source training, and the news from Melksham and our training centre. But there's so much happening - with Well House Manor opening earlier this month, and with an initial 3 months 'running in' period - that I want to write to people with an intermediate update too, before "Of Course" comes out fresh and early in the first days of 2007.

Noticing that many emails have switched from text only into full HTML with pictures these days, I've decided to go the same route - but how? Well - I've been looking into it and here are the steps I've taken:

* Draft the HTML page to be sent, in a table around 600 pixels wide, and ensuring that ALL links are fully qualified.

* Write a PHP script to send out the email (much the easiest email client to use!) ensuring that extra "from", and "reply-to" headers are included.

* Add an extra header - "Content-type: text/html" to the email headers.

My particular script is looping through a short file of email addresses and names, and filling in each recipients name before sending. Great care is being taken NOT to run the script twice, and to delete it from the URL it's hidden at as soon as it has been run - after all, I certainly don't want to risk spamming people.

If you want to see a copy of my letter, it's on the web site here

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

October 23, 2006

Pieces of Python

From a most interesting Saturday which was spent doing a one on one session on thread, wxPython, etc - some Python snippets that provide unusual demos and hard-to-find answers:

The Backtic operator evaluates an expression and returns the result as a string

val1 = 16
val2 = 18
result = "The result is "+`val1 + val2`
print result

If you want to have various bits of code running at the same time you can use piping, or you can use threads, or you can use a client / server system via TCP/IP.

We have an example of Python threading and a python tcp/ip client and a simple python server all available on this web site. Piping is especially useful if you're containing / running an outside process on your machine, threads are useful where you're processing the same type of data in parallel many times over, and a client / server architecture is ideally suited to a logger and display application, with a server logging and one or more client, perhaps on remote computers, displaying.

The wxPython module provides an excellent GUI - in other words an excellent way to provide a user interface on the front of your Python code. However, there's a lack of good worked learning examples. I've just added more source code examples - linkable from our wxPython training course module. These examples were originally based on other published code, but have been extensively rearranged for clarity and commented.

The super call only works on new style classes!.

If you try to use "super" on old syle classes, you'll be told "TypeError: super() argument 1 must be type, not instance".

Old style classes ...

# old style classes

class thing:
   def __init__(self):
      pass

class specialthing(thing):
   def __init__(self):
      thing.__init__(self)

this = specialthing()

New style classes ...

# new style classes

class thing(object):
   def __init__(self):
      pass

class specialthing(thing):
   def __init__(self):
      super(specialthing,self).__init__()

this = specialthing()

What are new style classes? .... they're classes that are derived, directly or indirectly, from built in classes and they've been around since Python 2.2. As well as super, other new features include the ability to define static and class methods, rather than just a method in the same namespace. more details (external link)

We offer Python training courses. If you've just one or two people to be trained, our public courses which run every 2 or 3 months are going to be best value. For slightly larger groups, we'll run a private course at our centre. With 6 or more delegates all wanting to learn the same material at the same time, we'll come to you - you just provide a room and the students, we do the rest!

Posted by gje at 04:13 AM | Comments (0)


Useful link: Python training

October 22, 2006

Brand new hotel and training centre, Melksham

Our first full week at Well House Manor - and what a week it was! The hotel opened for guests last week, and this week for our public courses. Initial reviews all excellent - "Accommodation excellent; I can't praise the organisation and course highly enough" writes one delegate.

If you've found this page in searching for a Melksham Hotel - yes, we're open for general business guests and small conferences as well as for our own courses. Our hotel number is 01225 709638 and my email is graham@wellho.net - I'll be happy to help you with bookings.

Update - a year later This is a diary entry that was written a year ago - please visit the Well House Manor web site for up to date pictures. We've moved forward hugely in the year and the pictured below look very bare indeed!


And let me show you some pictures ...


The approach and front door

Room 3 - a double room

Room 4 - a twin room

Bathroom - room 4

Freshly baked bread - Continental Breakfast

A training course in full swing

The Breakfast room

The Lounge

<advert>Well House Manor is about five minutes walk from the town centre of Melksham. We're set in 3/4 of an acre of grounds and have plenty of parking, and there's a regular bus service that stops right outside. All room are en suite, all rooms offer wired and wireless internet connection and feature large, flat screen TVs with some 40 channels available.</advert>. Remember - Well House Manor, Spa Road, Melksham - http://www.wellhousemanor.co.uk/

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

October 21, 2006

Python - listing out the contents of all variables

You can often guess which course I'm giving by the topic of the my daily writing ....

"How do I list out the contents of all variables with names starting v-a-r ... a question from yesterday.

The immediate answer:

# print all variables starting with "var"

sum = 9
var3 = 78
var6 = 99
varsity = 56
variable = "hello"

for name in dir():
 if name.startswith("var"):
  exec("print "+name)

A more thoughtful answer would be to suggest that you might have used a dictionary to store all this incoemtion, then you could simply use the keys method ....

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


Useful link: Python training

October 20, 2006

Python - function v method

What's the difference between a function and a method? A function is a named piece of code that performs an operation, and a method is a function with an extra parameter which is the object that it's to run on.

Example:

class hotel:
 def __init__(self,name,nightly):
  self.name = name
  self.nightly = nightly
 def getweekly(self):
  return 7 * self.nightly

def seventimes(amount):
 return 7 * amount

# -------------------------------

manor = hotel("Well House Manor",90)
beechfield = hotel("Beechfield",120)

# Calling a METHOD - a function on an object

ma_am = manor.getweekly()
be_am = beechfield.getweekly()

# calling a FUNCTION - less useful code as it
# does not give an implicit link to the data
# that it's on.

rz = seventimes(240)

print ma_am, be_am, rz

Posted by gje at 05:42 PM | Comments (1)


Useful link: Python training

Python - extend v append on a list

In Python, you can extend a list and you can append to it as well.

What's the difference? If you append a list to another list, you add the new list as a single extra list to the original, thus makingthe original list just one longer with an item that is itself a list. But if you extend a list with another list, you add each element of the new list onto the original. Here's an example to show you what I mean:

>>> first = [10,20,30]
>>> second = [40,50,60]
>>> first.append([70,80,90])
>>> second.extend([100,110,120])
>>> first
[10, 20, 30, [70, 80, 90]]
>>> second
[40, 50, 60, 100, 110, 120]
>>>

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


Useful link: Python training

October 19, 2006

Courses at Well House Manor

As from the start of this week, all of our public courses are running at Well House Manor.

Larger courses (that's up to a maximum of 7 on the public courses) run in "The Wilts" room giving all the delegates plenty of space. Smaller courses, private tuition, breakouts in "The Berks" for a more intimate course.

It's been a busy week - a VERY busy week - as you'll see from other diary entries. but the initial shakedown is impressive and it's very much a case of "one step better" here even on top of the excellent product that we've been providing at "404", just up the road, for the past six years.

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

October 18, 2006

Too much for the National Trust

Yesterday was the day that the National Trust with other organisations designated to be a typical day, and they encouraged everyone to write a blog to be archived for posterity to show typical life in October, 2006. Good idea, yes; I wrote mine, but came to find on submission that there's a 4k limit on post size; great shame to find that late in the day when I had writ 10k Perhaps my life is too much for the National Trust? Anyways ... I'll share some here!

On a typical day - 17th October 2006
I rose at somewhere between 03:00 and 03:30.
Gonna be another looooooong day.

My wife Lisa and I opened a business hotel to add to our open source training company last week and as always seems to happen, the builders were almost done at the right time but there are a few snags to work through yet. By 04:00 our (home) dishwasher was cleared, reloaded, running again and the first load of sparkling clean plates ready to go up the road.

Lisa was home late last night after a meeting to edit the Bowerhill Villager newsletter - I was asleep when she crept in and I didn't here her. A quick early email check even before the dishwasher was loaded included a copy of an email from [her] son Tyler in Florida, telling us that he's no longer living with his Dad but with his girlfriend, and they plan to get married. "Just got internet so I got in touch, Mum". There's a long story that I won't tell here; Lisa joined me in the UK several years after she split with Tyler's Dad ... Tyler was due to come over too, all agreed, but then Dad went back on his word. Pity the kid ...

I post to a number of forums - moderate two, answer questions on another, write my own technical blog. So a quiet hour or so waking up, reading, writing some sample code and posting. Then back upstairs for a few minutes with Lisa before I left. As you can imagine, a discussion on Tyler; on one hand, when you hear out of the blue that your 18 year old is out on his own, with girlfriend, planning to marry it's breathtaking and concerning but on the other hand I think we're both glad he's rather less under the control of the guy we regard as a complete $%^&. Time will tell on the detail, mind you.

And, d'you know, that wasn't the only subject of discussion. A new member of staff joined our team yesterday - now we're five ... and we wish and need to ensure that everyone fits in well with inevitable re-arrangements. Ah - the fun of managing staff. And having to help and reassure team members as things change. Hey - you open a hotel and it WILL change your life!

Lisa has a Food health and safety exam later today (I'm writing this at 08:00 on 17th) and I left at a quarter past five to start on the breakfast preparations, with Lisa doing some last minute revision.

To "The Manor" with a carload of cuttlery, crockery, and breakfast supplies. Crept in through the staff entrance, dropped them off ready for new starter Martin who should be in by 06:30, then off to Tesco in Trowbridge.

"Open 24 hours" screams the sign at the front and I know from past experience it's not usually busy at this time ... but this looks exceptionally quiet. I walk up to the front door. "Hours during refurbishment ... 07:00 to ..." says the sign. Yikes - what am I going to do for breakfast. A solitary chap is tidying trollies. "Not open 24 hours? Why are you advertising it still?"; "We're refurbishing" he says. "Where's the nearest 24 store" I ask and he replies "our petrol station opens at 06:00". I give up as a bad job - I'm getting answers to different questions than the one's I'm asking. Need to find another solution.

I'm home again, via "The Manor" by 6 ((yes, this is going to be a long day)) having picked up a pile of unbaked and semi-baked bread products from the hotel freezer; overs switched on, bread in ... alternative breakfast underway. Thank goodness we're continental only. And a few minutes break - a chance to stroke the cat, discuss the 'trick'yness of some of the Health and Safety questions that Lisa has to answer today, and collect more supplies before joining Martin at 06:30.

Coffee machine serviced for the day. Ah - the smell of real ground coffee and fresh bread, and our guests are coming downstairs in dribs and drabs from 07:30. "Come as a student, leave as a friend" we say and indeed they're all friends - they were delegates on the first day of the MySQL course I presented yesterday, and they'll be on today's course too. So it's a lovely, homely atmosphere here.

We've bought breakfast service / coffee machine / juicer that do NOT need constant attention. We have a used tray / dirty plates rack that people can clear to themselves. So we can actually sit back and do a few other things while breakfast runs itself, with just one ear open to needs. Martin and I review the first couple of days and come up with a few things that we need to do / that will make housekeeping easier. We discuss things like Lisa's specification that the hospitality kettle should always be left empty for new guests (because people don't want to think they have someone else's stale water) and that the lights in the room should be left switched ON (because we have an energy saver system, and we want people to know what's on the controls when they slot their card in).

A fresh email from Tyler asks us to set up an email account for his girlfriend; easy - done in a couple of minutes and it looks like we might be back and well in touch. I quietly catch up on a few emails - notes to staff on plans, etc, and start on this blog entry having head on the radio on my way to Tesco that the National Trust and others are looking to record a typical day in people's lives for posterity. Well ... this is my day; I don't have a typical day, but you'll get a typical flavour.

Lisa has popped by to grab some breakfast ... we'd co-ordinated that via a Skype chat that we're finding invaluable; she's also brought over course certificates for me to hand out when I conclude this evening, and invoices for delegates who are paying for themselves (as opposed to company placed people)

[[08:30 .... more to come, no doubt. The day hasn't really started yet ...]]

At 08:45, an engineer turns up unexpectedly to check the electrical installation. Funny that ... hadn't been expecting him, and it's going to be great fun if we have a day of power cuts. And at 08:50 my daughter Kimberly pops by on her way to work to pick up an Apple Mac power supply we're loaning her for a few days.

09:00 - and work proper starts. I'm giving a MySQL course - five delegates from four different organisations, in our new "Wilts" training room. Typically, our delegates are men in their 20s or 30s, with the occasional one a little older or younger. Typically, they're highly intelligent, very interested in the topics I cover, and asking superb questions. The course is a mixture of presentations and practicals but the presentations always differ based on feedback I get from the attendees; little point in covering i, j, k where s, t, u are relevant to a particular group.

As with any major change to a venture - and our move to provide accommodation is a major new venture - you never know what's going to hit and how things will settle out in the first weeks. We're a team of five; that's Lisa, Leah, Martin and me full time and Christine part time. Today was the first "capacity" day - all rooms booked last night, all rooms needed to be changed today and prepared for new guests tonight ... not one staying on. Martin and Leah did us proud; it won't take two people to do the rooms on most days, and Leah will be in her more normal bookkeeping and admin role again tomorrow but it's so great to see the effective teamwork, and the looking at issues by both of them, suggesting solutions, resolving issues.

A midmorning coffee break during the course, and a short and unexpected power cut while the engineer worked through his tests. My Dad arrived to take some photos (he's something of an expert and has equipment that's great for photographing rooms too); took some pictures of rooms 3 and 4, done by that stage, and also of the delegates on the course. He arrived and left by bus - with a stop right outside, and now with a free pass, he finds it a convenient way to get around.

Just before lunchtime, two delegates arrived ready for tomorrow's course - we knew they would be checking in early as we had arranged their taxi from Bristol Airport, so rooms 3 and 4 were the first to be ready. I greeted them, offered a hand with bags (not taken up) and they headed up to their rooms. I've seen them go in and out a couple of times since, but they're, again, quiet guests. I could have predicted that, too. We're so lucky with our customers!

If you're on a course, you don't want the same dinners each day. We had Chinese yesterday, and today was a pub lunch. Messages from Lisa at home / the other office told me she was back from her exam, and we all met up down at "The Three Magpies". Tomorrow ... goodness knows ... we'll take a vote on the new course and see what people want.

An afternoon concluding the course - wrapping up all the final questions, making sure that I really had come back to each thing where I had earlier said "I'll come back to that later" .... and directions homewards for guests heading for Oxford, Liverpool, Harrogate and Bedford - a typical mix for us, and one of the reasons that we've opened the hotel; there's simply no-where that would be central for all of those, plus a hundred other, places.

And so I sit and write this day's diary, now at 17:30. In the last half hour, I've been to the station to pick up one of next week's delegates, vacuumed and cleared the conference room, and responded back to a prospective customer looking for a three day course for three delegates. And a few minutes of pause to write up some notes.

Flagging ... yet it's only 18:15. Just phoned in a food order - pizza - for delivery; four out of five guests checked in for the new course, the fifth arrives, well, goodness know when. Driving down from Leeds, and the door buzzer that should ring out at home was installed 10 days ago but we've not been told how to set up our number in it. Highly frustrating, but we're making the most of being here. I'll post this blog now before I Zzzzzz ... Zzzzzzz ... Zzzzzzz

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

October 17, 2006

PHP - good coding practise and sticky radio buttons

With PHP, it's very easy to knock together a page with a couple of radio buttons and a small application just be taking the "bull at a gate" approach - but if you develop code like this, and without planning, you end up with a very long application that's hard to follow and maintain and - unless you've very good at repeatedly debugging the same code - it's going to be unreliable too.

Much better to move all the standard stuff into functions and just keep the data in the main program or even in data files.

To give you an idea, here's a sample I've just written with sticky radio buttons - as a demonstration - showing you how I've separated the mechanism from the actual data:

<?php

function mystickyradio($spec) {
$html = "<tr><td>".htmlspecialchars($spec[0])."</td><td>";
$bname = htmlspecialchars($spec[1]);
for ($k=2; $k<count($spec); $k+=2) {
$chkd = ($_REQUEST[$spec[1]] == $spec[$k+1]) ? " checked" : "";
$html .= "<input type=\"radio\" name=\"$bname\"";
$html .= " value=\"".htmlspecialchars($spec[$k+1])."\"$chkd>";
$html .= htmlspecialchars($spec[$k])."<br>";
}
$html .= "</td></tr>";
return $html;
}

$rb1 = array("Do you do regular weight training?","muscle",
"Occasionally or never","1",
"Yes, as part of my exercise routine","1.2",
"Yes, and I'm a bulky lad","1.5");

$rb2 = array("Select your age range","old",
"Under 21","0-20",
"21 to 65","midlife",
"over 65","old");

$form = "<form method=\"POST\"><table border=1>";
$form .= mystickyradio($rb1);
$form .= mystickyradio($rb2);
$form .= "<tr><td>&nbsp;</td><td><input type=\"submit\"></td></tr>";
$form .= "</table></form>";

?>
<html>
<head>
<title>Data driven sticky radio boxes</title>
</head>
<body>
<h1>Demo Sticky form from parameters</h1>
Please fill in this form<br>
<?= $form ?>
<hr>
Instructions, copyright, etc
</body>
</html>

A real life application would have some "business logic" to actually handle the data entered, of course, and I would move the functions out into a separate include file so that they could be used across all my work. Similarly, the HTML template would be separated out for easier maintainance by an HTML expert. Ah - we're headed for the "4 layer model" again ...

Run the code here

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


Useful link: PHP training

October 16, 2006

Welcome, Martin

Monday morning saw me at 'The Manor' before 6 O'clock ... to welcome Martin onto our team. We met Martin soon after we started the process of puchasing "The Old Manor" as it then was ... he had just moved to the Melksham area a month or two earlier and was settling into his first job here. But you know what it's like with first jobs - get what you can, and it may not turn out to be what you want to do longer term ...

Martin comes to us with prior experience of the hospitality business and of housekeeping, and by training he's a dietitian / healthy food expert. He'll be taking the early shift - providing a healthy continental breakfast for our guests, then making sure that the rooms are ready for the following night; on days that course lunches are in-house, he'll be helping with those as his last job of the day.

Welcome on board, Martin.

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

October 15, 2006

Where quality costs less

We've tried to buy locally where we can in our refit of Well House Manor - and that's meant first Melksham, then Wiltshire before looking further afield. Some excellent suppliers have come through, but there's some bare faced cheekiness in some suppliers.

"Where quality costs less" said the tag on a TV at Leekes - the Melksham Department store - yesterday, where we were getting a few odds and ends. I have, frankly, found the store's staff uncaring and prices very high in the past, and so we've not used them much on this project. But just out of grins, I had a look at the TV price as it was the model I've just bought five of. 799.99 was the price; hmm - the highest I've seen. We got ours for under 550.00 each, from a well know British High street chain.

Sorry, Mr Leekes, I'll buy locally where I can but NOT if it costs me 250.00 pounds per unit extra. And to claim that quality costs less on your label in such a case ... well, I'm afraid I trust you even less now that I did in the past.

40w bulbs ... and we wanted a number of bubble packs. A good job we noticed that there were a couple of 60w packs mixed in. We carefully sorted Mr Leekes stock for him

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

October 14, 2006

Visibility

"Problem finding your hotel's website" says an email in my box this morning, and it's offering to sell me marketing services to help fill rooms. Funnily enough, it doesn't look like it was too big a problem for the senders of the email to find us, even though we've only been open for five nights and we're NOT actively marketing rooms until the new year. I think I'll pass on their offer to help generate more business via a sponsored link ... they are good enough to tell us that we don't need one if we're always full and, yes, we're full all of next week.

Although we're not marketing rooms, apart from course delegate rooms, until December, we will take bookings by phone or email from the general public. Our first 'external' (non-course) guest has just left after a two-night stay, and seemed very impressed. Excellent. A discussion about what we're doing and a little 'snagging' (recommendations / comments from the customer) helped us confirm that we've got it pretty well right - all the things mentioned are little things and are things that we know about already; mostly things we have planned for anyway in the next week or two.

And the first course ran here yesterday - Friday, 13th. Regular expressions, just a couple of delegates, good chance to see how the new conference room (The Wilts) worked out. Am I superstitious? No, but in the evening I did manage to drop my laptop and break the screen; and I'm now typing this update via a spare monitor.

Big of a general ramble in my thoughts this morning - so much happened and so much to do too, but it's all going excellently. I had best get to it!

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

October 12, 2006

A pattern in change

I just spent 1.12 on a couple of bits and bobs (yes, I've been out early!) and handed over a fiver.

Q What was notable about my change?

A I received one of each coin in common circulation - 2 pounds, 1 pound, 50p, 20p, 10p, 5p, 2p and 1p.

Supplimentary comment Do you realise that in the UK, we have 8 coins in common circulation, whereas many other countires have far fewer. The USA has 1c, 5c, 10c and 25c ....

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

October 10, 2006

Well House Manor Hotel, Melksham, Wiltshire

Some pictures of "Well House Manor" taken just a couple of days before we opened, during room dressing. I admit it - I couldn't resist putting these up even though they'll be able to be replaced by something even better in a few day's time.


Bedroom 4
We have five bedrooms - two are doubles, one is a twin - and the remaining two are usually doubles but can be converted. As you can see, they're all spacious - this picture is the "always twin" - room 4.

Bedroom 3
All rooms feature large work desks with plenty of power points, 26" TVs, full length mirrors, and plenty of space. There's all the usual stuff like a hospitality tray, but we've also got fridges and laptop safes, Irons and Freeview (with over 30 channels) in each room too, and these aren't so usual in a hotel.

Bathroom 3
Two rooms have baths, and three have showers - more choice for you if you wish, or you can take pot luck. Oh - and we DON"T do "small" in our bathrooms!

From now until the end of December, while we settle in, we're taking bookings at 60 pounds per room per night ... and we've got some nights full already this month and next, but plenty of availability most of the time - after all, we're not really marketing until the tail of the year.

Oh - did you want some links?

Here for initial bookings and information ...
Here for the main hotel web site.
Phone - 01225 709638. Email - info@wellhousemanor.co.uk

Many more pictures - external, grounds, breakfast room, conference rooms .... still to come.

Posted by gje at 07:43 PM | Comments (0)

October 09, 2006

Open

The end of an exhausting day .... and the first guests are installed in Well House Manor. The term "cutting it fine" comes to mind as carpet bits were being cleared on the landing and the carpet layers just leaving for the day as the day ... but all so worthwhile as I saw / heard the customer's initial reactions. Leah and Christine (listed in no particular order) - have worked like trojans today and I want to record a big THANK YOU to them.

I popped by 'The Manor' again about an hour ago. You can hear life in the place again. Water running through to a shower or bath in one room, a TV in another. The new lighting in the garden twinkles in the soft rain, and the door washers on the landing give a pleasant diffused light that's going to make this feel like an exceptional home from home. The design's Lisa and, again, she's hit the nail right on the head where it was needed.

Posted by gje at 09:57 PM | Comments (0)

October 08, 2006

Opening approaches!

Here's a tiny post from the eye of the storm. "Well House Manor" opens its doors to paying guests in the next couple of days, and we're in a flurry. Looking REALLY good but not enough hours to tell you all about it this morning! But I can tell you it's looking really exciting.

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

October 06, 2006

Turning C from source to a running program

With scripting languages (or near-scripting languages) such as shell, Tcl, Perl, Python and PHP, the developer just edits a file of program code, and tests it - the tools that he uses roll the translation of his source into something that can be run without him having to make further inputs. C is somewhat different .... to here's how to convert a C program from source to executable.

1. Enter your source code (a file extension .c is common).

2. Compile into an object file (extension .o or .obj). This is a binary file that contains machine code for the machine that you'll be running on, but it's not yet a complete program - it's a program component. In effect, your compiling has turned a raw potato into a roasted one, but it's still not a complete meal.

3. Link / Load / Taskbuild your .o or .obj files; that joins them together into a single conglomorate executable file, and brings in standard library files too, so that the file as a whole can be run. You have now added your Roast Beef, Yorkshire Pudding, and brussel sprouts and made up a complete course.

* The COMPILER will initally run the C pre-processor which will act on lines starting with a # character, allowing for other files to be included, constants defined, and selective debug code / system dependent code to be included as appropriate.

* The whole process of one or more compiles followed by a link may be defined in a makefile. The Makefile defines the commands necessary for each step of the process, and also lets you define which file depends on whihch other file - the net effect of this is to enable the compiler to skip over files that haven't been changed since you last did a compile by looking at the timestamp on the .c file in relation to the timestamp on the .o; very clever - I remember back to "pre-make" days and running compiles and loads of a big CAD system I wrote that took nearly an hour to process!

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

October 05, 2006

HTML tables - telling whats wrong from the display

Tips on tables .... or how to spot the bug based on what's wrong on the display.

* If text that SHOULD appear in an HTML table appears above the table, then you've not put that text in a <td>...</td> tag set; it's very common for people to add un-necessary <br> tags to move on to the next row and this shoes up as a big white gap above the table!

* If the table appears at the end of your page rather than where you want it, you've probably forgotten your </table> tag. Tables gather up information to be drawn when the end-table tag is found, and if there isn't one there ... ((By the way, if you have a Netscape browser the table won't appear at all if you leave off the </table>))

* If you wanted the table right across your browser window or frame, but it's limited in width, add a width=100% into your <table> tag.

* If you want your table headers to be bold and centred, use a <th>...</th> tag pair rather than a <td>...</td>

* If the table display isn't what you expected, add a border=1 attribute to the <table> tag for testing and debug purposes - then you'll see how the table is constructed.

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

October 04, 2006

Signs of Leek

A brief evening breath of fresh air around Leek shows me signs of spirit, community and humour. I don't know the history of this pub sign, but there are those out there that will tell you that a Quiet Woman is rare in the extreme. I expect that a very old name indeed, associated with some even centuries ago, is still being commemorated with a degree of modern jest.

We hear a lot of the modern influx of people from Poland, but this sign reminds up that previous waves of folks have come from that country to the UK, and there's a sign and an archway to commemorate it here in Leek. I'll let you read the sign, pictured just above. And I know we have a similar local community in Trowbridge. There's a clear mutual respect and mutual gain from these communities - long may we continue to welcome such groups. And although we talk about them with a collective label are in reallity made up of a whole lot of individuals just like the rest of us.

With the coming of out of town shopping, there was a move away from the town centre. Safeway (now Morrisons) came here in 1989, and there have been others such as Focus who have followed them. And in very recent years, internet shopping has pulled personal visitors away from them all. Charity shops abound; Leek doesn't strike me as being too bad on that front, and it does seem to have a good range of very interesting specialist interest shops too - from antiques to Teddy Bears. But there ARE empty shops and scope for stores of certain types. This sign in a window would indicate that there's scope for a shop that sells attractive lingerie and associated products.

Click on any image to enlage it in a separate window

Posted by gje at 04:55 AM | Comments (0)

October 03, 2006

Why do we still need C?

The C language is the bedrock of modern computing. So why is it that a company like Well House Consultants, who specialise in niche training, are running a C course? It's because the bedrock is something that, whilst it's there and vital, most people don't need to understand. I expect that most of you couldn't tell me very much about your home's foundations - how deep are they, what are they made of, what material do they lie on. And in the same way, C is vital to us all, but only a few of us need to learn it.

C is not an "object oriented" language (and if you've not come across "OO" and what it implies, that's a subject for another day). If you require the bedrock of C and also the extra facilities offered by OO, you can select C++ which offers compatability with C, and also the extra facilities. But note that they ARE offered at a price, and that price is a complexity that is not necessary for most people, and not necessary if the underlying C compatability can be foregone. That's why you have languages such as Java (from Sun) and C# (from MicroSoft) which are developed using the approach of C, and the power of object orientation, but without the C compatability and so without much of the low level coding that C's been so successful with.

Perhaps you're looking at a PHP script, or a piece of Python and saying "C isn't important to me". Actually, it is important. Your PHP and your Python are witten in C (Jython is written in Java and THAT has the underlying C level). Your web server is written in C. Your operating system is written in C. Don't undererestimate C - it is VITAL to you. It's just that it may not vital for you to undertand it.

Posted by gje at 05:36 AM | Comments (0)

October 02, 2006

Drive time

As I drove from Melksham to Leek this morning, I was catching up on thoughts and ideas and news - one ear to the radio, two eyes on the road, and a mind flitting from C programming - next week's course - to the case I'll be composing for "The Melksham Train" for Tom Harris, the new Transport Minister, and to the hotel that we open on Sunday.

Do you consider driving to be a waste of time? Actually, I don't; I consider it to be valuable thought time. The tragedy of it is that so many of the thoughts get lost and forgotten as I've never found it practical to record them. Mind - a piece of paper that can be used in a layby is always to hand. Sometimes to record my own thoughts and sometimes to note what's triggered by a radio broadcast. Travel-by-train and travel-by-bus time is SO much more useful ... there isn't such a problem with note taking!

On the radio this morning, the editor of the Good Hotel Guide (who's name I forgot by the time a layby came up) and Michael Winner, who's name I did remember, were talking about rip-off England and how hoteliers were profiteering on certain services. "Wifi and Weddings".

The "Wifi" ripoff involves charging up to 5 pounds an hour / 20 pounds a day for wireless internet access, when it only costs the hotel a tiny, tiny fraction of that. The "Wedding" ripoff is letting most of the hotel, including the restaurant and all the day facilities, to a big group ... and then letting your few remaining rooms, at their usually full price, to other guests who are then unable to enjoy your fine restaurant.

Michael and Adam Rafael (ah - I've remembered) were slagging off hotel keepers as being profiteering and not caring about their customers, on the basis that customers are transient and there will be plenty more. I have to say I feel rather smug and share their moral high ground; we open Well House Manor this coming weekend, and already have free, limitless Wifi provided. And a decision, taken long ago, that if any conference or party books over half of the facilities and hotel, the remaining rooms won't be let at that time.

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

October 01, 2006

Age discrimination law

I'm going to propose a qualified welcome to the new law on age discrimination in the work place. In general I'm in favour - but I cannot agree with the cutoff at age 65, and I fear the extra red tape and potential effect of a sue-happy employee (or prospective employee) or two on a business.

Both Lisa and I can look back at our employment history and say "age discrimination" against instances in our past.

"You were too young to be promoted to the new technical support manager job, Graham, even though you were the best candidate. Some of the other people who were also in line to be promoted to the job were much older, and we felt that whilst you could report to one of them, they would find it hard to report to you." So I was told by a good friend who had been a part of the selection process, many years later after we had both moved on. "We want to be a young team - it's age rather than experience that's important now" to Lisa.

Look at us. We both took advantage of the new opportunities offered elsewhere and moved on fairly quickly to somewhere where our age wasn't a barrier, so not big / long term issue. By the ethos of the new law should make such reasoning, which has been pretty standard up to now, unacceptable in this country.

As it happens, I'm seeing a man about a job this afternoon. It could have equally been a woman that I was seeing; in fact, the role we're filling might traditionally have been a woman's. I think I know his religious and ethnic background - "so what". I'm pretty sure he'll not turn out to be registered disabled, but that wouldn't matter. I am required by the British Government to check that he's allowed to work - which means that I must see some proof that he's a EU citizen or has an appropriate visa; yes, THAT is legalised and required discrimination! As to his age - at this stage I would be guessing; no doubt some piece of paper or other may give me a date of birth if he turns out to be the man for the job. A suggestion on TV on Friday was that it's going to be illegal even to ask for "10 years experience" now as that has age implications.

So what criteria can will I use? The ability to fulfill the role we have on offer, and to fulfill it well. Period. That's it. But it's a much wider criterion than you might think. It includes the actual minute by minute, hour by hour tasks and achieving those well. It involves the excellent customer skills, ability to think on [his] feet and handle situations that arise that are growing every so more important in all our roles these days. It needs him to be able to be reliably with us to work when (as in this case) virtually every task will be required at a certain time. And it calls for a personality that will fit in well with us and our other team members.

I fell asleep to a TV show last night in which the applicants for some roles were being selected out in groups. There was the 16 to 25 group and the over 25s. Were they showing that on 30th September because today - 1st October - it's no longer legal to do it that way?

Posted by gje at 04:34 AM | Comments (0)