« March 2005 | Main | May 2005 »

April 30, 2005

Using a Python dictionary as a holder of object attributes

Have a great bank holiday, folks. For any sad (or happy) Python programmers out there, here's a simple example of __getattr__ in use. I've got an object of type thingy with all its atributes held in a dictionary, but I wanted to access them as if each was a separate attribute. "I couldn't find a simple example elsewhere, so I wrote one"

"""Using a dictionary as an attribute handler in Python"""

class thingy:
def __init__(self,indict):
self.stuff = indict
def __getattr__(self,which):
return self.stuff.get(which,None)

about = {"colour":"blue", "type":"flipchart marker"}

markerpen = thingy(about)

print markerpen.colour
print markerpen.age

Further examples at our module pages or learn more with us on our Python course

Posted by gje at 02:09 PM


Related topics: via article database
More about Graham Ellis of Well House Consultants
Useful link: Python training

April 29, 2005

Pricing strategy - simple and fair

I'm proud of our pricing model.

We're able to offer courses at prices that are good for the customer, fair and easy to understand. Pious claim? Maybe, but I prefer to work with and within a scheme that I can stand up and believe in ... but of course, it needs additionally to bring in a fair income.

A part of my "fair and easy to understand" clause is our policy of offering courses at a (low) quoted list price and the offering very few discounts, then only in very specific circumstances. If you send two people on the same course, or book a private course but can't find a week that every member of your team is available then - yes - a lower price for the second person or the team member who comes on the public course is justified and willingly given.

Yes, people do ask for discounts ... but usually they'll book and attend anyway once we've spent a few minutes explaining our policy; they come to appreciate that giving them a lower price would mean that we would have to charge a higher price to the person sitting on the next chair to them and that our business isn't one where "the price you pay is the most we can squeeze out of you".

Occasionally ... very occasionally ... someone backs themself into a corner. "I'll only come if you can offer me a special deal along the lines of xxxx". Sorry, sir/madam; we're not in the business of cheapened discounted courses, and people who want such courses will typically delay their payment to the last possible date too - one memorable case recently strung us along for (err) much longer that I like as "The EU is paying for this training ...." ... and of course in the end that didn't come through. A couple of "there's a cheques in the posts"s and ... finally ... payment when we threatened interest and collection charges would be added.

You'll see no mention of agents / resellers in the text above. That's intentional. We're quite happy for people to make direct or indirect bookings, and for the company that's making the indirect booking to charge their client for their added services. We're also delighted for such an agent / reseller if they're able to combine several of their clients onto a course and save themselves some money ... acting rather like a wholesaler. Where an indirect booking is made, we do take extra steps to ensure that the course booked is the right course for the trainee.

Posted by gje at 08:52 AM


Related topics: via article database

April 28, 2005

Python generator functions, lambdas, and iterators

Python provides a number of useful "extras" on functions and methods beyond what's basically needed in a cruder language. But some of the names / facilities can confuse. Here's some clarification

Lambdas

A Lambda is a function written in a single line in Python - rather like an anonymous function in Perl

Generators

A Generator is a function which doesn't do all of its work at once. Rather, it works until it has worked out part of what it has to return which it then passes back through the yield keyword ... and it then resumes when required to work out the next return value

Iterators

An iterator is returned by a generator function - in other works, it's Python's mechanism through which a fucntion can be used to "drip feed" the results back to a calling program rather that have it fed back all at once.

You would use a generator to produce an iterator if you had a huge amount of data to handle. If you're looking for a simile (or is that a metafore?), you could compare a regular function call like asking for a bucket of water (and that will quickly get very heavy) and you could compare a generator function to being rather like having a tap on the end of a pipe which you can turn on and off and get as much water as you need (no real limit) all in manageable quantities.

You'll find some code examples linked from our Functions and Modules in Python training section. We have Python courses available too.

Posted by gje at 08:31 AM


Related topics: via article database

Useful link: Python training

April 27, 2005

Course follow-ups

Training is a great line of work for the small business such as Well House Consultants; we can deliver an excellent and personalised service, and our customers don't rely on us being around to provide after sales service ... buying a course is NOT like buying a vacuum cleaner where you want to be reassured that you can go back into the shop later if you need spare parts or if it needs a repair. So organisations big and small place business with us without a lot of checks into our long term viability. We make it even easier for them by NOT requiring any up front payment either (though we may ask for a credit card guarantee or a deposit if we're not dealing with a well established UK organisation). ((Link to full terms and conditions))

But then ... we're delighted to end up providing MUCH MORE than the customer expects in terms of after sales service. From my postbag (or rather my email box) "How do you ever find time to answer all the stupid questions raised by the ever-growing ranks of your past students". Not only do I find time, but I delight in finding the time to answer questions that are very rarely stupid. It's our lifeblood

a) It helps me know what people are asking about after the course so that I can consider including it or clarifying in the future

b) It helps people who have got stopped on what is, perhaps, a tiny issue that they can't see the way round to move forward - chances are that I've "been there before"

c) Via our forum, it helps build up a library of answers that can be of service to others whether our customers or if they find us via Google

d) And it helps in our business development by keeping us in positive touch with a wide range of contacts - networking with folks who may want further services from us, or who may tell others about us.

Here's an example - a follow up to a question about extending lists in Perl - we cover advanced lists and hashes on our Perl for larger projects course.

__START__

# Autovivification in Perl

# When you print out a new element of a list, that new element
# is NOT created. However, when you print out an element of a
# list within a new list, that new list IS created; it has to be
# so that Perl can work out the extra stuff it needs. So

# First example - print $stuff[2] does NOT extend @stuff

@stuff = ([10,20],[30,40]);
@more = (50,60);
print $stuff[2],"\n";
push @stuff,\@more;
print "@stuff\n";

# Second example - print $stuff[2][2] DOES extend @stuff

@stuff = ([10,20],[30,40]);
@more = (50,60);
print $stuff[2][2],"\n";
push @stuff,\@more;
print "@stuff\n";

# Graham

__END__

earth-wind-and-fire:~ grahamellis$ perl prd

ARRAY(0x801180) ARRAY(0x8012dc) ARRAY(0x809f24)

ARRAY(0x80cb08) ARRAY(0x80cb44) ARRAY(0x80cb68) ARRAY(0x809f24)
earth-wind-and-fire:~ grahamellis$

Posted by gje at 09:02 AM


Related topics: via article database

April 26, 2005

Elegant languages - Perl, PHP, Python

I'm running a private Python course this week (and next week is the public Python course). So ... I'm thourougly enjoying myself this week with reminders of justy how elegant Python is. Yes - the same can be said for Perl and PHP ... these days, I'm lucky that I can choose to train only in languages that I think are really great

Posted by gje at 12:09 PM


Related topics: via article database

Useful links: Python training, Perl training, PHP training

April 25, 2005

Why are we no. 404

It's always struck me as very odd that we're in a street that starts at number 394 and goes up from there - we're at 404 and it goes up to about 412 or so. There's lots of letters in there too - 398A, 404A, 404B. I'm quite used to USA addresses including block numbers (thus 7311 for relatives of mine who live on a 6-house street) - but in the UK?

Over the Weekend, I think I may have found a solution. Lisa and I walked across the fields to another quarter of the town and there, on Snarleton Lane, we found a similar scheme ... house numbers in the 300s on a quiet lane, with lots of "A" and "B" fillins on what looked like the newer properies.

I conjecture that the houses in the parish of "Melksham Without" were numbered in a single sequence without street names some 100 to 150 years ago, and that this numbering has stuck to this day, but with the addition of street names.

Other evidence for my theory? I know of at least one local village where, to this day, most of the houses don't have street names. And perhaps I should go out next weekend and test my theory further be looking for houses in the 150 - 250 number range on the North side of Melksham - perhaps on the back lane from Melksham Forest to Lacock.

Posted by gje at 04:50 AM


Related topics: via article database

April 24, 2005

Object Orientation in Tcl - [incr-Tcl]

For medium sized to huge projects, an Object Oriented approach to programming can pay massive dividends at (perhaps) the initial cost of a longer design phase and class testing.

Tcl is the oldest of the Open Source languages that we offer courses on, and it's a command based language that was written around structured programming techniques. Is it Object Oriented, then? Not as such - although the Tk GUI uses something that's rather akin to an object for each widget.

The [incr-Tcl] extension to Tcl provides a way of adding a true, full OO capability to Tcl. It's automatically provided these days as part of the ActiveState Distribution of Tcl, and it comes with most of the Linux and Unix distributions too. And it's a well implemented OO capability that extends Tk's widget philosophy. It even includes multiple inheritance if you need that sort of complexity.

I've put a short [incr-Tcl] example into our solutions centre ... and articles on other difficult-to-answer questions there and also in the [incr-Tcl] training module examples.

[incr-Tcl] is briefly covered on our Tcl Basics course, and we can provide additional coverage as necessary via Extra days or on private courses

Posted by gje at 10:05 AM


Related topics: via article database

Useful link: Tcl training

April 23, 2005

MP for Devizes, Wiltshire

I've missed my opportunity to stand in this general election. Nominations closed at 4 p.m. last Tuesday.

OK - I admit it - it was never a serious idea but I do feel that there's a desparate need for a number of independent MPs who aren't afraid to say what they think and to provide a fresh questioning of what's proposed for the country.

My manifesto

"I'll honestly tell you my views as they are today. But as I learn more and as situations change, they're liable to pragmatic adjustment. Probably not too much will change in what I'm thinking, but I'm not going to promise that. Politicians make too many promises already."

I'll question and vote as I see fit - with the medium to long term security, prosperity, health, education and enjoyment of this country, the people who live and visit here (especially in the Devizes constituency and the rest of Wiltshire), and of the rest of the world as my strategic view. And that strategic view will help me decide shorter term tactics - whether or not any particular idea is a good one.

I've lived within the Devizes constituency for over 25 years and I love the area. I'll be delighted to represent its local interests and champion its people and places, including issues brought to my attention. What I won't do is set short term policies in line with what will be popular - in other words, I'll look to the longer term and not buy your votes and approval with populist policies.

I can (and will) say "I don't know" or "I don't have a view" sometimes / on some subjects. You can't expect that I'll be able to form an opinion on everything and if I did, some of those opinions would be very shallow. Where I do have an opinion, you may not agree with me - but please VOTE FOR ME ANYWAY as opinions need to be independently aired.

Perhaps I should start hawking these views around now, and build up a head of steam so that I can stand in 4 or 5 years time from a flying start. Or perhaps I'm not tough enough for the inevitable cut-and-thrust and harsh words and attention.

Posted by gje at 06:07 AM


Related topics: via article database

April 22, 2005

Colour blindness for web developers

What does my web site look like to a colorblind visitor?

Thanks to the "Mining Amazon Web Services" book, I cam across this cool web site that simulates how your web page may look to a color blind visitor - it's at http://www.visicheck.com.

Here's a page about our "Of Course" newsletter as it would be seen by people with three different forms of colourblindness.




From top left.
Deuteranope - a form of red / green colour blindness
Protanope - another form of red / green color blindness
Tritanope - a rare blue / yellow deficiency
Control - the web site as seen by a user with regular vision

Note - these images are available larger. Simply click on an image with the right button (use CTRL-mouse on a Mac) and view the image in a new window.

Note - please use these images for guidance only. We suggest you look at the vischeck site and read their disclaimers and comments carefully.

In the UK, The Disability Discrimination act requires that providers of services take reasonable steps to make those services as accessible to those with any form of disability as they are to people without the disability. We have a training module available on the subject (it's available for free download as a .pdf too. As well as other DDA subjects (such as font sizes), this module also introduces the UK' privacy and data protection laws and a number of other topics you should be aware of.

Posted by gje at 06:49 PM


Related topics: via article database

Checking that all our servers are up and accessible

We run a number of domains (around 50) on different servers (around half a dozen) in various locations in Englnd, Germany and the USA. How can I keep track of them all / do a quick test to chek that - at the least - they're all online to the Internet? And how can I do that test from anywhere I happen to be with a net connection ... even if I'm in a remote location at an Internet cafe or customers's machine?

There's a script on our main web site (and various backup copies on other sites) that uses Expect to "ping" around a domain on each server ... and it then reports the results to the browser. Because expect can support a number of processes in parallel, performance is fast, even if a number of the servers are down.

We're trainers. Love to tell people how we do things. So you can read a bit more about it in our resources centre, try the script out in our programs directory and even view the source code. If you want to learn how to write this sort of thing for yourself, have a look at our Tcl course.

P.S. The script actually doubles up ... run on our own network, it provides a quick and easy way to see, at a click, which training systems are on the network and whether we're connected to the Internet at the current time.

Posted by gje at 03:00 PM


Related topics: via article database

April 21, 2005

Automating regular manual procedures

Do you want to automate a process that you normally run manually? If the process runs from a terminal window (or can be, even if you normally use a GUI), then have a look at Expect. With Expect, you spawn the process you want to automate, then programatically send inputs to it and expect responses. Very neat, very clever.

Expect is an extension of the Tcl language which gives you full capabilities of processing the results that you get back from the automated process, making conditional decisions and running loops based on the results returned.

If you want to run Expect through a GUI, you can do so using the Tk extension to Tcl, and if you want to run it via a Web interface, that's very practical too as you can run Tcl and Expect from your web server.

Posted by gje at 07:06 AM


Related topics: via article database

April 20, 2005

What career opportunities for web designers

Q: What are the current opportunities for someone coming into the web design market = perhaps a technical person coming back in after a career break?

A; There's a lot of web designers around - a glut of people who'll tell you they can put a web page together (and they can, ranging from high quality pages to ones that neither look great nor contain the information needed). A great deal of their ongoing income may come from updating the owner's site when the owner needs to change his prices or announce a new service.

Folks who are looking for a site that they can much more easily update for themselves, or can take online orders or inputs from their customers are finding it harder to find the type of techical person who can help them with this and if I were I coming back into the market, this is the sort of area I would be looking at. The person or team who puts such a site (which is really a web front end to an application) together needs / need to have a wide range of skills - Graphics art and HTML skill for the look and feel, human engineering skills for site navigation, data warehousing and data mining technique knowledge, programming skills (and systems analysis too so that they can decide which is the effective way to program), and a bit of knowledge of (or interest in) the product / subject being covered by the web site is some help! Having been "around a bit" can help put you into a much better position to undertake such a role than a youngster, or than someone who had previously been on a single track.

Server side applications are "loaded" towards more complex systems on the website / servers, but keep a very simple structure on the client side. In other words, the web site visitor has just a browser at hand and may not even realise that he / she is running an application. Our web site is rather like this - you'll *think* you are seeing plain .html pages in many places, I suspect ... but in practise subtle adjustments are made bearing in mind how you arrived at the web site and where in the world you're browsing from. In many other areas a whole series of pages are in fact generated by a single program, but hide under a series of URLs.

What do you need to learn / to get into this area of work? It's a young market so there's a number of technologies that can be used. In your shoes, I would look at Java, I would look at .net, and I would look at PHP. Java / Servlets / JSP are a good solution for the huge system; a big bank might put its whole online system up through Java. You'll probably find a number of such systems in use / developed in larger towns such as Swindon and Newbury and a lot in major technology centres such as Reading and Basingstoke. If you're looking for a place in a larger team this could be a good route to go, but Java is not ideal for smaller systems - a lot of overhead for security and expandability which isn't needed for many sites. .net is the Microsoft product, and on the web Microssoft only has around 20% of the server market and that's not growing. Not really my product - if you choose that route I would wish you good luck and not be able to suggest any best place to go for training. We're fortunate in being very busy and being able to train only on technologies that we really believe in. And for a pure web-based application, I would go for PHP these days. With PHP you can very quickly start adding programatic elements to a web site and (with time to learn) you can rapidly start putting significant elements in. PHP is available on around 1 third of domains worldwide - rather more that .net - but it's a bit of a hidden secret as it's "Open source" that doesn't have a huge corportaion marketing it. It's usually chosen for its technical suitability.

Many web sites want similar code to others and in PHP, much code is bundled into appropriate functions so that you can often code a big variety of sites from a single template application, and perform quite specialist checking in a singleline. There's also a growing library of independent application code in PHP, much of it also available under Open Source licenses, and more and more the job of the web site engineer is to tailor and integerate these with some programming work but much other assosciated tasks. Our own site runs 2 or 3 standard applications such as these, with various bits of tailoring.

You may also heard of Perl as a web site language. Yes - excellent langauge and you can do a superb job with it. But to some extent the "pure web" application areas have been overtaken by PHP. Perl is still, perhaps, the best choice for APPLICATIONS which are largely web based but have other significant needs - many of which are company's intranet applications.

So what am I suggesting? I would tend to suggest that PHP might be the best route for you if you're looking for a job that you can do as part of a tiny team or on your own, or Java if you're looking to get back in as a cog in a wheel at somewhere like a big bank. Having said that, there are niches of other langauges in use at these huge companies. Many are our customers.

We run a public PHP Programming course, 4 days, which I am delighted to welcome restarters on. We've a "technologies for PHP programming" day that preceeds it but that's only needed by a small proportion of people these days. We also have a more advanced "Object Oriented programming in PHP"i day - that's not where to start and it may (or be not) something you would want. But that can be a later decision. Indeed - if you're not quite ready to jump into the PHP course even after reading the above, we would be happy for you to visit for an hour or two to talk it through further. I'm really NOT interested in selling people a course they're not sure of - it's too important for that and we're very much busy enough with people who are on right course and are sure of it!


Posted by gje at 07:00 AM


Related topics: via article database

April 19, 2005

The Iconish language

Do you speak iconish? I don't, and it lead me into a bit of a problem yesterday. Checking in to the site I'm training on, I was directed to fill my details in on a touch screen. Clever system - I poked at the Union Jack and up came a page with a keyboard diaplayed and I was asked for my last name ... duly entered on the keyboard on the touch screen, and my full details and internal contact are displayed.

Great. But what next?

"Err - what do I do now" I ask across to the security guy. "Has it printed a badge for you?" he asks. No, it hadn't. And he goes to the manual system of hand writing a visitors badge ... he's about to call my contact when my contact arrives; it seems that the system has emailed him to say I've arrived - very clever but I would have appreciated that feedback!

So what's all this about Iconish? Same procedure this morning ... except that when I got stuck, an employee who I happened to know came over and suggested that I press a little picture which (in hindsight) looked rather like a badge. And - magically - the system advanced to a further screen that asked me to agree to a nondisclosure agreement. Duly done, and an "E" icon let me select to send myself a copy of that agreement. I'm starting to learn Iconish, I think.

For a location where the same visitors come back time and again, I've no doubt the system is great. For a first timer, it lacks instructional feedback; I usually think of myself as being reasonably bright but until one or two things were pointed out by a human I couldn't work it. A great objective lesson for designers, especially, of web sites where newcomers will simply walk away if they can't work out how to use the site.

Posted by gje at 07:13 PM


Related topics: via article database

April 18, 2005

Natural or man-made?

I remember a beautiful sunset that went on and on. Seated on the back of a narrowboat on the Grand Union Canal, this beautiful red light in the sky at dusk. Ah ... but as time passed and it didn't fade, we realised that it was the lights of Milton Keynes over the brow of the hill.

I've just returned from Breakfast at "The Cadger's Brae" on the outskirts of Falkirk. A grey day, close to rain but not really raining and a colourless sky with just a few wisps of grey that are changing to white. Then I realised that the white's moving rather faster than cloud and come to realise that I'm seeing steam from the coolers at Grangemouth oil refinery.

Posted by gje at 07:48 AM


Related topics: via article database

April 17, 2005

Short weekend

Short weekend, short entry!

We've been so busy that I was only able to offer a customer who needed tailored Apache httpd - Tomcat - PHP - MySQL deployment training (with load balancing and fail over redundancy throughout) a Friday and Saturday slot. And today (Sunday) I'm spending the afternoon driving to Scotland to start a Tcl course on site first thing tomorrow. Should be a lovely afternoon for a drive, though!

Posted by gje at 09:59 AM


Related topics: via article database

April 16, 2005

What they are saying about our OF COURSE newsletter

We have to "blow our own trumpet" occasionally. Reproduce with permission ...

Hi Graham & Lisa,

I just received the most recent "of course". WOW. Absolutely drop-dead gorgeous. And great copy, throughout. What a pleasure to re-live this cruise in such a FUN way! Thanks guys!!

What's the chance of me sharing this with our group ... do you have a PDF of the magazine I can pick apart and then post (with your approval)?

BTW, congrats on hiring a new person. Business must DEFINITELY be getting better. Yes, I noticed one of your classes sold out, too. I'm very happy for you guys. You have an excellent business model, and execute quite "brilliantly" :-)

Warm regards,

--

Neil R. Bauman, Captain & CEO
Geek Cruises (www.GeekCruises.com)
A Division of Int'l. Technology Conferences, Inc.
1430 Parkinson Avenue, Palo Alto, CA 94301

650-327-3692; Fax: 928-396-2102; Cell phone: 215-519-0141

"Of Course" is a printed piece that you can get us to post to you or you can get a copy from our download centre. We keep a list of contents of previous issues available too.

Posted by gje at 07:08 AM


Related topics: via article database

April 15, 2005

Spotted - the local MP

There has to be an election coming up because the local MP (Member of Parliament), Michael Ancram, was spotted in the town the other day. I'm told he looked very bored and was shaking hands as if it was something of a chore. Referred to a personal letter on the back of his handout when asked about his immigration policy ... which was a bit of a cop-out as, reading it later, the letter doesn't answer the question. Rather confirmed previous views and a previous encounter.

I'm deeply concerned about certain policies of all the major parties. Huge disquiet about Iraq - there might have been a good reason for us to go there - I can't imagine Tony Blair siding so closely with George Bush if there wasn't, but I feel we've not been told the truth. The Tory (and some of the other) bash-the-immigrant by confusing-illegal-asylum-seeker-with-needy and calling on people's Xenophobia is abhorent, and the Liberal's tax and spend seems like it's a sure way to bring back the brain drain and continue to remove the Great out of Britain.

I do know that my vote won't count anyway - label a sheep as "Conservative" around here an it would be elected. And I do know that Michael's visit to Melksham was counterproductive - at least in terms of our votes.

Posted by gje at 07:01 AM


Related topics: via article database

April 14, 2005

Getting a list of unique values from a MySQL column

Would you like to get a list of all the different values in a column? Use the DISTINCT keyword. Here's an example:

mysql> select * from train;
+-------+--------+-------------+-----+
| time  | length | destination | tid |
+-------+--------+-------------+-----+
| 07:05 |      1 | Salisbury   |   1 |
| 08:18 |      2 | Swindon     |   2 |
| 09:05 |      2 | Southampton |   3 |
| 05:45 |      1 | Swindon     |   4 |
| 10:35 |     12 | Plymouth    |  10 |
| 13:49 |      2 | Swindon     |   6 |
| 14:20 |      2 | Salisbury   |   7 |
| 17:07 |      1 | Swindon     |   8 |
| 18:18 |      1 | Salisbury   |   9 |
| 13:00 |      6 | Windsor     |  11 |
+-------+--------+-------------+-----+
10 rows in set (0.04 sec)

mysql> select distinct destination from train;
+-------------+
| destination |
+-------------+
| Salisbury |
| Swindon |
| Southampton |
| Plymouth |
| Windsor |
+-------------+
5 rows in set (0.08 sec)

mysql>

See More on SQL module.

Posted by gje at 07:13 AM


Related topics: via article database

Useful link: MySQL training

April 13, 2005

Cover all the options

I'm on site next week - driving to Falkirk on Sunday. Booked my hotel yesterday (and, yes, had to use a system running Explorer to do it because of the particular web site's Javascript). "Will I be arriving before or after 8?" asks the form. Good question. I really don't know. But the form doesn't give me a "Don't know" option.

A good reminder that online forms should be written to cope with all practical options. Allow for any browser, remember that yes/no may also have don't know/care answer. And while we're at it, be careful how you limit the number of units wanted, allow for non-UK/non-USA postcodes and phone numbers, bad capitalisation, spaces in credit card numbers, etc.

Posted by gje at 04:21 AM


Related topics: via article database

April 12, 2005

Fire drill

I was grateful for an unscheduled fire drill recently. Our training centre's fitted with smoke, fire and burglar alarms and hooked up to the emergency services too - it's far more thorough than is required by law - but while tests are clearly just tests, there's been the element of doubt as to how it will work at a real event.

I was presenting a course - Perl, I think - here recently and the alarm directly outside the training room door went off. Course stops imediately. "Probably nothing, but we had better evacuate" says I ... and the whole thing worked a treat. A couple of tiny lessons learnt, and I'm very happy for that.

Oh - yes - it was a "false alarm". A torch was being used to remove old paint, and sufficient had been burnt off to trigger the system. Good to be re-assured that it works.

Posted by gje at 07:53 AM


Related topics: via article database

April 11, 2005

An apology to Mr Boneparte

Dear Mr Boneparte (or may I call you "Napolean"),

Someone has stolen your identity, and is posting loads of adverts to "Horse's Mouth" through it for on line gambling, medical products to increase virillity, etc. I'm kinda assuming you've not opened a casino on Elba, nor are you selling "Josephine Punch" from there ...

Anyway, to cut a long story short (somethng I rarely do), I've added a "mod" the the software that runs this forum so that anyone who posts from email addresses starting "napolean...." will receive a message telling them they've been rejected. It's as nice a message as I could muster up in my frustration at all the "noise" from these posts and it's nothing personal against any dictators, pigs (from Animal Farm, you understand) or others with that name. Just email me if you're genuine, and I'll let your particular address through - or your could, without problem, post from the more formal n.boneparte@elba.med

Technical note

The "Moveable Type" software that's used for these daily writings is widely used - there was no point in me writing my own system when there's someting far more thorough out there already. You'll find we use other standard apps like analog and YaBB here too. All are available in source.

One of the downsides of using a piece os standard software is that less scrupulous people who want to find security holes through which they can poke bulk advertising are more likely to target you; a standard hole found in one system can be used to attack others, and with something like a diary that invites comments where you need a number of near-holes, it becomes a bit of a game. With access to source code, though, it's possible for a knowledgeable software administrator to apply personal fixes and standard mods too. And that's what we've done.

In the case of Moveable Type, I've added

# Mod by Graham Ellis to reject known spam email addresses
if ($comment -> email =~ /^(jane_doe|grey_goose|azaddin|napoleon|johndoe|huy_lo|bushmills|luba|absolut|otard|gocha|absinth)/) {
return $app->handle_error("A real email address is required (I don't believe the one you gave - email graham\@wellho.net if it's genuine please!)");
}
# End of mod

to the Comment.pm file at line 250 (that may vary from version to version ...) and my spam traffic appears to have disappeared. Great. Good. Two further issues I need to watch. Firstly, that I re-apply the mod if and when I upgrade the software - there's a support issue with mods like this - and secondly that I really haven't trapped any genuine posters as I would regard such things as "wrong side" errors - I really mustn't upset genuine commenters.

I had best drop a line to Mt and Mrs Doe now too, hadn't I?

FootnoteTwo thirds of the emails send to our domain are classified as junk and not even delivered to us - we keep a graph that's constantly updated to hand to track this, and very rarely do we hear of an email being accidentally rejected!

Posted by gje at 06:18 AM


Related topics: via article database

April 10, 2005

See 8 but buy 6. See 6 but you can buy 8.

We're looking for a new dining table and chairs for customer lunches and yesterday we visited the department store that's just to the north of the town.

Can you believe they have a sale on (they seem to have a sale on more often that not!) and there, on display, was just a table that looked just the part. It could seat 4, 6, or 8 and there were 8 chairs around it. Ideal. Not cheap, but sensible pricetag. We approached an assistant and exlained that we wanted to spend our money on the table and the eight chairs as it was displayed. "Oh - that only comes with six chairs ... I don't think you can order extras but you CAN order extras for ...". And she points us to another design, on display with 6 chairs, that didn't meet our needs. It seems that only the store manager can vary the sales policy and he's not in (being the weekend); the sale finishes today - Sunday - afternoon and me thinks that our local store has lost the business.

Sad - we really prefer to support local businesses but there are some that make it very hard for us to do so. But perhaps they prefer to sell a lot of standard product and don't really want business like ours - perhaps we're too much trouble.

Am I the only one who gets frustrated by stores that work like this?

Posted by gje at 09:47 AM


Related topics: via article database

Our most popular resources

Should I be writing about daily life here? Commenting on the news? Talking about the running of a training company? Providing technical tips on Open Source programming languages?

This morning, I've put together a web page to show our most visited web pages and it makes fascinating reading. There's a number or suprises to me as to which subjects are looked at the most. On "The Horse's Mouth", the most visited pages are all the technical ones, for example, and in other areas Tomcat and Python are remarkably popular.

But I (of all people) shouldn't confuse the number of visitors with the relevance and need for a page. I provide niche training, covering hard-to-source subjects and meeting a real need. So this morning's exercise was very interesting and will probably influence - a little - where I write and where I concentrate in the future ... but I'm going to go write on now and write another entry here about a visit we made yesterday to the Department Store in Melksham.

Posted by gje at 09:30 AM


Related topics: via article database

April 09, 2005

Course Picture

I thought I would share a picture from this week's PHP course with you

as I've talked so much about our courses here but never actually shown you any pictures.

Posted by gje at 10:05 AM


Related topics: via article database

April 08, 2005

More to programming than just programming

A regular question I'm asked is "Where do I start / how do I learn all about the associated subjects with a program as well as about the programming language". Excellent question, and I'm reproducing an answer here - slightly edited to make it generic - that I've just written.

There are several aspects to programming; not only the language itself, but also programming techniques that apply across languages, and furthermore how to make best use of those techniques and develop others for their use within the particular language that you've chosen. For a we based application add in the need to understand web site structure, information management, human engineering / time and motion (to ensure people can easily use the site), politics (to work with the people who need the site and have their own ideas that may be impractical), and a bit about the subject that's to be covered on the site too and you have ... a frightening array ... of skills to be learn. On top of that, many of the techniques and principles have complex names and acronyms that have been applied to them but baffle the newcomer; these acronyms are useful in helping experienced users communicate with one another but coming in a-fresh they're just ANOTHER hurdle.

You're NOT alone in coming to programming "via web pages". So often people from (perhaps) a graphic arts background have been given the job of doing the company's website and learnt their HTML skills .... then they've been asked "just" to add (say) a mailing list, or a "news of the day" box that the boss can easily update and they 'slip' into programming. Indeed, I'm running a public PHP course this week with four trainees and two of them fall exactly into that category. A third is retraining from mainframe work (and he has a lot of radical changes to take on board and un-learning to do ;-) ).

So - you're not alone, but you face a daunting array of skills to pick up, and something of a problem in that the knowledge you've picked up in being thrown in at the deep end has placed you a little bit beyond a fresh start "learning to program from scratch in xxxx language" type requirement, but short of the "advanced course in yyyy" type level - you might be AOK for some parts of such a course but then you would come across an assumption of a basic knowledge that you just didn't happen to have needed at all. You've also come across the fact that so many of us IT people are in IT because we're great at communicating with computers and not so much with people, so there's a lack of good teachers and people who WANT to teach.

Geeze - I wish we had heard from you last week - this week's PHP course and mix would have been ideal for you ;-% ....

The next public "PHP Programming" course starts on 6th June (4 days from the Monday). I can't predict exactly how big / small the group will be, but it won't exceed 7 and more likely in will be 3 to 5 persons. Typically people with a very similar background / requirement to yourself having dabbled a bit and looking for (a) A brush up and "hole filler" on the fundamentals, (b) A more detailed study of some of the intermediate facilities and techniques, (c) an insite and guidance as to best practises, so that you write PHP that's very easy for the web site user (and kind to that user), quick to write and easy to maintain and adapt as requirements develop and (d) a short series of "showcase" demos that give you ideas as to what you can do and how you can make best use of PHP.

I don't think you need the "technology for PHP" day. That's a pre-cursor of the "PHP programming" course and you're already pretty much set up on what it covers. Indeed - you might find that the first 25% of the "PHP Programming" course is simply dotting "I"s and crossing "T"s for you.

The "OO" discussion is an interesting one. And, yes, a big thing to get your head around with lots of entrenched and opposing views. Object Orientation CAN be a superb technique to use but for some requirement's it's overkill; best used on projects / at sites where the requirement if for applications which aren't the simplest. Since PHP's background was in applications that are just a few lines of code, it's OO model was not "pure" up to PHP 4, and it wasn't greatly used. As PHP has developed into a substantial tool for larger applications, OO has become more relevant. Thus, we've added the extra (optional) one day course and in June it runs on the Friday.

I've written a lot there - I hope it's helpful. If PHP was an easy topic that you could pick up and know all about in a few hours, then you would be bored in a few days. So it can look daunting. But it can be so much FUN too ... and we have that fun. Our training centre doesn't close at the end of a day's course ... people stay around, try things out, chat. This week has been exceptional in that ... I think the last customers left 3 or 4 hours after 5 yesterday and we virtaully had to turf them out because we were getting very tired. I expect the first back at 8 this morning. That's the sort of thing it does for you .... and we love it!

Posted by gje at 07:36 AM


Related topics: via article database

April 07, 2005

Different course every day

Very busy day - just a quick comment that it's a delight that every course is a bit different.

Today ... paging results in PHP from a MySQL database is the hot topic and I'll put up samples on the resource centre this evening

Posted by gje at 04:00 PM


Related topics: via article database

April 06, 2005

NULL in MySQL

NULL is not a value - it's a condition. So if you try and write something "= NULL" you'll get an empty set rather than the results you're looking for. Try "IS NULL" instead.

example


Joining 2 tables connecting records that match

mysql> select * from demo_people join demo_property on demo_people.pid = demo_property.pid;
+-----+-----------+--------------+------+------+----------------------+
| pid | name | phone | pid | spid | selling |
+-----+-----------+--------------+------+------+----------------------+
| 1 | Mr Brown | 01225 708225 | 1 | 1 | Old House Farm |
| 3 | Mr Pullen | 01380 724040 | 3 | 2 | The Willows |
| 3 | Mr Pullen | 01380 724040 | 3 | 3 | Tall Trees |
| 3 | Mr Pullen | 01380 724040 | 3 | 4 | The Melksham Florist |
| 3 | Mr Pullen | 01380 724040 | 3 | 6 | The Beetle Drive |
+-----+-----------+--------------+------+------+----------------------+
5 rows in set (0.05 sec)

Joining two tables connecting records that match PLUS an extra for each "orphan" on left

mysql> select * from demo_people left join demo_property on demo_people.pid = demo_property.pid;
+-----+------------+--------------+------+------+----------------------+
| pid | name | phone | pid | spid | selling |
+-----+------------+--------------+------+------+----------------------+
| 1 | Mr Brown | 01225 708225 | 1 | 1 | Old House Farm |
| 2 | Miss Smith | 01225 899360 | NULL | NULL | NULL |
| 3 | Mr Pullen | 01380 724040 | 3 | 2 | The Willows |
| 3 | Mr Pullen | 01380 724040 | 3 | 3 | Tall Trees |
| 3 | Mr Pullen | 01380 724040 | 3 | 4 | The Melksham Florist |
| 3 | Mr Pullen | 01380 724040 | 3 | 6 | The Beetle Drive |
+-----+------------+--------------+------+------+----------------------+
6 rows in set (0.01 sec)

Selecting only orphans from the join - doing it the CORRECT way

mysql> select * from demo_people left join demo_property on demo_people.pid = demo_property.pid where spid is NULL;
+-----+------------+--------------+------+------+---------+
| pid | name | phone | pid | spid | selling |
+-----+------------+--------------+------+------+---------+
| 2 | Miss Smith | 01225 899360 | NULL | NULL | NULL |
+-----+------------+--------------+------+------+---------+
1 row in set (0.00 sec)

Trying to select the orphans, but failing because NULL is not a value

mysql> select * from demo_people left join demo_property on demo_people.pid = demo_property.pid where spid = NULL;
Empty set (0.00 sec)

mysql>

See More SQL commands for further information sources

Posted by gje at 07:55 AM


Related topics: via article database

Useful link: MySQL training

April 05, 2005

Free parking for short errands in Melksham

A bouquet for the local authority. Yes, that's not common I know, but I'm delighted that they've provided an hour of free parking in at least one of the local car parks as part of the generally upward price revision last weekend. I don't mind paying to park when I'm in town for a while, but the old charge of 25p for a few minutes to deposit a cheque at the bank or pick up a takeaway "rankled". And roadrage was prevelant around the Market Square where there were a few no charge / one hour spots.

Melksham's got a great range of services available and the previous parking charge structure discouraged their use. Let's hope that the recent changes encourage use of the facilities that we treasure.

Posted by gje at 08:32 AM


Related topics: via article database

Information request forms, cleaning up spam

We've been discovered! Or rather ... our brochure request form has been discovered, just like the comment submission form to this diary has been discovered, by "spam engines".

These "spam engines" locate web forms, then complete them with information about on line gaming, pharmacutical products, and other goods and services that we're not interested in. They're characterised by including a very high proportion of links - especially in text areas. I believe that they're hoping to find forms that will let them post information onto bulletin boards and other web sites ....

How to deal with this nuisance? I've amended our information request form response script to compare the length of the text entered "raw" with the length of the text entered once "href" tags are stripped out ... and if it shrinks by a third or more, it's probably a spam. It's hard to be sure, so I'm now in a testing phase that simply marks the emails sent by the brochure request system.

Code (In Perl) to accumulate the full and stripped lengths - run on each field of the form

$full_length += length($value);
$value =~ s/<a\s+href[^>]+>/ /ig;
$stripped_length += length($value);

Code that evaluates whether or not the posting is a spam

$spamfactor = $full_length / $stripped_length;
if ($spamfactor > 1.4) {
$extraword = "SPAM";
} else {
$extraword = "OK";
}

Note that I have also initialised the $full_length and $stripped_length variables to 1 not 0, in case anyone (or any automata) submits a blank form

Posted by gje at 06:32 AM


Related topics: via article database

April 04, 2005

Searching security holes

You'll see from my post earlier this morning that I've added some "Out and about in Wiltshire" pages to our shared data system (Also known as a "wiki") on this site. And, I thought, "what better opportunity than to extend our site's search engine to include the database of information in that system?"

But wait. Our shared data system includes not only "public editable" and "public facing" pages, but also pages that are marked "internal only" and are only readable by members of the Well House Consultants team. A search engine that would simply search the database for the desired term wouldn't be sufficient - the search system is another door (a back door) to the data and it needs to be (and has been) secured as appropriate.

Why am I posting this "tip"? Because it's something that authors of search facilities often overlook; I know of various web resources which aren't directly accessible to me, but which I can retrieve information from through search facilities without (or with poor) security. Often, I'll let the web site owner know they've got a problem if I find one of these ... but I do have the feeling that some folks aren't all that concerned about their security. Certainly the holes often remain.

Posted by gje at 07:33 AM


Related topics: via article database

A beautiful place to live and learn

With the change of the clocks last weekend, it's now light into the evening. A lovely weekend had us visiting a number of local beauty spots and "snapping away" at some of the beautiful places that are within a few miles of here. I've added them so our shared data ("Wiki") system ... start in Melksham and visit other places like Bradford-on-Avon and Devizes from there.


Sping flowers and early shoots in the waterfront gardens in Bradford-on-Avon


The river Avon flows under the Dundas Aquaduct that carries the canal across the valley

Posted by gje at 06:14 AM


Related topics: via article database

April 03, 2005

Business practise, 2005 style

In the "bad old days", businesses had to spend far too much of their time chasing late and incorrect deliveries from their suppliers, and overdue payments from their customers. Perhaps it's just the business that we're in, but things do seem to have hugely improved on this front ... or perhaps we're now able to choose our suppliers more wisely, and explain our terms more effectively to our customers.

The huge improvement, though, still doesn't leave a perfect situation; just occasionally the odd "situation" still occurs and, co-incidentally, I spend much of this morning writing to three organisations who may be inept in their businesses, or may have found that they can get away with things by not bothering to meet their commitments. I've tried "nice", I've tried "nasty" ... and tomorrow morning they'll learn that we won't just forget it beyond that point. There's a great temptation to "name and shame" but I'm not doing that - I don't want to infuriate but rather to bring about payment / settlement in as friendly a manner as is possible considering the corner these twits have pasted themselves into. But what a waste of time!

Funnily enough, seeing the poor showing of other businesses does have its silver lining. I can heartily cheer when I see a piece of gross business bad faith by someone who could be a competitor of ours - what a great way of shooting themselves in the foot. I love getting the business on the rebound - it's usually a very easy sale to make and by treating the customer well we end up with a long relationship that's good for everyone. A poor supplier or customer - perhaps a bronze rather than a silver lining; certainly a great experience to look at say "we don't do THAT do we?" to ourselves.

Posted by gje at 05:56 PM


Related topics: via article database

April 01, 2005

100% Training

Just concluded a great week training ... all trainees arriving and departing by train. We're delighted to have a rail service to Melksham which, though sparse, fits our course schedule like a glove. 07:45 from Paddington => 09:12 Melksham, 17:02 Melksham => 18:44. Connections (this week) - Bristol, Lancashire, Yorkshire.

Posted by gje at 04:18 PM


Related topics: via article database