Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Object Orientation and General technical topics module Q110
Programming Algorithms
Exercises, examples and other material relating to training module Q110. This module is presented on Private Courses and Specially Run Courses only

Background
This section provide you with links to (and comments on) pieces of code to performs certain task - algorithms - that you can study if you need to roll your own, or lift from us if you like.
Related technical and longer articles
File Locking

Articles and tips on this subjectupdated
3451Why would you want to use a Perl hash?
"What would I use one of THOSE for?" - a question often asked by newcomers to Perl when I first introduce hashes. Well - in writing a script to count up how many articles I've written about each subject we teach on, I came up with a perfect example. A hash is described as an "unordered collection" ...
2011-09-20
 
3102AND and OR operators - what is the difference between logical and bitwise varieties?
Many modern programming languages have two operators for "or" and two for "and" - described as "bitwise" and "logical" operators. And you need to choose the right one in the right circumstances ... otherwise your code won't behave quite as you expect. Bitwise OR takes the internal bit pattern of the ...
2010-12-24
 
3093How many toilet rolls - hotel inventory and useage
Running Well House Manor, we buy a lot of hotel supplies - ranging from sheets and towels when they are to be replaced, through guest soaps and toilet rolls, salt, sugar and jams which are ordered from time to time, to weekly or twice weekly orders such as fruit and fresh products and ultimately the ...
2010-12-20
 
3072Finding elements common to many lists / arrays
"What do these lists have in common". That's a common question - but what does the person asking it actually mean? Is (s)he looking for items that occur in all of the lists, but perhaps at different positions? For items that occur in two or more of the lists? For items that occur at the same position ...
2010-11-27
 
3042Least Common Ancestor - what is it, and a Least Common Ancestor algorithm implemented in Perl
Imagine you have a tree - a series of leaves which join together as you head towards the root into bigger and bigger branches. The "Least Common Ancestor" is the point at which the branches from two leaves you have chosen come together. In computing, such a tree structure is very common - files and ...
2010-11-11
 
2993Arrays v Lists - what is the difference, why use one or the other
If you want a program to run quickly through a data set (that's the sort of thing you'll be doing in heavy scientific work), you'll want the data loaded into successive memory locations - but that means that you have to know how much space to allocate before you set the data up. Otherwise, you'll find ...
2010-10-10
 
2951Lots of way of converting 3 letter month abbreviations to numbers
There are certain programming tasks that sound simple but end up fascinating ... they sound straightforward (and probably are), but it turns out there are lots of ways of doing them and you could spend a lot of time working out which was is best. One of those is converting three letter abbreviations ...
2010-09-10
 
2894Sorting people by their names
Please sort into order: Tom Pearce Bill Brewer Peter Gurney Peter Davy Daniel Whiddon Harry Hawk Uncle Tom Cobbley What would you do? Bill Brewer Uncle Tom Cobbley Peter Davy Peter Gurney Harry Hawk Tom Pearce Daniel Whiddon That's not a standard sort order for strings of text ... and if you've got ...
2010-07-30
 
2617Comparing floating point numbers - a word of caution and a solution
"Think of a number between 5 and 15. Double it. Add fourteen. Halve it. Take away the number you first thought of. Is the result 7?" We all played games like that as children, thinking of the number 0 ourselves so that we could do an easy calculation and impress our friends. And the result was 7 ... ...
2010-02-02
 
2586And and Or illustrated by locks
Lisa and I came across this impressive array of locks on what we have since learned is probably the back gate to the National Grid's Lacock Switching Station, about 3 miles North of Melksham. [picture/details] Our first reaction was "wow - that must be REALLY secure - what are they doing in there?" ...
2010-01-20
 
2509A life lesson from the accuracy of numbers in Excel and Lua
Floating point numbers aren't held EXACTLY in a computer's memory - they're held to a certain accuracy (number of significant figures or binary digits to be more accurante) after which they are truncated or rounded. And this means that at time 1.0 / 3.0 * 3.0 doesn't go full circle and come back to ...
2009-11-21
 
2259Grouping rows for a summary report - MySQL and PHP
It's quite quick and easy to write a loop that goes through a mysql result set and displays the content on an HTML page (but remember security of data, size of resulting HTML page, and the need to consider special characters such as <). But what if you want a shorter report, grouping records together ...
2009-06-29
 
2189Matching disparate referencing systems (MediaWiki, PHP, also Tcl)
Yes, we are Well House CONSULTANTS and do a bit of specialist coding ... I have a requirement on my plate at present to write a piece of code for a customer that recognises cross reference codes within a document and turns them into links. And what makes the task quite difficult is that the references ...
2009-05-19
 
1949Nuclear Physics comes to our web site
One of the major projects that we'll be undertaking in the near future is aimed at improving the findability of information on our site - you shouldn't need to know that you need a blog article dated 2nd Feb 2007 to find about the difference between a comparator and comparable in Java, nor to look up ...
2008-12-17
 
1840Validating Credit Card Numbers
It's standard practise for on line bookings these days to take credit or debit card details as a booking security, and we're no exception at Well House Manor - our hotel for business visitors to Melksham, Wiltshire. There are very many security issues involved, and I am not going to describe what we ...
2008-10-14
 
1391Ordnance Survey Grid Reference to Latitude / Longitude
I've already written about conversion of postal addresses to latitude and longitude using Google's interface - but what is I want to convert the Ordinance Survey's grid references into latitude and longitude? Google's interface doesn't support the OS units - and in any case it's "just" a a calculation. ...
2008-08-30
 
227Bellringing and Programming and Objects and Perl
For the second time this year (and it's only the second month), I find that I have a keen bell-ringer on my programming course ... he's off each evening to meet up with fellow bell-ringers in church towers in Wiltshire, and having a really good time outside course hours as well as during the day. I understand ...
2008-05-16
 
1157Speed Networking - a great evening and how we arranged it
What an excellent evening! Our Speed Networking evening, organised on behalf of the Federation of Small Businesses, drew in around a dozen inividual and a coupe of pairs with a disparate range of products to sell, and a wide variety of requirements to meet - some by using other's products and services. Seated ...
2007-06-23
 
1187Updating a page strictly every minute (PHP, Perl)
For the Clock exercise that I mentioned in my last entry, I need to update the page once a minute. Exactly once a minute. At the start of the minute. I'm using client pull, where the browser asks for the next page - so my basic request is: <meta http-equiv="refresh" content="60; url=/clock/now.php"> but ...
2007-05-14
 
642How similar are two words
Do you want to help your web site user find what he's looking for on your web site, even if he mis-spells a name or word in a search? PHP provides you with three facilities - soundex, metaphones and Levenshtein distance calculations - which let you compare two words and see how similar they are when ...
2006-06-05
 
Examples from our training material
d2.8   finding extreme values from a collection
d2.9   summing a collection
lca   Least Common Ancestor
lif.py   Counting the number of times something occurs
scat   Getting multiple results from a single data traversal
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from http://www.training-notes.co.uk.
Topics covered in this module
Sorting.
Coverage.
Mean time between failure.
Halflife.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre. Also available is the Opentalk Forum for discussion of technical questions.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2012: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/Q110.html • PAGE BUILT: Sat Jan 28 06:41:11 2012 • BUILD SYSTEM: wizard