From last Sunday ... here are links to the examples of code that I wrote in front of the "Learning to Program in Python" delegates - to show them not only how a program works, but also how I (and other code authors) go from a requirement through to the code that actually does the job. Or, paraphras ....
Already, the days are getting shorter. At the end of the Python Course, I walked along the canal with one of our delegates who - wisely - decided to stop an extra night and drive home to East Yorkshire fresh at the start of a new day, rather than drive home tired after a very full four days in w ....
I love writing things in Python - it's a great language for achieving a great deal in a short time. And it works well got Simple CGI scripts.
Today's challenge - to count the number of words (and number of DIFFERENT words) in a piece of text, so give an idea of how much work would be involved in tr ....
From yesterday's "Learning to Program in Python" - an example of splitting your program into manageable chunks, which is SO IMPORTANT with regard to testing and ongoing maintenance that we introduce the subject even on that first day, with some of the early elements of the language.
from utilz impo ....
A very first practical program on our Learning to Program in Python course that started today.
Even at this early stage, we teach things like good practise in variable naming - standards such as using a consistent case (e.g. camel case where each intermediate words starts with a capital).
I was l ....
The weekend ... and what an excellent opportunity to explore a lane I've often seen off the A361 just down from The Bell near Seend Cleeve.
The track drops off the edge of the hill, across cattle grids and runs unfenced through fields of cows; it's narrow and you pull onto the grass to pass other ....
We have a 'geocoding' example here, and indeed I was using it earlier today. The idea is that someone enters part of an address on your web site, and you contact Google to look up the latitude and longitude so that you can put it on a map, or calculate a distance from somewhere else. It's very ne ....
When a function fails in lua, you'll often find that it return a nil value that you can check, or it returns two values, the second of which is an error status / message that tells you what went wrong.
Here's an example:
value = tonumber(stuff)
if value == nil then
print ("Nah!")
....
One of the requirements we often have in our web server log file analyses is to connect together a series of accesses from a single IP address into a "visit", and this formed an example on Tuesday's Lua course.
In Lua, you can overload (i.e. redefine) operators so that they work differently on tabl ....
Have you ever written code like this?
seps = {" "," "," [",'] "','" '," ",' "','" "','"'}
Yes, I have ... in fact, that's code that I wrote on Tuesday during the Lua course; it's an indexed table of the separators used to split down a web access log record that's in the apache httpd combined forma ....