« February 2005 | Main | April 2005 »
March 31, 2005
Harmony
Some tasks have a natural positive harmony; I find that's the case with training where an enthusiastic tutor, trainees who are attending because they want to learn, a good piece of software as the subject for the course, and a quiet and well thought out learning environment all contribute to a positive and enjoyable experience for everyone ... with any little glitches rapidly being corrected by the natural balance I'm talking about.
With the right approach, a sales deal can work with the same harmony. A product offered at a sensible price by a supplier that knows his product, and to a prospective customer who requires a product such as the one that's on offer. An ability for both seller and customer to listen to the customer's needs and the product on offer in detail, and to marry the two - perhaps with a little bit of flexibility and tailoring all around - to produce the right result for everyone.
Other tasks, alas, don't have that same natural harmony. At times, it's very hard for potential trainees to know whether they should book on beginner or intermediate, or intermediate or advanced courses ... and about 4 years ago we came up with a "quiz" tools where people could test our their knowledge online to get a flavour for their level. Alas, experience showed that the natural harmony wasn't there. People failed to celebrate getting 12 out of 15 questions right and rather grouched at getting 3 out of 15 wrong and, looking for "why" sometimes felt that these questions were poorly worded, off the topics that were relevant to them, too difficult, or just bad luck. I'm not sure that really was the case; I reviewed every question that was queried (and in some cases changed them), but I felt that the system as it was set up had, alas, a natural negative harmony.
The tragedy is that the quiz system, taken as a guideline is a very useful tool, and in the last few weeks I've revived it. Partly as an example of good CGI scripting using the 6 step and 4 layer models. And partly so that I can throw up a few questions at random in front of a class I've just met to help me help them get the best from their course. In the last few days, it's already proved its worth in both those areas.
So - how can I add natural harmony? I don't want to "dumb down" the tests like the school education system in the UK has been accused of doing. That would make the tests pointless. And I don't want to discourage reports about individual questions which could be clarified - feedback is vital. Tricky one, but I'm going to take three steps.
Firstly - a note on scoring. We set 15 questions, all multiple choice with on average 4 possible answers. If you get JUST TWO THIRDS of the questions right, you're showing substantial subject knowledge - the chance of getting that high a score by guessing is statistically insignificant. Please consider 10 out of 15 a good score if you're a user of the language in question; only folks like myself who have to know ALL the facets of a language to teach it can be expected to get a score of 14 or 15 as a matter of routine.
Secondly - I'm publishing a table of those statistics ... if you tried to answer every question with a random guess:
Chance of 0 out of 15 wrong is 0.00%
Chance of 1 out of 15 wrong is 0.00%
Chance of 2 out of 15 wrong is 0.00%
Chance of 3 out of 15 wrong is 0.00%
Chance of 4 out of 15 wrong is 0.01%
Chance of 5 out of 15 wrong is 0.07%
Chance of 6 out of 15 wrong is 0.34%
Chance of 7 out of 15 wrong is 1.31%
Chance of 8 out of 15 wrong is 3.93%
Chance of 9 out of 15 wrong is 9.17%
Chance of 10 out of 15 wrong is 16.51%
Chance of 11 out of 15 wrong is 22.52%
Chance of 12 out of 15 wrong is 22.52%
Chance of 13 out of 15 wrong is 15.59%
Chance of 14 out of 15 wrong is 6.68%
Chance of 15 out of 15 wrong is 1.34%
Here's the program:
$nquestions = 15; $noptions = 4;@pascal = (1,1);
foreach $row (1..$nquestions+1) {
$pnew[0] = 1;
for ($k=1;$k<$row;$k++) {
$pnew[$k] = $pascal[$k-1]+$pascal[$k];
}
@pascal = @pnew;
}for ($wrong=0; $wrong<=$nquestions; $wrong++) {
$chance[$wrong] = ((1/$noptions)**($nquestions-$wrong) *
(($noptions-1)/$noptions)**($wrong))
* $pascal[$wrong] ;
printf "Chance of $wrong out of $nquestions wrong is %.2f%%\n",
$chance[$wrong]*100;
$cr += $chance[$wrong];
}
print $cr*100," total\n";
Thirdly, to remind you that this a bit of fun and gentle guidance - it doesn't pretend to be anything more and we can't provide a detailed evaluation from such a short quiz. Having said that, go and enjoy. You can reach the Quiz front page from here
Posted by gje at 06:00 AM
More about Graham Ellis of Well House ConsultantsMarch 30, 2005
A little bit of fun - the new Perl Quiz
How's your Perl knowledge? I've just updated our Perl Quiz where you can try 15 questions at a beginner, intermediate or advanced level and see how you get on. There's also a MySQL Quiz, a Tcl Quiz and a PHP Quiz available.
We're styling the quizzes "just for fun". You're given 15 questions from the pool each time you take the test which is enough for the results to be statistically significant, but we can't control whether or not you're researching the answers in another window to get a high score ... oops - I didn't even mention that, did I? Yet although we're light-hearted in how we present the quizzes, I've already thrown up one or two pages of questions on the screen early in a new course to help me and my trainees gauge which topics I should be concentrating on, on what they already know. A huge help in making sure that I'm presenting the right training for each individual.
There's also a Quiz FAQ available if you would like to read more before taking a quiz.
Posted by gje at 06:00 AM
Useful link: Perl training
March 29, 2005
Putting a form online
I answered a question along the lines of "how much will it cost to put my [6 page] web form online" yesterday, and found myself coming up with a list of considerations, which I thought might be woth sharing as a checklist
... How many forms do you want your 6-pager converting into? (Don't do it all as one web form!)
... Do you want the data fields validated, and if so how / which ones?
... What technology do you want used for the data collection / emailing?
... What format do you want the email in? Does it have to feed another system?
... Do you have an ISP and a domain lined up?
... What artwork do you want on the completed conversion / is that artwork available?
... How are you going to prevent spammers from submitting forms?
... What about maintainance if the form is to change / how MIGHT it change in the future?
With all these unknowns, and a correspondent halfway around the world where costs are very different, I had to say that it was hard to give even a ballpark figure, but to listen carefully to potential suppliers and see whether they were aware of these aspects / asked the right questions.
For more and more web applications, I tend to be looking at code that formally goes through six stages (read form - read session - validate inputs - prepare for next form - save session - send response) as I suggest how people write code that they're going to use on a full live site, with the code split down into a top layer, business logic, web helpers and a template to aid re-usability and maintainability. It works just as well with a CGI or mod based language such as Perl, and an embedded language such as PHP. We have complete source examples in Perl and complete source examples in PHP available, and we can train you on the applications of these technologies too.
Posted by gje at 06:13 AM
March 28, 2005
Embperl
Most people use Perl scripts on the web to run programs that generate web pages, and they use PHP to write web pages that include programitic (scripted) elements. Both of these approaches work well.
But let's say that you want to provide web pages that include a bit of scripting, you know Perl already, but not PHP. Do you need to learn another language? No - you'll want to look at Mason, the Template Toolkit, or (my flavour today) Embperl. With Embperl, a few simple extra markers added to your HTML can allow you to drop in bits of code quickly and easily; it turns Perl into what I call an "HTML++" language along the lines of PHP.
Example - setting a variable in Embperl
[- $year = 1900 + (localtime())[5]; -]
and using that variable in the output:
[+ $html +]
Posted by gje at 12:12 PM
Useful link: Perl training
March 27, 2005
Responding to spam
I understand that I shocked someone the other week by purchasing a service that I had seen advertised in a spam email that was going the rounds. I feel justified ... I didn't purchase off the spammer, but rather the spam reminded me of a service that was available and I took the reminder to research the options and buy elsewhere. Even if the spammer's offer had been competitive, I don't think for a moment I would have wanted to encourage him, so I would have been prepared to spend a little more to go to a company who's marketing I was comfortable with. Good news - in this case, our new "lo call" alternative phone numbers cost us a fraction of what the spam ad site offered.
I understand that 1 in 10 people has responded to Spam at one time or another. I'm not sure where that statistic came from, but I heard it quoted yesterday on the BBC's technology update show; I suspect it's not far from the mark. And it's why spammers keep on doing it.
Many years ago, before spam was common place, I did an experiment; I sent out 33 unsolicited emails, to carefully targeted recipients who's email addresses I had found on line, telling them about our services. In those days, bulk unsolicited email was frowned upon but not illegal in any way, and I wanted to get a feel for how people would react. I got 2 or 3 "snottygrams" - people who didn't appreciate being contacted in this way and let me know it. And I got 4 or 5 good contacts ... and that 15% positive response rate is truely astonishing for a marketing campaign. I'm NOT advocating that you spam these days; I have never done it again (and I would not), but I present it to you as a piece of evidence that helps show why it's done.
Posted by gje at 06:55 AM
March 26, 2005
Easter at Well House Consultants
Good Friday - with shops and stores open (and online shops that never close), but with most of our customers off for a long weekend, what better day to choose to "make the rounds" of hardware stores and bookshops in Central London to see what's new and upcoming, and make some decisions on what we'll be providing as trainee workstations for the next year or so. We've got a further batch of laptops on order now, so that we'll remain on our target and provide a laptop that's less that 24 months old to all trainees ... even on private courses where we'll take up to a dozen trainees.
Easter Saturday ... I sit here, writing "The Horse's Mouth" and glorying in a chance to spend a few hours doing a bit of hobby computing. Since my work is my hobby, you may spot a few nice (but from a business viewpoint perhaps un-necessary!) additions on the web site.
Easter Monday - will be a full work day. A rare opportunity for the three of us to have a full company meeting and make sure that the wheel's we've been spinning, and will be spinning this spring, are efficient and taking us along in the right strategic direction.
"All Work and no play ..." they say. And you'll notice that we're working this Easter. Yes, but the beauty of having a setup like we do is that (when we don't have courses on) we can choose to relax when we wish and work when we wish.
Posted by gje at 09:53 AM
March 25, 2005
Politics gets nasty. Must be an election coming up.
Ever tried to find a good plumber in a hurry? Or (if you're a business) good cleaning or wait staff? If you have, you'll know there's something of a shortage of people who are prepared to do these jobs and to do them well. If you're a user of such a business and you come into contact with staff in these roles, you'll possibly have noticed that they come with a wide variety of exotic accents these days. Quite simply, there aren't enough people in the UK who'll take these jobs, and they're being filled (if they're filled at all) by new arrivals from overseas. It's unfashionable, but I welcome these people, and I would welcome more; this is a cosmopolitain country and it gains a richness of character from being such.
We're expecting that a general election will be called soon in the UK. The major political parties are all seeking the electorate's votes and one of the themes of both of the major parties seems to be "be tough on illegal immigrants". But they blur the line, and they seem to be playing on what they believe to be the xenophobic fears of the swing voter, also against people who would be of great benefit to the culture and economy here. They're being cynical, and it's ... well ... words fail me. I heard with horror the story of a mother and two children (Romainian and Irish) being pulled from their beds and bundled out of the country in the last couple of days; I don't know what awaits them in Romania, but I'm sad that what appears to be an overzelaous and perhaps illegal action by a government department (at the encouragement of its current political masters perhaps?) has bought some votes for the current incumbents and the expense of a family who, as far as I can see, had a total right to be here. It's 20 years after George Orwell's 1984, and it seems that the Home Office is now, a little belatedly perhaps, filling some of the roles of his "Ministry of Truth".
Posted by gje at 05:13 PM
March 24, 2005
Spring is in the air
What better time to share some new pictures of our training centre with you - those of you who've been here on public courses may spot a few changes. Here's a distant view of our grade 2 listed Spa house seen from across the fields towards Bowerhill. Although well connected, (just a short walk to the town centre, and on and A road), it's a quiet location which is just what you want when learning.

Training Center, across the fields

Gardens, and plenty of parking too

The training room awaits a Perl class
Posted by gje at 04:22 AM
March 23, 2005
STDIN, STDOUT, STDERR and DATA - Perl file handles
A Typical computer program is run from a single keyboard or other control point, but with access to thousands of files. So it's "cheap" for a programming language to open a connection and provide a buffer to that control centre (often known as "standard in" and "standard out", but impractically expensive to have connections open to all the available files. For this reason, most languages provide a function with a name such as open or fopen to provide a resource through which files can be read and written.
Perl is like this but (being Perl) goes a step further. The following file handles are open by default:
STDIN - Standard Input, for user control input, typically the keyboard
STDOUT - Standard Output,for regular use output, typically the screen
STDERR - Standard Error, for error output; typically defaults to the screen too
DATA - Input for data stored after __END__ at the end of the program
Here's an example program that uses all four of these special file handles:
while (<DATA>) {
chop;
$mname{$_} = ++$mn;
}
# seaweed - - [15/Jul/1998:08:32:38 -0400] "GET / HTTP/1.0" 200 1476
print "Which Host? ";
chop ($host = <STDIN>);
while (<>) {
($day, $month, $year,$page) =
m!^$host\s.*\[(\d{2})/(...)/(....).*(?:POST|GET)\s+(\S+)!;
if ($day) {
if ($page !~ m!^/!) {
print STDERR "YIKES ... $page\n";
}
print STDOUT "$day - $mname{$month} - $year .... $page\n";
}
}
__END__
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
STDERR merits a short extra comment. You may wonder why there are two outputs both of which, by default, are routed to the screen. The "trick" is that it's useful to have two separate file handles for use then STDOUT is diverted away from the screen - for example, when STDOUT is diverted to a browser or a file. In such a circumstance, the user typically doesn't want error messages going to the same place, but wants it to go to the server's error log, or to the screen, respectively. You'll find more examples of Perl's file handling in our File Handling module.
Posted by gje at 07:20 PM
Useful link: Perl training
March 22, 2005
x operator in Perl
So often, newcomers to programming try to use an "x" operator to multiply - and it doesn't work; they should use "*" in most languages. In Perl ... "x" means something different ... "replicate the string on the left the number of times on the right".
I've frequently been asked for a good example of where "x" is useful. Here's one - printing out the corret number of "-" signs to underline a title in a fixed width font.
print "who are you";
$name = <STDIN>;
chop $name;
print "$name\n";
print "-" x length ($name),"\n";
Further details in our Initial String Handling module
Posted by gje at 05:20 PM
Useful link: Perl training
March 21, 2005
Finding the right holes
Nothing to do with my usual writing here, but a piece I wrote as someone who very occasionally interviews, and is sometimes asked for my comments on CV and the like
At an interview, you have an exploration of both how person "x" can be useful to company "y", and also how company "y" can provide the work, environment and package that suits person "x". It's a two way street, and it works best if both sides give full and honest details.
By giving full information at or beyond what's the minimum needed and showing an openness to discuss these things, prospective employees can show
a) A desire to help the prospective employer make the truly correct choice
b) That they have thought things through on a personal level - especially important if you've got a relocation and family involved.
c) How they may fit into the actual job / skills you wouldn't have considered.
By showing the desire to work with (perhaps even giving information that won't effect the job and is personal), you're showing a level of trust, and that you're less likely to become a high maintenance "but my rights are xxxx" employee.
Interestingly, things that you consider could be a negative may in fact be a positive anyway for a prospective employer. It's a case of fitting square pegs into square holes, and round pegs into round holes.
Posted by gje at 06:42 PM
March 20, 2005
A West End show
We're in London and went to see "Whose life is it anyway" yesterday afternoon at the inappropriately named Comedy Theatre.
The play's about a very bright and "thinking" sculptor, who's left as a paraplegic after an accident. Although the doctors have done everything they physically can for her, she faces up to not being able to be an independent being any more and being institutionalised amongst professionals. Although we can see they care, the senior staff have to switch themselves off and put on something of a shell which provides utter frustration for Claire. She finds a small degree of solice in the refreshing attitude of the cleaners and trainee nurses but clearly she's not just going to be one to take her situation lying down. We see that develop during the latter half of the first act and come to a culmination at the end of the second ...
Not my usual light-and-frothy cup of tea, but I wouldn't have missed this one. Very thought provoking. And makes one realise just how .. trivial by comparison .. so many of life's little trials are. If you're in London while the play's still on, do look for an opportunity to go and see it.
Posted by gje at 05:52 AM
March 19, 2005
WIBNIF
"Wouldn't it be nice if". Acronym. I've been using it for years and I don't know where it came from; I suspect it's both my invention and that of others too; I claim in back to 1980.
WIBNIF lists are a great asset to an ongoing product or business. I have several - I keep short term ones in pieces of demo software that I'm writing, medium term ones for contract code, for course development notes and things to do to our training centre and longer term ones for "life, the universe and everything".
Things are added freely at brain dump times. Slips of paper on the passenger seat of my car get one or two word notes on them as I drive around the country (yes, I do pull over to make the notes safely) and then they get added back to electronic lists. Over time, many things get filtered out - the "light of day" and "after seeing what others think of the idea" reviews. And things that remain for a while will lead to a direction for the future. If we're still thinking about an idea a week or two later / if we keep coming back to it / it's probably a good idea.
Posted by gje at 06:20 AM
March 18, 2005
We dont stand still
Our "module" training system provides an excellent groundwork on which we build tailored courses to meet YOUR training needs rather than the needs of the nearest general case that we have available. A lot of work has gone into this system which makes it easy for us to keep our manuals up to date, and to automatically change our web site descriptions as content is modernised over time.
But we're not "resting on aur Laurels".
Now that virtually all of our customers are online when at work, we're moving the sample answers out of the printed notes and onto the web site, listed under each training module. We can supply a number of alternative answers this way, and we can supply them in such a way that our trainees can cut and paste from them and make further use of the examples.
We've also starting to split our courses into a series of major sections - for example, next week's private Perl course will cover
1. The Perl language
2. Glueing technologies (SQL, HTML, XML) together with Perl
3. Designing and writing classes in Perl
and from now on, the folders of notes will have additional dividers for the main sections to make them all the more useful as reference books after the course. Courses already divided in this way include Perl Programming and Deploying LAMP - I'm especially happy with that last one as the single action turns our note set of about 400 pages into an introductory guide to Linux use, Linux Admin, Web site structure, the Apache httpd Web Server, MySQL Deployment, reading Perl PHP and Python and a general section coveing overall good web site structuring, design, and commercial aspects of operation. Perhaps a publisher would be interested??
Posted by gje at 06:25 AM
March 17, 2005
An easy way out
Why is it that there can't be a single way that's guaranteed to get you out of ANY program?
We use programs such as telnet and ssh (and others) and we're used to running an exit command to get out of them - so why, or why, does it have to be quit to get out of FTP?
[Ctrl-C] (Control - C) will get you out of most programs in an emergency - like if you've written your own program that's in an infinite loop. But ... it won't get you out of vi. To get out of vi, you can use ZZ or :q![Enter] or two or three other alternatives.
All of which help to keep life fun and interesting ;-)
Posted by gje at 06:51 AM
March 16, 2005
Use me, but use me effectively
Have a question on an Open Source language that you can't find an answer to? In another walk of life, want to know about a travel and transport topic? Please feel free to ask and I'm only too happy to come back with comments, suggestions, pointers. I enjoy doing so - please do use me.
However, there are just a few occasions where I feel that use has lead on to ABuse.
A couple of hours back, I got a request for some help on Tcl; fine, happy to help - except that the same request arrived in two different ways ... to two different addresses that I don't think that my writer would have been able to associate. I felt - let's find wording - spammed with the question. And it lead me to wonder "If I've been asked twice, I wonder how many other people have been asked". No indication in the message that he was asking all around - it was worded as if it was individually done. Perhaps I shouldn't, but I've written back and asked my correspondent how many people he's asked the question of, and suggested that lets me know again, and more personally, in a few days if he doesn't get an answer to his questions from any of them ... it's just not an effective use of my time to be answering questions that someone else has also answered and are no longer of interest.
I also start to get concerned when I'm being asked for so much (free) advise that the requester would be far better off to spend a few days attending a course - especially as we actually run courses and that's how we make our living. The British "reserve" is great, but just occasionally I feel like saying to someone "hey - play fair - I've got to earn a living too" ...
For the remaining 99% of you, happy and delighted to answer those odd little questions that crop up from time to time, or give you a few thoughts on how "this" or "that" should be done. And if that's after one of our courses I'm double delighted and well into the spirit.
Posted by gje at 08:25 AM
Extreme training
Extreme programming methodology is becoming quite popular - we've got a user of the techniques with us on a course at present - and there's quite a bit to be said for many of the techniques involved.
Set a series of short studies / cases up and work through each with testing and frequent re-integration along the way. Modify the design frequently and early in the light of experiences gained while coding. Work in a team (of two) so that more than one person understands and that you have the power of two trains of thought together (yes, this does mean two people huddled over the same screen). Use "spike solutions" from time to time, where you look ways ahead and try out coding ideas to see if your development ideas will work, before coming back to implement the same scheme in a more thorough and robust manner.
We were musing over a coffee yesterday that many aspects of our training techniques are similar to extreme programming - so perhaps we should entitle it Extreme training. Concepts and subjects are covered interactively here - with new sample programs written from scratch on a projected screen, and with inputs and questions from the whole little group (it's a group of 4 on this week's public course where at the time of the discussion we were covering inheritance and more advanced object handling in Perl. Spike examples are generated from time to time, where a class member asks a question and we head off to explore a subject in more depth. And then we refactor towards the end of the session. The net result is a set of clean and clear samples, written with the trainee's help and clear understanding, which they can use further in their own work down the road.
It really works. I'm chuffed to see how our training is encouraging trainees not only in the mechanisms of the languages, but also in the direction of using the language well in an easy to develop and maintain and robust manner. Whether it's the framework for a generic base class in Perl (view here), or for a web based application in Python (view here) ... it really works.
Posted by gje at 04:22 AM
March 15, 2005
When to bless a Perl variable
Perl's bless function, which turns a reference into an instance of an object, it typically called up as the last action in a constructor method. On today's Perl for Larger Projects course, I was challenged as to when else it might be used. Here's an example - when loading a file of information into objects, in a method that's returning a whole list of objects:
sub fileload {
my ($class,$fname) = @_;
open (FH,$fname);
my @result;
while (<FH>) {
my ($thisclass,$breed,$age,$equiv) = split;
my %self;
$self{breed} = $breed;
$self{age} = $age;
$self{equiv} = $equiv;
push @result, bless \%self,$thisclass;
}
return @result;
}
Interesting, this code's also an example of the two parameter use of bless, where an object is being blessed into a class that's not got the same name as the current package.
Posted by gje at 07:52 PM
Useful link: Perl training
March 14, 2005
I'm not blogging it
Lisa was wondering whether to buy me an "I'm blogging it" T-Shirt. But I'm discouraging her. I look, I learn, I listen, I think and I write ... but I'm not into the business of writing about other people's daily lives and conversations that I have with them, even though (at times) they provide the inspiration. There's a number of ripping yarns I could write here but which I won't be writing. Sorry, folks - there are some things that can be great fun to read but would be an invasion of privacy and a betrayal of trust.
Oops - a pink elephant. I did not break the radiator. What AM I on about now?
Posted by gje at 06:28 AM
March 13, 2005
Getting your examples, my examples and the data files after your course
I'll encourage you to write practical examples that are relevant to you during training courses with us, and I'll also write demonstrations "on the fly" in front of you. That way, you go away having done something that's relevant, and having seen how programs are designed and written in the language that you're learning from scratch. I know this is unusual for training courses, and it's only practical for us to do it because of the long professional experience and deep subject knowledge of your tutor.
After every programming course, we email each trainee with a copy of all the programs that they wrote during the course, and with a copy of all the examples written by the tutor too. Examples that are found within the training notes are also available via links from our training module index.
To go with your programs, you'll want the relevant input data.
Surprisingly, there are some "issues" with that apparently simple and obvious request.
a) Some of the data files that we use are huge and would clog up anything except the widest broadband link for quite a while
b) There are licensing issues involved with some of the data files - we have copies that we're allowed to use, but not further distribute except under certain conditions that wouldn't be met with an automated forwarding system. See for example the DMOZ license
c) As enclosures, the data files might well be identified as spam or perhaps even as possible viruses by mail filter systems. Even when I have sent a file out by specific request in the past, I've got caught by spam filters.
d) Some of the data files contain our own information which we're quite happy for people to use on courses, but which we don't want to release into the public domain.
So - what solution? How can you use your program after the course? You'll find in our online data directory that you can view the first 20 lines of each data file, and you can copy and paste those lines freely as far as we're concerned. That way, yes, you can test your program, rerun it, and develop it on further to use what is, after all, the final intent of you attending the course - handing your own data.
Posted by gje at 06:02 PM
March 12, 2005
new 'Perl on the Web' example
I've been looking for quite a while to put together an example that uses sessions (via hidden fields or cookies) in Perl ... written to a good standard, with decent error messages, security and user feedback, and with the look-and-feel of the page separated from the code so that each can be maintained by someone who specialises in that area. Sample script now written, and will be used during this week's Perl on the Web course. Also available on our website ...
for testing at http://www.wellho.net/cgi-bin/demo/sweetest.pl
full source code at http://www.wellho.net/resources/ex.php4?item=p407/sweetest.pl
Posted by gje at 03:06 PM
Useful link: Perl training
March 11, 2005
Satisfaction of training
I'm writing this during a final-day practical on a Perl course - 10 trainees, coding quietly as mice, as they write a web page to calculate the length of ladder that Romeo needs to reach Juliet and present the results. The program is being written to "best practise" standards - the HTML is being kept apart from the Perl for easy maintenance, inputs are being validated, etc. And the code samples that I've written for them to follow are nicely inset and they're commented and documented with POD too.
There's a great feeling of satisfaction for me ... helping 10 people learn this exciting language and skiil; some of them have used the term "re-skilling" as they move to newer pastures from their traditional mainframe areas. It's great for them, it's great for me, and it's great for their employer as he uses their new skills too. It's this "win / win / win" situation that makes training so rewarding.
Posted by gje at 12:42 PM
March 10, 2005
Dress for training
Does it matter how I dress to train? To some extent, it does; I recall dressing in costume (as a black and white cat) a few years ago on Comic Relief day, and being told afterwards that it was very hard to have a serious meeting with a project manager (my role at the time) with a tail. But smart, comfortable casual is usually fine.
I went down for breakfast yesterday morning just before 7, dressed ready for training. Quite a posh hotel / restaurant. Plenty of space at that hour. I was quite - err - interested that I was taken to an obscure little table, around the back in a little cranny. Perhaps my looks don't fit. Or perhaps the guy was filling the restaurant from the rear. It'll be most interesting to see how they seat me in a few minutes from now ...
Posted by gje at 06:44 AM
March 09, 2005
Conventional restraints removed
IT without boundaries So say the coffee mugs where I'm training this week - a company motto that seems very appropriate when I'm teaching about Perl's lists. Most languages allow you to define a whole series of values in a single variable (an array), but if you're writing in C or Java, you're probably used to having to define the number of elements, and the size of each element, ahead of time. Perl is different - with Perl lists you can simply refer to the list for the first time and it will be created, and you can save as many values as you like into it and the list will be extended as need be to handle your request.
I must be fair to C and Java, though. In C, you can use calloc, malloc and realloc to dynamically assign memory if you wish and Java's Vector and ArrayList classes also let you set up a dynamic container in a similar way in that language.
Posted by gje at 05:37 PM
March 08, 2005
What and why for the epoch
The Epoch occurred on 1st January 1970 ... at midnight, at the start of the day, GMT. It's an important concept in many programming languages, which work with times and dates before and after the epoch - it means that you can compare dates and times easily, even where month ends and different timezones are involved. It's a pity that "now" in epoch seconds is displayed as a somewhat meaningless 1110304887 whereas you might prefer it to be displayed in a format such as Tue, 8 Mar 2005 10:01:27 -0800. The Perl language includes converters to translate between Epoch seconds and "human" time, as do PHP, Python, and Tcl/Tk - and they provide a powerful mechanism to calculate with times which otherwise would be an awkard mixture of modulo 7, 24, 52, 60 and 365 arithmetic.
Computer systems that run with 32 bit addressing (with one bit reserved for a sign) will "run out" of epoch seconds in the year 2038; perhaps that will be our next big "year 2K" issue. More likely, 64 bit systems will be in use throughout by then and the issue won't be an issue.
As a footnote, not all software uses epoch seconds. The software that we use for our internal diary system (not something we wrote ourselves) uses days from 1st January 0 - the year zero.
Posted by gje at 05:57 PM
March 07, 2005
Difficulties with a trolley
A poor decision but a great insite. I'm in a hotel "a couple of hundred yards" from the place I'm training at this week, and I decided to leave my car here rather than load it up with all the equipment and drive "round the corner" to unload it again. After all, I have a wheeled trolley and the road crossings all looked like they were disabled-enabled (if you know what I mean).
I'm always thankful to be fit and healthy. But I now realise just HOW thankful I should be.
It's not much good having a slope down if it only goes halfway down
and still leaves a lip; approaching across a road, I walked siren-like to an up-ramp to find that it started with an up-step and I was stranded in the road as the traffic lights went green.
Neither is it much good having ramps onto the pavement at one spot just to have, a few yards along, another curb and entrance way to a factory that's got an awkward step down and then an awkward step up ... before the next road junction which again has the half-ramps! Use the other side of the road perhaps? Not a chance - that pavement's closed by building works.
I'm sure that the responsible council here in Leeds would give me a number of reasons, perhaps including some good ones, as to why the journey on which so much money seemed to have been spent to make it "wheelchair friendly" was quite the opposite.
Posted by gje at 06:09 PM
March 06, 2005
Crossfertilisation, PHP to Python
Rasmus Lerdorf's "Do you PHP" talk on our Geek Cruise last October was brilliant - I heard so much about what's behind PHP and how its originator intends it to be used that it give me a real strong understanding of best practise - you'll find further details availble here and elsewhere on this site.
Python is a superb language with a different target user base / footprint to PHP. From time to time, the footprints overlap and I find myself putting Python applications on the Web from time to time. Using the best of both worlds - the strengths and knowledge of both PHP and Python, you can put together some superb "Python on the Web" applications. For training purposes, I've put a script onto our web site - you can run it through this link and link to the source (it's hsapp2.py in the course examples) as well.
The Python application looks simple - but all the ingredients you'll need are there ... picking up information from forms, sticky fields, sessions, session cart tidy ups, template files and the rest ... all within just a few K of code. And the application is well designed so that it can be easily reused, updated, maintained and extended. I've just finished writing a 10 page description of this application to be included in our public Python course, but that's a fairly intensive three days and there won't be much time to go through the details of what, for Python, is a bit of a specialist area. If you're booking a private course we can tailor it to give you full coverage, or you can arrange an extra day at our training centre to cover it after a public course.
Posted by gje at 08:50 AM
Useful links: Python training, PHP training
March 05, 2005
Tapping in on resources
When it comes to producing new examples for a course, where better to look than close to home? Yesterday, I was looking for an example to use when I was covering object design in Python and I hit upon working with taps and the water suppy to them.
Looking around, we have quite a few taps here; several of them are in the training centre part of the building (the first two that I've pictured) and others are elsewhere.
The taps differ a little - some are mixer taps, others (such as the outside tap) are cold only,and the tap in the kitchen is a spectacular tap that I've christened to be a "supertap". Together, these make a great example of a base class and the ability to define inheritance.
Our sample application went further. We defined connection objects which describe which mains supply each tap is connected to in the building, and we then define a maximum flow through that connection. This allows our python application to know when there isn't enough capacity available when someone tries to turn a tap on.
If you're writing code in an object oriented language such as Python, it's important that you think carefully about the objects that you're dealing with and specify the classes and methods that you'll be using as carefully as possible at the start. On many of our courses, we include modules on object oriented design in order to help you save time in the long term by getting tings right from the start.
It's only when you start working with classes in this way that you realise just what a powerful resource they are ...
Posted by gje at 08:26 AM
March 04, 2005
Preparation for a day's work
Yes, I'm writing "The Horse's Mouth" very late today. It was one of those days where the early morning before the trainees arrived leaked away like water between my fingers, and sending the PHP examples that yesterday's trainees wrote on to them and getting ready for today's tailored advanced Python session took priority. I end the day tired, slightly shorter of words than usual, but exhilarated at some new examples written. And two more happy customers are heading back home for the weekend.
Posted by gje at 07:09 PM
March 03, 2005
How to get the best from your supplier
I dislike chasing late payments. It's such a waste of time and effort that could be better used elsewhere.
There are still a number of companies out there who seem to feel that they don't need to pay us until they're reminded that their money is overdue (and we bend over backwards to accommodate your systems too). Or they feel they can say that "the cheque will be in the post today" then sit on it for a further 5 days (and need further chasing). But what are such companies really doing? They're saying that they don't really value their relationship with their suppliers - that as far as their concerned, it's quite OK for them to lie about payments and to make a nuisance of themselves by upsetting other companys' cashflows.
I'm often very tempted to ask people that I'm chasing for payment whether they have been paid their salary for the month of (names historic time when course was run), or if they would be happy if their money was due at a certain date but all they could get was a promise and not the actual payment.
I'm a geek - love doing my technical work and if people play fair with me I'll go 120% of the way to providing them with assistance above and beyond the call of duty, and do it with pleasure. But if your company "strings us on" on payments, I find it very hard to be motivated to provide this extra service - that's just human nature. Another sad thing about human nature - once a fence is broken like this, there's no instant repair.
Posted by gje at 07:52 AM
March 02, 2005
Giving customers best value
Have you ever felt "stung" by the cost of a phone call? The opening up of the telecoms market in the UK has lead to some fabulously good prices, but also many opportunities for people to offer expensive services - and it's often a case of "snooze and you loose".
In order to keep the cost of telephoning us at Well House Consultants as low as possible for our customers, we've added two new phone numbers - we can be reached within the UK on 0845 8382 404 (voice calls) and 0845 8382 405 (fax calls). These are designated as Lo-call numbers and intended to be similar in price to you making a local call even if you're at the other end of the country.
We've paid a setup fee for these numbers, but we don't pay any extra for calls you make to us using them; all we're doing is trimming the profits of the organisation that looks after the calls to our geographic number. No longer snoozing and letting you pay for it.
Posted by gje at 07:27 AM
March 01, 2005
Diverse activities
What a diverse repository of information I have become. I was writing about the Suliman Mosque, the Blue Mosque and the Tokapki palace in Istanbul at first light, discussing the copyright issue on postcodes and block postcode lookup databases during the morning, and here I am this afternoon reviewing Regular Expressions on "Opentalk" and helping people debug PHP. In between, I've added a web access pie chart page to our web site, and written an email expressing my opinion as to whether we should go and see Paul O'Grady recording a TV show in London next month ...
Posted by gje at 02:48 PM