« October 2005 | Main | December 2005 »

November 30, 2005

Exciting futures - the Well House Manor project

"If you were to start a new business in the county (Wiltshire), what would it be and why?". The question was asked of me yesterday evening by the reporter from the local newspaper who was interviewing me for a piece that's probably published on Friday ...

I paused.

We are actually going to be launching a new venture next year to compliment the training courses, and I rather too Dave aback by my answer ...

We love Melksham. We moved here at the tail end of 1999 and we ran course at our training centre from late the following summer. Plenty of good B&Bs and hotels, which proved a real blessing as the majority of our customer base doesn't commute, but rather stays overnight in the area. But times, they are a'changing. Springfield next door to us has closed down and the owners now operate a smaller establishment further away. The Town House, Beechfield and Bowden House are all (or have very recently) been up for sale. Others have changed hands, and new managers / owners are concentrating on other parts of their businesses such as food and drinks. Sandridge and the Regency have closed down, and some of the remaining B&Bs that I haven't mentioned aren't taking guests all the time like they used to as their owner's situations change. All of which leads us, in looking forward to 2006, 2007 and 2008, to see a shortage of good places to stay looming up.

By next summer, we'll be offering accommodation for the business visitor to Melksham. While courses are on, the majority of rooms will be set aside for our trainees, but we will also have good or excellent availability for people who are working for a few days (or longer) in white collar roles at Knorr Bremse, at "The Avon", G Plan, the National Trust and the divisional Police HQ amongst others. Many of our trainees are impressed by Wiltshire and say that they must return with their partner to do the tourist thing; all our rooms will be double or twin bedded, and at weekends we'll be proving accommodation for the discerning tourist to the area - a quiet base away from home just 12 miles from Bath, close to Lacock, Corsham, Avebury and within striking distance of Stonehenge and Salisbury.

"You read about it first on the Horse's Mouth!". This is the first public statement on the topic ... and I'll come back here and tell you more of the exciting project as it progresses. Truth be told, it's been quite hard to restrain myself for the past few weeks as we've made tentative enquiries and started lining up our ducks. But they are - more or less - in line now with location identified and agreed in principle, business plan in place, and the training centre littered with floor plans and the rest whenever there's no delegates around.

Posted by gje at 08:25 AM


Related topics: via article database
More about Graham Ellis of Well House Consultants

November 29, 2005

Domain Forwarding - 2 ways of doing it

It's always seemed to be a real hassle to move domains and DNS service from one ISP to another, and I think that's partly because the ISP that you're leaving might not want to loose business, and partly because of necessary security checks to avoid domains being stolen. But it's lead us to some interesting situations / setups in the last couple of years.

If you visit our Opentalk domain, you'll be taken to a DNS server in Germany that resolves to a web server with the same ISP, also in Germany. Visit pages on the domain, and the server in Germany will forward the request and grab the content from another server that we run - with a different ISP - in the USA. This is known as Web Forwarding and can work reasonably well; on the down side, it can be a bit slow and the forwarding host may wrap the content in frames which mean that you can't bookmark / see the URL of individual pages.

Better than Web Forwarding is DNS Forwarding, where a DNS server in one part of the world points directly to a host computer in another. Our wellho.co.uk domain works like this; The DNS server that you'll go to if you visit the site is located (I think) in the UK, but that returns the IP address of another server, again in the USA. Access to pages on the web site then bypasses the UK system making for faster access, and bookmarkable pages without frames.

Posted by gje at 08:53 AM


Related topics: via article database

Dynamic Web presence - next generation web site

Ostensibly, I'm giving a MySQL course. A client who has a large and complex data base and needs many staff to be able to make ad-hoc enquiries. Server is Linux, and regular (standard) enquiries will be via a browser fed by a PHP Page from a web server.

In other words L-A-M-P or LAMP. Linux, Apache, MySQL and PHP.

Four very new technologies to their team who are much more from a mainframe and / or windows background.

Everyone's requirement is unique ... but such uniqueness if often related more to the flavour and the balance of the technologies rather than them being totally different. It stuck me yesterday, and over the weekend at Geekmas, just how many skills we have here at Well House Consultants - how we'll swap back and forth between all those technologies. We already offer a LAMP Deployment course ... but we have more scope too. Now sure how we would structure a public course as there are too many variables but as a private course, elements could be taken:

Building a Dynamic Web Presence

* HTML and more than HTML (XHTML, DHTML, form design)
* Virtual pages through mod_rewrite and other techniques
* Changeable content with PHP
* HTML - CSS - SQL - Image libraries
* Advertising Standards, Disability Discrimination
* Acceptable User Policies
* Data Mining to provide the visitors each with correct content
* Using your own and other search engines in your site
* Remembering visitors
* Locating visitors by their countries of origin and interest
* Search Engine Placement and optimisation
* Browser recognition; Javascript, AJAX
* Injection attacks, denial of service attacks and other security issues
* Avoiding 404 errors - making the URL work for the user
* Reading and analysing log files and trends
* Mobile Phone Users and making the site good for them
* Sessions
* Avoiding multiple logins.
* Booking and ordering systems
* Wiki and other content management systems.
* Easily maintaining your content - MVC model and others
* MT, Yabb, SMF, OSCommerce, Plone etc.
* Perl - Python - XML ...
* Code re-use and standards.

Amazing thing is ... give me an enquiry for a private course to cover a selection of almost any of these subjects and we've already got all the resources in place to do it!

Update - September 2008 - I have added a simple Ajax Example here, and Ajax is now covered on our PHP Techniques Workshop

Posted by gje at 08:22 AM


Related topics: via article database

November 28, 2005

Snippets from Geekmas

I slept well last night! A big thank you to all those old friends who came by over the weekend and helped make this year's Geekmas celebration an event to remember ... and remember in a very positive way. I always knew that it took special people to give up their weekends to the technology and the last couple of days have confirmed it.

Paddy and Roy were Pythoning away ... a whole host of interesting discussions in which we seemed to talk a lot about sorting and some of the new 2.4 stuff - the sorted method and sorting with named parameters such as key. Paddy was showing us how he transforms data just once if he has an awkward sort to do - clean, efficient, and with shades of Randal Schwartz's Perl transform but much easier to read. Example.

Bruce's Ajax demo is on line on his own web space - many thanks for this introduction, Bruce. You and 'Lina missed a great curry on Saturday night, by the way. Oh - Ajax. It's Javascript running in the browser, and using XML to pick up data on the fly from the server. Where you've got an interactive requirement to update a browser's display and don't want to send over complete pages it's a great option. A viable alternative, for example, to my framed PHP example but because of Javascript differences between browsers, it's probably best used on an a uniformly set up intranet rather than on the Internet as a whole.

I was inspired yesterday to write two other Horse's Mouth contributions based on Geekmas on Saturday - there's a piece on DHCP and DNS answering a question from Julian, and Leah challenged me to write a few sentences describing what Object Oriented Programming is about. Now that last one is a toughie - it's the "few sentences" part that I find hard to adhere to.

We also covered many interesting aspects of site design - how we're using Style Sheets through PHP in order to generate a flexibility of look and feel on the new Well House Consultants web site, and we had a fascinating discussion concerning the "mining" on a site - how to present relevant information based on the arrival country and subjects of interest to a new visitor, and yet provide tools so that these preferences can be easily changed. You'll read and see much more of these subjects coming up here later on The Horse's Mouth

Finally, Lisa and I announced "Well House Manor". Separate post, I think.

Posted by gje at 06:18 AM


Related topics: via article database

Comment, please!

I've just disabled track back pings on all entries on "The Horse's Mouth". Although this is a useful facility for linking like-minded blogs and providing "remote commenting", it's now been used for that here ... rather, it's been picked up by advertisers wanting to provide links to their sites selling pharmaceutical products, betting services and other things that I really don't feel inclined to endorse.

"The Mouth" remains open for comments; if you're a registered Opentalk poster then your comments should be accepted straight away; if you're not registered there or give a different identity, it's a human process for us to accept your post which we'll be delighted to do.

The need for common logins is the "bane" of a modern website such as ours where we've got a variety of our own software, and other software too, each with its own login system. We're working on a common login system - using an OO interface internally - so that we'll be able in the New Year to provide single login, and let you register with just one element (blog, or forum, or mywellho) in order to access them all.

Posted by gje at 12:13 AM


Related topics: via article database

November 27, 2005

Introduction to Object Oriented Programming

So what exactly IS object oriented programming? Easy question to ask, but a hard one to answer in just a sentence or two. Let's try.

In an object oriented scenario, you group together all the pieces of code that relate to a certain type of data. That code grouping will be called a class and it will usually be kept in a separate file to your main programs, so that you can write a whole suite of programs that handle the same data in different ways without having to keep re-writing the low level code.

For example, this Blog might be using an "entry" class (a class is the name given to the bundle of code that relates to a type of data) so that the logic I use when I write each day is shared with the logic used to generate the pages you see when you read it on our site, and is also shared with the logic that's use if anyone calls up an XML feed.

This isn't an easy way to start writing a small and simple program, but it's great when you expand your applications. You don't have to re-invent the wheel ... and if you change the internals of a class, all your applications will just keep on running provided that you keep the calls to the class compatible with the previous ones. In other words, it's a great way of cutting maintenance costs too.

A language is described as "An object oriented language" if it has a number of extra features that weren't in languages such as Fortran, Algol and C (on which I cut my teeth) and which facilitate programming in the OO way. OO has its whole world of extra concepts and buzzwords, but to bring them all up here on a horse's mouth entry would take me beyond my challenge of telling you what OO is about in just a short item. Longer articles (part of our training notes) may be downloaded from our training notes site.

Posted by gje at 08:05 AM


Related topics: via article database

What are DHCP and DNS?

Are they the same thing? Absolutely not, though both relate to resolving addresses on a network.

You can use DHCP (Dynamic Host Configuration Protocol) when you connect your client computer onto a network that it's not been pre-configured for. All computers on an IP network need to know:
a) an available local network address that they can use for themselves
b) where to pass information for the outside world
c) which computer(s) to ask for information when they need to translate a host name such as www.wellho.net into an IP address such as 64.62.240.12
and you can set the information manually if you like - however, if a network administrator is expecting to host visiting computers or wants to issue addresses from a pool, he'll run a DHCP server.

If you're going to be using a network that has a DHCP server on it, you can simply set your own system up to "DHCP" and it will send out a broadcast - a message to all machines on the local network - and the DHCP server will come pick up the broadcast, start a conversation, and issue the information that's needed. More? See the DHCP FAQ

DNS (The Domain Name Service) is used to translate host names - usually server computer names such as www.wellho.net into IP addresses such as 64.62.240.12.

The internet is a network of networks, numbered using the IP4 scheme which is four numbers each in the range 0 to 255. The earlier part of the sequence is used to indicate which particular network a computer is attached to, and the latter part resolves which particular computer it is in that network. All very well and good except that we want to be able to address computers by a name that fits into a logical naming scheme (office.wellho.net, www.wellho.net, dandelion.wellho.net) rather than based on where they are physically located. It's DNS that sorts this out for you.

As part of the configuration when you connect a computer to a network, you'll tell it the IP address of a DNS server (or it will find one out via DHCP - that's how the two technologies are both linked and confused) and your local computer will then ask that DNS server whenever it's given a host name that it's not come across before. DNS servers talk to each other so that the system administrator of each only has to look after his own logical area, and they cache (store) information so they can answer common enquiries quickly and without having to burn up bandwidth with the same enquiry thousands of times a day. More? See the DNS FAQ

Posted by gje at 07:26 AM


Related topics: via article database

November 26, 2005

Would you steal ... petrol? ... a training course?

Would you drive into a garage, fill your car with fuel that your passenger had promised to pay for, but then drive off without paying when your passenger wouldn't pay after all? If you did, then it would be theft.

Would you book yourself onto a training course, spend four days learning about PHP and enhancing your skill set and job prospects, then just say you would "rather not" pay for it when some third party who said they would foot the bill doesn't do so after all? If you did, then it would be theft.

We're lucky. We're very VERY lucky. 92% of our customers are real gentlemen (and 7% are real ladies) - a pleasure to train and we know we're going to be paid the agreed amount for the training given. Occasionally - very VERY occasionally - we have a spot of bother and even then it will be resolved, 9 times out of 10, by a slightly sharper letter, email or phone call.

So we find ourselves at present in a unique position. A man who sat at our dining table, who learnt PHP in our home, filled in his review to say what a great course he had, would "rather not" pay for it. He's been promised that a third party has arranged finance with a fourth party for it, however it seems that there's a communication failure (or a failure of desire to sort it out) somewhere down the line.

If my passenger refused to pay when I filled up with fuel in a garage even though I understood him to have agreed to make the payment, then I would pay and take it up with my passenger later. That might mean it was the last time that my passenger WAS my passenger, and it might mean that I ended up footing the bill personally in the end - but more fool me for filling up on the understanding in the first place.

I'm glad that our current situation is unique - a first time. It means that I can make every effort necessary to recover the debt without it impacting too much on other commitments. It means that I can raise a small claims court case secure in the knowledge that it's "just" a day of my time that would be taken up. Of Course, I hope it doesn't come to that. I hope that Mr Xxxxx Xxxx is ashamed enough of his behaviour to settle his debt ... and if it means a few less weekend trips from the East Midlands to Somerset for him with his girlfriend, he should remember that his PHP skills will, nurtured, earn him a salary for years to come whereas a few sexy weekend breaks will soon be forgot.

Posted by gje at 08:43 AM


Related topics: via article database

November 24, 2005

We are about Open Source programming courses in the UK

Back to our roots ... posts to The Horse's Mouth have ranged from Cancer Balls to MySQL, from Train Campaigns to Perl programming, and from comments on the local Chippy through to Linux tips. Lest I forget, we're an Open Source training company! I wrote the following as a brief introduction for a snail-mail sheet; for any new users who stumble upon it - this is what I / we do ....

We're providers of niche training courses in Open Source Programming languages and associated technologies.

Perl - PHP - Python - Tcl/Tk - MySQL - Linux - Apache httpd/Tomcat

Public courses run on each of the above subjects at our Melksham, Wiltshire, England training centre to a regular schedule published a year ahead on our web site and in the "Of Course" newsletter that's with this letter.

We write all our own courses, and they're presented by our own tutor. We have met and learnt from the authors and other leading figures of the languages we teach, and we're users of them in real life applications too. That means we have an exceptional background of knowledge to pass on.

Other things are exceptional too: We limit public courses to just seven trainees to ensure that every single person who attends gets the best of attention to their particular questions and application, and we even run courses if there's just one person booked. Once you've confirmed your place, you're guaranteed that the course will run.

All trainees have the choice of a Windows or Linux workstation or an Apple computer to use for the duration of the course, and all their work is forwarded by email after the course. Course notes are provided ... around 60 pages of detailed A4 text per day ... and we even offer post-course support at no extra charge through our forum and email.

If you've a group of four or more trainees that require the same course at the same time, we can run a private course, tailored to cover just the aspect that you wish to be covered. For larger groups, we'll travel out to your offices and run the course on your site...just provide a room and the students; we provide equipment, tutor, notes and everything else.

Please see our web site, or email, or phone if you would like to discuss your particular requirements. We're all techies involved with the technologies we teach and can advise you on how we can best help.

Posted by gje at 08:03 PM


Related topics: via article database

November 23, 2005

10 years C# knowledge please

We probably know more people who've had Python or Java training than most - which might be why some people think we're a good bet as a recruitment agency - able to provide them with staff to fill PHP or Perl programming positions, or with a vast knowledge of Tcl or Apache Tomcat. But I never cease to be amazed at the adverts / requests that come in looking for someone with 2x years of experience in a technology that's only been around for x years; these people might do better to check their adverts, or to approach the originators of the technology as those will be closest to their requirement!

On the subject of recruitment, we can occasionally help but we're really not best placed to do so. The majority of our training course clients are booked onto our courses by their employers and it would be a severe conflict of interest if we then put these trainees in touch with other who wanted to steal that skilled person. Some of the remaining 10% (or so) of clients who book personally will - with practise - make superb practitioners of the skills they've learned with us; others may not get that practise and their MySQL skills might not develop as they would have anticipated; it's hard for us to know which are which but we can (and occasionally do) put people in this group in touch with people who are looking for skilled IT staff or contractors with appropriate technology experience.

Posted by gje at 05:44 AM


Related topics: via article database

November 22, 2005

SELECT in MySQL - choosing the rows you want

The SELECT command in MySQL allows you to examine rows in a table (or more than one table if you like). Good news - but sometimes there's an awful lot of data and you just want rows chosen by particular criteria, or just the first (so many) rows.

The WHERE clause on your select allows you to write a number of conditions which can be linked with AND and OR keywords, and there's a great deal of choice in the conditions. Here are some examples:

WHERE name = "Graham"
Will look for the string Graham (exactly) and nothing else in the field called name. Note that this selection is case sensitive if name is specified as being a binary field, and case insensitive otherwise.

WHERE name IN ("Graham","Lisa","Leah")
Will look for any one of the strings Graham Lisa or Leah (exactly in each case; same rule about case as in the example above).

WHERE name LIKE "%Graham%"
Will return any row that contains the word Graham within the name field. This is similar to file name matching (also known as globbing) except that the % metacharacter means "anything" and the _ character (that's an underscore) means any one character ... in place of * and ? in file name matching.

WHERE name RLIKE "^[[:graph:]]+$"
Will return any row with a single name in the name field - this is a regular expression which provides a huge flexibility in matching. Regular Expressions are notable in that you can ask a lot in a very obtuse string of just a few characters!

Posted by gje at 08:27 AM


Related topics: via article database

Useful link: MySQL training

November 21, 2005

.css - using PHP to make dynamic style sheets

Did you know that you can use PHP to generate dynamic style sheets? If you look at the accessibility options on our new-look website, you'll find you can change the colour and font size on all the pages, and you can select wide and narrow too. And if you're using an older browser that doesn't fully support styles you'll get an older-look menu than if you have IE6 or similar.

A lot of hard work? Oh yes, but all in one set of pages. Our style sheets are not simply flat files - but rather they're php files that generate the necessary style combination from a single master file, with parameters passed in to set all the various parameters. Here, for example, is the start of the file and part that sets one of the font sizes.

<?php
header("content-type: text/css");
$mencolour = "#ffffcc";
$texcolour = "#000000";
$bfsize = 10;
if ($_REQUEST[fsize] == 4) $bfsize = 8;
if ($_REQUEST[fsize] == 2) $bfsize = 12;
if ($_REQUEST[fsize] == 1) $bfsize = 16;
?>

.tierlinks {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: <?= $bfsize ?>px;
color: #000000;
text-align: left;
text-indent: 2pt;
}

Other issues that will arise if you use this "trick" are cache controls - making sure that the style sheet isn't sent our for every page - and ensuring that the file is parted by the PHP handler even if you choose to give it a .css extension.

Posted by gje at 06:56 PM


Related topics: via article database

Useful link: PHP training

November 19, 2005

Bowerhill, Melksham, 2006 Calendar

If you started your time in the forces on a training course at RAF Melksham, or if you've lived (or perhaps still do) on Bowerhill, you'll want to get hold of a copy of the Bowerhill Villager 2006 Calendar. 12 big photospreads showing the history of Bowerhill from the Royal Air Force days through to the current time. From pictures of the Hawker Hunter that used to be at the gate (that's the aircraft that held the speed record for the fastest flight at one time) through maps then and now to school term dates and even the refuse collection calendar.

Just £5.99 from Lisa - email her on lisa@wellho.net, call her on 01225 708225, or write to her at 404, The Spa, Melksham, SN12 6QL ... even pop by and knock on the door - we're one of the big houses behind "The Spa" roundabout and you KNOW you've always wanted to peep inside. All profits go to the production and distribution costs for the Bowerhill Villager which is distributed to around 1600 homes on Bowerhill monthly.

We've also got more (modern) pictures of Bowerhill and Melksham on this web site.

Posted by gje at 06:42 AM


Related topics: via article database

November 18, 2005

Good IT training cannot be cheap

""I also wanted to know I was looking to take a class or certification in PHP I did google it and looked at a few sites, but its either way too expensive or I dont understand exactly what they offer.. does anyone know of a PHP Training course or Certification program?""

I keep my ears and eyes open ... I read forums, and I came upon the quote above.

Classes and certification are very different things - in a class you'll learn, and with a certification you'll pay money, sit a test, and receive documentation that you've reached the standard required by the certifying body which may (or may not) be appropriate for any particular job role ... but that's a side issue in today's blog.

Good training DOES cost. If it's the education of our children, then we might not appreciate the true cost as it's met through taxation - and not just taxation on those who currently have children at school, but on the population as a whole.

Technical IT training (the above forum was relating to PHP) requires the provision of a venue, hardware, software. A tutor. Training notes. A backup team to accept bookings and check that people have selected the correct course for them, to invoice, and (regrettably) to chase late payments. To provide sales and marketing material to ensure that people can find out about the course in the first place. And to keep the training centre clean and tidy and maintained.

The bigger the class, the lower the cost per trainee can be. BUT with a language such as PHP a bigger group means a slower course as it's paced for the weaker trainees. With each trainee having subtley different requirements, and everyone needing individual attention during practicals, the optimum class size is really four or five, and over seven trainees the gain that the trainees make (on a public course) tails off quite dramatically. With a private course, where the trainees may come from a more similar background, will be prepared for you to talk to them in groups during practicals, and will have similar targets the group size will be able to increase and still everyone will get a realistic product / course.

I'm going to suggest that one of the reasons that the original author can't understand what some companies are offering is because they're deliberatly being a bit obscure; they may know that they don't have an ideal product as they're trying to keep down to a price that pulls in a lot more punters.

In our own case, when we survey the market we find we're quoting prices some 25 to 30% lower that other similar courses. We can do this because we don't use middlemen to help us fill our seats (such agents often request / demand from 25% to 40% of the course fees as their cut), because our training centre is located in an area of lower property prices (i.e. NOT London or major city), and because Lisa and I work from home (so don't have to pass on the costs of an extra office building) and are enthusiastic enough to do a lot of the backroom work unpaid in the early morning, evening and at weekends. But if you're looking for a week's course that costs you just the same amount of money that you personally pay each week for your kid's schooling - sure - we're way out of range.

Posted by gje at 09:48 AM


Related topics: via article database

November 17, 2005

Why is Tomcat called Tomcat?

I'm doing an Apache httpd and Tomcat deployment course these two days, and I'm quite used to the "how come it's called Java" question but for some reason I've never been asked (and never had for find out) how the Apache Tomcat server got IT'S name. Until today.

Researching ...

Tomcat was given that name by James Duncan Davison, software architect at Sun. He hoped that Tomcat would be open source (and it now is) and wanted to choose an animal as the name to make it easy for O'Reilly when they published the inevitable book. (For those of you who are not familiar with O'Reilly, they put animals on their book covers). He came up with Tomcat as an animal that could take care of, and fend for, itself.

While researching, I've also come up with some other interesting history. I've know since I started with Java that it was previously known as "OaK" - Oak after an Oaktree that grew outside the office in which it was hatched up, to be supreceeded by "Java" since the programmers who wrote it drank a lot of coffee from that island. I hadn't known that even earlier it had been known as "D" - the next language to take over from "C" ... but that this name had been dropped because it looked like a rather poor grade on a school report card - "Could do better" - and indeed they did with the later names.

Posted by gje at 05:13 PM


Related topics: via article database

November 16, 2005

I have a river to cross

It may seem like an ole Deep South song ... "I done have this river to cross", but really I'm starting to take a more serious look at accommodations, conference centres and the like.

Our own training centre is in a listed building and we're very careful to preserve the history and at the same time provide excellent, easily accessed facilities. The lack of a lift / flat access rarely causes a problem and usually it's ourselves that have to negotiate all our kit up and down the stairs; at least they're in a single flight, and with a car parking space right at the foot of them. We HAVE inspected / access to flat and wide-door rooms if we have a trainee in a wheelchair but in practise we'll usually train them at their own office (yes, we are allowed to discriminate IN THEIR FAVOUR!)

But looking wider - what SHOULD be provided? Is there anything that we're doing that other users of our centre might say nothing about, be harbour secret concerns? The picture to the right - NOT our place - shows a training room in the distance, and on the same level as the photographer. What a pity that there's two steps down and two steps up in between. And thus my title = "I have a river to cross". Really ... not easy with loads of equipment and our wheeled trolley and I'm very grateful to the trainee who stopped behind after the course run there and gave me both physical and moral support in getting packed up afterwards, and out to the car. (You're only seeing a small proportion of the steps in this picture ;-) )

Again looking at training rooms, I'll train in whatever I'm provided with by the customer. And I'll provide here in Melksham to my standards which - simply because we're in the business - can greatly exceed what can be done on an "ad-hoc" basis in a commandeered conference room.

The biggest issue usually seems to be a lack of table space. A room that's for "a class of four" will take four trainees and give each of them enough space for a small notepad. Add in a computer and a full folder of notes and you've got trainees tripping over each other. I usually suggest that 1 metre of desk space is provided mper trainee. In the picture here, the provision to the left and right is good, but alas the two people seated at the far end of the table have, in my opinion, just a half of the space that I would look to providing

Posted by gje at 12:22 PM


Related topics: via article database

November 15, 2005

Python printf

To format data into a string in python, use the % operator as python doesn't have an sprintf or printf function. So why have I entitled today's entry "python printf? Because this in one of the most frequently asked, and infrequently answered questions.

The % operator with a string to its left formats the value to the right using the (sprintf style) string to to the left of the operator. Where you want to format more that one value, use a tuple to the right.

Here's an example in which I've formatted an integer to return a three digit number padded with leading zeros:

>>> licensed = 7
>>> callin = "Agent %03d" % licensed
>>> print callin
Agent 007
>>>

We've got an example using a tuple in our course material and there's an example using a format string variable and aligning output columns in python there too. There is further documentation of pythons' % operator on the Python documentation site (well hidden, so I give you the link!)

Aside - why no printf in python? Because you don't need it and the alternative is neater and better. Arguably, there shouldn't be a printf function in any other language either, as it both formats the values AND sends them to the output channel - doing two logical operations in a single call, and you're bound to want to separate them at some stage. Instead, there should be two functions. There usually are ... and from a purist's viewpoint, sprintf followed by echo or print is much more maintainable that a single sprintf.

Posted by gje at 11:13 PM


Related topics: via article database

Useful link: Python training

November 13, 2005

More spam - a success story

The number of emails that we're receiving and are marked as spam has significantly increased in the last couple of weeks, and I'm celebrating. Does it sound odd to celebrate a spam increase? The reason is that the overall number of emails hasn't risen in line and it points to greater success in filtering emails.

The graph to the right shows our email traffic ... a snapshot up to just a few minutes ago. Each vertical line represents a week, and each horizontal line is 250 emails. Blue represents emails marked as spam and red represents emails allowed through to our mailboxes.

As a priority, we try to run our system so that it's mostly "fail safe" because I don't want customers' emails to be bounced needlessly. If that happened too much at least some of them might decide to become FORMER customers! So the red "allowed through" block still includes doubtful emails.

Our dynamic email status page can be used to see how we generated this graph and you can learn all about how it's done on our four day PHP course

Update - 30th November We're now marking some 80% of the incoming traffic as spam rather than the 50% it was 6 weeks ago. Total traffic levels remain static, and I don't think we're loosing any valid emails; PLEASE TELL ME if you know / think otherwise.

Posted by gje at 01:32 PM


Related topics: via article database

November 12, 2005

MySQL - a score of things to remember

From the initial raw mass of data through to a fully functional database application .... a long road with many things to learn. I've run two short MySQL courses this week, including some coverage of how to access the data they contain from PHP based web pages and I never cease to amaze myself at how many topics crop up as "must cover before we finish" subjects. I have a habit of writing such topics on the whiteboard during the course so that nothing gets forgotten, and I'm going to share the topics that were on the board yesterday with you to give you an idea of just how wide ranging they are.

My illustrations for this entry are from Bristol Blue Glass and show the first and last stages in the manufacturing process of a glass cat - from the first ball of molten glass to the addition of the stand.

So - what MySQL subjects did I have on my "Must Remember" list on this most recent course?

Load. How to load data that's supplied in the form of text files - perhaps tab or comma separated, and perhaps with various fields encased in quotes, into database tables. The Insert command is great for data for transactions once a system is live, but can be less than ideal for an initial population of tables with heritage data.

Dump. Backups of a database are vital - and it's vital you know how to take backups (and to ensure you know how to reload the data too if you need to, but that's another story)

Join. The linking of data that's held in more than one table in order to produce a human-readable view / report. It's also important to know how to join tables based on the contents of a particular field, and how to generate a report that tells you about orphan records in one or other table - records that won't join with just a regular join and can become lost in the system.

Order. If you select from a database, chances are you'll get more than one row in your result set - sometimes a lot more. How do you control the sequence in which the records are returned by your query (i.e. how do you sort your results?)

sc6. OK - I admit it, that's an internal code and it's not obvious what I mean by it. It's all to do with PHP programming, though, and ensuring that the programs you write in order to maintain and examine the data base are easy to maintain and robust in operation. It leads me somewhat off the MySQL topics and onto PHP, using a design model that keeps the HTML apart from the business logic, and the structure of the application apart from the "web helper" functions.

Security. Log in to a MySQL database by user name and password, and you'll find that your access rights may also be controlled by the name / IP address of the system that you're seated at. You'll be set up so that there's a whole lot of things you can do over the whole environment managed by MySQL - anything from being allowed to select records through to shutting down the server. And in addition you may be given some rights over individual databases. The further rights "per table" and finally yet more rights "per column". It's vital for the MySQL DBA (Database Administrator) who's setting these up to understand what's what in order that security is not compromised.

Table Types. Know your MyISAMs from your heaps from you InnoDb tables. Do you need transaction processing capabilities? Will table locking suffice for your needs or do you need to choose a table type with row locking?

Codd / Normalise. Codd's principles of database normalisation should be given due weight when you design a database. By ensuring that data doesn't repeat itself, that calculated data is not stored, and that no attempt is made to place two values into a single cell, you'll set yourself up for a robust, long lived and maintainable system even though it might make the tables appear to be pretty unreadable to the human eye at first.

my.cnf. Default settings for the MySQL daemon and clients can be set up so that individual users don't have to type in long access strings including host and login names each time they want to access their "home" server.

pivot tables. Where there's a many to many mapping to be defined between two tables, best design principles lead you to create a third table known as a link or pivot table.

denormalise. Having taught you how to normalise data, you may then decide that you can go one step beyond that and denormalise it. As long as you know your update rules and think things through very clearly, there can be benefits in denormalising. For example, keep a copy of the current month's data in a "now" table as well as storing the historic data in the main table, or breaking rows across two tables if you have a rarely-required column that account for the majority of the row content.

timeouts. How to handle large / complex queries from a web front end, where browsers and user's patience is likely to time out before the query is completed.

Where to select and sort If you're front ending a MySQL enquiry system through PHP, do you do your selection and sorting of data in the database, in the program, or do you use a combination?

Special Characters. Make sure that special characters such as " and ' and < entered into forms cannot be used to perform injection attacks on the database ... and that they display properly back to the browser when passed from form to variable, variable to table cell, table cell to variable, and back to the browser as part of the HTML response.

Last Insert ID. How to ensure that new data you add into your tables will join correctly between the tables - finding the automatically generated key and making use of it.

Upgrade - PHP4 to 5 and MySQL4 to 5. The new password security model in MySQL 4.1 that means that old clients may refuse to connect, and what you can do about it. The new mysqli functions in PHP5, and the unbundling of current MySQL drivers at that release. Things to be aware of in your coding and upgrade plans to make sure that what works on the systems you have today will upgrade easily to the systems you will have tomorrow.

Posted by gje at 10:06 AM


Related topics: via article database

Useful link: MySQL training

Running a Perl script within a PHP page

Our web site update has been progessing well over the last couple of weeks - you'll probably have notices that most of the pages changed a fortnight ago and the remaining pages are now switching over one or two at a time ... they're typically the more awkward ones!

We've been providing on site training for years .. and quoting on line through a Perl script that is probably the longest standing piece of code on the site. Some of the regular expressions to tell a UK postcode apart from a Canadian one, and to check distances and ferry requirements .... well - let me just say I did NOT fancy updating them to include them within a PHP page.

Solution? Use the "legacy" code and call it in from the new PHP front end. I've amended the Perl slightly to recognise when it's called from the PHP ... additional lines in the Perl to collect incoming parameters:

if ($ARGV[0] eq "php") {
        $buffer = join(" ",@ARGV[1..$#ARGV]);
        $form{"method"} = "INTERNAL";
} else {
if ($ENV{"REQUEST_METHOD"} eq "POST") {
        read(STDIN,$buffer,$ENV{"CONTENT_LENGTH"});
        $form{"method"} = "POST";
} else {
        $buffer = $ENV{QUERY_STRING};
        $form{"method"} = "GET";
}
}

and to return the table as a URL response rather than as HTML:

if ($form{"method"} eq "INTERNAL") {
        foreach $key (keys %form) {
                # next if ($key eq "price");
                $kv = $form{$key};
                $kv =~ s/([^a-zA-Z0-9 ])/sprintf("%%%02x",ord($1))/eg;
                $kv =~ s/ /+/g;
                push @retst,"$key=$kv";
        }
        $ret = join("&",@retst);
        print "$ret\n";
} else {
print "Content-type: text/html\n\n";
print $html;
}

and I've used PHP's shell_exec to run the old Perl code:

$poc = shell_exec("cd $_SERVER[DOCUMENT_ROOT]/../cgi-bin/net; ./excalc.pl php where=$_REQUEST[where]");
$parms = explode("&",$poc);

Try the new quote system

Posted by gje at 09:28 AM


Related topics: via article database

Useful links: Perl training, PHP training

November 11, 2005

New Navigation Aid - Launch of My Wellho

Our search page tells you that we have some 6500 pages of content on this web site. So how are you going to find the data that you're looking for quickly and easily? Improved navigation introduced with the web site update a fortnight ago will help (although regulars may curse that things have moved at first) but really we want something else - a site that knows what you're interested in on each page and prioritises that information!.

And so we're launching My Wellho.

Initially, you can turn on and off full coverage of each of our topics - you can select that you're interested in PHP and MySQL, but not Python, Perl, or Tcl/Tk. And you'll then find that our resource indexes give you full details of the subjects that you want, but just summary icons for the others.

With the first launch of MyWellho, you can also choose font and colour styles, and the country from which you're viewing the site (even if your IP address indicates otherwise), and we're currently testing a registration and login systems that will allow you further access to information such as your bookings and training record in due course.

Posted by gje at 05:15 AM


Related topics: via article database

November 10, 2005

Being atypical is typical

"You shouldn't take me as the typical trainee" says almost anyone I ask for their input / opinion when we look to improving the product we offer. "I'm unusual in that ...." they go on. But I'm going to differ with their view; the typical trainee IS an individual, and the very difference that implies is very usual. I'm not going to accept that person "x"s view is going to apply to everyone, but I want the whole gambit of views. And I don't want to discount out of the equation the views of all of our interest customers and just go with the views of the boring few who remain.

With statistics and surveys, the very irregularity must be recorded as a snapshot and hopefully enough data will be gathered to even out any ups and downs. Taking a piece of data and eliminating it because "but that was an exceptional circumstance" is not the correct action to take. This approach fails only if the very act or method of collecting the data skews it!

I admit it - we just love the variation in our friends and customers and contacts. And we love to improve what we offer - increasing wow factor up to megawow factor. We're gathering some interesting stats - watch this space!

Posted by gje at 06:04 PM


Related topics: via article database

November 08, 2005

A new way to get lost

Aren't the new satellite navigation systems marvellous? Just punch in the postcode of the place you want to go to and follow the instructions. Even on a crosscountry journey that you've never made before, you can be assured that you're taken to where you've asked for.

Alas, like all computer systems, when you screw up you can screw up royally with this one. The BA postcode area is a big one, and a request for BA16 will take you to Street whereas BA14 will take you to Trowbridge. But it was only a little typo!

Posted by gje at 06:17 PM


Related topics: via article database

November 07, 2005

Which MySQL server am I using?

On occasions during MySQL courses, our trainees find that data they thought they had uploaded isn't available to them, or that they're denied login when they feel they've entered the correct user name and password. There are two reasons this can happen:

a) MySQL logins depend on user name, password, and the name / IP address of the computer from which the connection is being made. This "per host computer" feature is a great help in security terms, but it can be set up very confusingly.

b) If you run a MySQL client ... where does it decide which host to contact?
i) If you specify a -h on the command line of the client, that host takes precedence
ii) If you specify a host in your personal MySQL config file (.my.cnf on Unix / Linux), then that host is used (unless one is specified on the command line)
iii) If a host is specified in the client-system wide MySQL config file (/etc/my.cnf) then that host is used unless it's overidden by the setting in item (i) or item (ii) above
Iv) If none of the above is specified, MySQL falls back to connecting to localhost.

Posted by gje at 06:09 PM


Related topics: via article database

Useful link: MySQL training

November 06, 2005

Looking for railway groups and users - Swindon, Salisbury, Southampton

I'm looking for rail passengers - travellers on the train from Swindon to Trowbridge, from Chippenham to Salisbury and from Melksham to Westbury. I want to find people who take a day trip from Chippenham to the Isle of Wight, who visit London for the day from Melksham, or who live in Swindon and have a business appointment in Southampton.

Do you know a railway user group in Swindon? Are you a councillor interested in good public transport links in Southampton? Do you feel that more people should use the railway in Salisbury? Are you concerned at the treats to cut trains in several directions from Westbury?

Do you commute into Swindon? Do you fight your way up the A350 from Trowbridge to Melksham or from Westbury to Chippenham in the rush hour every day?

We've got a good railway link from Swindon through Chippenham, Melksham, Trowbridge and Westbury to Warminster, Salisbury and Southampton. No - not an excellent one; just five trains a day but we need to USE IT or we'll LOOSE IT. It's under threat from December of next year - further details are on our Save the Train site.

What can YOU do?

1. USE the train.
2. Write to your MP, to the minister concerned (Derek Twigg) at the Department for Transport, and to his officials.
3. Get in touch ... so that we can co-ordinate information up and down the line; I know Melksham, but I'm not an expert on train services at Romsey or Dean, for example!

The picture illustrating this post is provided courtesy of Tony Seager. It shows what was left of Melksham Station in the 1970s ... between its closure in 1966 and reopening in 1985. Don't let's have this scene return!

Posted by gje at 05:49 PM


Related topics: via article database

On line course booking - credit card protection

A week ago, we quietly started taking on line bookings - for example, you'll find a BOOK IT link from the MySQL course description page.

What a shame that one of the very first bookings came from a country in Africa, with credit card details for a USA address and in the name of a person who wasn't on the course and had a very non-african sounding name. The booking was followed up by an email asking for us to issue a letter of invitation to the course as a matter of some urgency, and the email addresses being used are generic ones that anyone can sign up for, for free, rather than linked back to the booker's company. All in all, a very suspicious booking. I can't be certain (and when you report these things to your credit card company, they don't enlighten you of the detail), but I rather suspect a stolen card or identity, and an attempt to obtain paperwork from us to help with a UK visa application. As a matter of course, our systems 'profile' transactions and anything that is unusual is investigated.

In order to protect ourselves, our customers, and third parties who might not have authorised charges such as these, we restrict credit card bookings for courses; if you're using the online form, we insist that:
a) The name on the credit card must match one of the people coming on the course
b) The full street address that the card is registered to much be given and that will be used as the address to which we send the course confirmation
c) The address must be within the same legal juristiction in which Well House Consultants operates.

These rules are a bit of a nuisance, but they're good news for the majority of our customers as they afford them extra protection. Users of the system will also note that we're using a registered secure server (and https rather than http) through which they enter their personal details.

If you're looking to book a course at our Melksham training centre on your credit card, but you're based in a different part of the world ... we can still help. Simply make a provisional booking through the online system to reserve your place, and call in to give us your details. We can often complete the security checks on the phone during your call, and if not we can usually get back to you very soon and look forward to welcoming you.

Posted by gje at 09:18 AM


Related topics: via article database

November 05, 2005

Rail services under threat - Swindon, Melksham ... and Newquay and Bicester too

Last night, we attended a meeting of the Melksham Railway Development Group.

Our train service is under threat; the secondary rail service from Swindon to Southampton is slated for withdrawal under the new Greater Western Franchise. In its place are just two trains a day with a proposal, so its seems, to run at least one of them at the time that's convenient to the railway operators rather than at a time that passenger demand calls for them.

Other cross country rail journeys are under threat too, but not to the same degree. The stopping train from Par to Newquay is to be cut by a third - from three journeys to two per day, and the new franchise only has to provide two trains a day from Oxford to Bicester via Islip. The regular Westbury to Taunton service that was introduced last year and seems busy is to be cut; there will be just three trains a day available if you want to make this journey, and the overnight sleeper from London Paddington to Plymouth and Penzance is for the chop too.

What are the government's intentions for the railway? A high level output statement is to be published in the near future and perhaps we'll hear. On the current bid, the stipulations are that the bidders should maximise the payment they make to the treasury, and run as punctually as possible. Requirements for services, especially on some of the stopping / secondary services that are vital to the transport needs of the communities they serve, seem to get scant regard. The consultation around the invitation to tender for these rail services was run in parallel with the invitation, so although the public consultation was (sort of) undrtaken it can have had no effect what so ever on decisions, and the Strategic Rail Authority which drew up the ITT has now been wound up and the conclusion of the process is to be carried out by bureacrats at the Department for Transport in London.

Regular readers here may have already found our "save the train" web site ... if you've not been there, I encourage you to make a visit. Train use has risen by nearly 8 times in 5 years, and we calculate a flow of some 100000 passengers on the line annualy. At this stage, the best way to help encourage an appropriate service on these secondary routes is to write, positivley, to ministers such as Derek Twigg and Alastair Darling at the Department for Transport, to the franchise planners and directors such as Roger Jones, John Gilbert and Paul McCarthay at the same address (76 Marcham Street, London SW1P 4DR) and to your MP and other representatives.

London is a long way from any crosscountry train services. The train from Melksham to Swindon takes 25 minutes, but by road the journey is double that. By bus (the alternative suggested), the journey involves at least one change and takes over an hour. Civil Servants at the Department for Transport just don't realise that it's just not sensible to leave Melksham (and the other communities I have mentioned) in the midst of a giant traffic jam.

Traffic has grown 35% in the last year. Another 1000 homes have just been approved for Melksham. The county records office is being built by the station in Chippenham. The roads are getting busier. Fuel prices are rising. And yet I understand that the new franchise is based on growth of 1 to 2% per annum in rail traffic. I don't know other lines, but I know ours; that forecast is plain daft ... unless you make it a self-fulfilling prophesy by forcing people off the trains by withdrawing them!

Posted by gje at 08:10 AM


Related topics: via article database

November 04, 2005

North, Norther and Northest - PHP 5 Objects

Here's a PHP example of calls to PHP methods to return the Longitude North of a place, the more northerly of two objects via an object (dynamic) method, and the most northerly of a whole array of objects via a static function.

$north = $ilike[17]->getlong();

$norther = $ilike[45]->northof($ilike[41]);

$northest = place::northmost($ilike);

To return a single longitude, we've used a property access method of the sort you'll have written a hundred times if you're an OO programmer.

To compare two objects, we've elected to run a method on one of the objects and pass the other in as the parameter; this method returns the more northerly object:

function northof($that) {
if ($this->lat > $that->lat) return $this;
return $that;}

Comparing a whole list of objects, our static method reads:

function northmost($these) {
$sofar = $these[0];
for ($k=1; $k if ($these[$k]->lat > $sofar->lat)
$sofar = $these[$k];
}
return $sofar;
}

Although this code was written and tested with PHP 5.0.5, I see no reason why these code snippets won't work in PHP 4.

See the complete application and complete classes file in our training modules area

Posted by gje at 06:15 PM


Related topics: via article database

Useful link: PHP training

November 03, 2005

Setting the file name for a downloaded document

When you're writing a script to send a file to a browser, you can force it to be saved as a file using a content type header, and you can give it a name different to your script by using a content disposistion. In PHP, you might write

header("content-type: application/octet-stream\n".
"content-disposition: attachment; filename=\"$var.txt\"\n");

Remember - if you're going to call the header function, you MUST do it before you send any output to the browser!

Posted by gje at 04:34 PM


Related topics: via article database

November 02, 2005

Double Dollars in PHP

What does this print?

<?php
$first = "fur";
$last = "feather";
$$first = "yum yum ";
${"$first$last"} = "yikes";
print "$fur $furfeather";
?>

It prints "yum yum yikes".

In PHP, you can write a variable name within a variable name, and that's what I've done in this example.

The variable called "first" is set to contain the word "fur"
The variable who's name is in first - so that's the variable called fur - is set to "yum yum"

The variable called "last" is set to "feather"
The variable who's name is made up of the string in the variable first followed by the string in the varaible last - so that's the variable called furfeather - is set to "yikes".

This is a facility to be used sparingly - it's quite easy to write code that's unmaintainable using such structures, though they can be very useful at times for helping to generalise code.

Posted by gje at 11:17 PM


Related topics: via article database

Useful link: PHP training

November 01, 2005

Different ways of selling

"We're looking for salesmen and not technical types / geeks". So said the advert in the entrance to the large store I visited with Lisa last night ... where their main business is computers, computer-based products and supplies. It added "We can teach you what you need to know about our products to sell them".

I'm technical / I'm a bit of a geek. And I've done a bit of selling too. I prefer to sell from a position of technical knowledge, and I prefer to be able to speak to the sales staff in stores at a level where they can answer my questions on both the product and the commercial aspects (like "how much?" and "is it in stock?").

The store we were in last night is the same one that I tell a story about on some of our courses ... I went into there (a number of years back now) and picked up a Linux distribution software package and walked over to the laptop display. "Will this work on this laptop?" I asked the three staff who approached me. "Yes" said the first. "No" said the second, and "I don't know" said the third. The third got the highest rating from me ... for his honesty. I went home to research the true answer online!

OK ... we don't employ a salesperson here, and I would never wish to have anyone who wasn't very familiar indeed with our courses and subjects doing that selling. I wouldn't take on a salesman who didn't even have a grounding in the things he would be selling. But I also appreciate the need for a professional sales approach which I hope we give ... and for sure, that does mean than many geeks might not be suitable.

Posted by gje at 11:01 AM


Related topics: via article database