Training, Open Source computer languages

PerlPythonMySQLTclRubyC & C++LuaJavaTomcatPHPhttpdLinux

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Quiz Page python
The python quiz has changed! We have replaced python questions with answers! And from those answers you'll find further links to even more information - forums where you can ask questions, training courses, longer articles, and more. [link to quiz index] ... If you really want the old quiz questions, you can find them here, here, here and here ... and with onward links to the possible answers to each question too.

Dynamic code - Python
When I learned to program, named blocks of code (subroutines and functions) were built into each program and weren't things you could change at run time. But these days, in some languages like ...

Pascals Triangle in Python and Java
There are certain "party pieces" that I have during courses ... and on my Java Courses, a program to generate Pascal's Triangle in an array of arrays is one of them. One of my delegates on today's ...

Python Regular Expressions
Python supports string pattern matching to regular expressions, using Perl style regular expressions. The re module - loaded via   import re brings the appropriate elements into your ...

What are exceptions - Python based answer
How do you check for run time errors in your program? You'll include tests with if statements in almost every program you write, to ensure that user entered data is reasonable / as you would expect ...

List Comprehensions in Python
How do you perform an operation on every member of a list, producing a new list? A List Comprehension in Python is a structure in which a for loop is written within a list's square brackets. Its ...

Optional and named parameters in Python
When you're calling a named block of code (either a function or a method in Python terms), you'll pass in a number of parameters. Some of those will be mandatory - needed every time. Some will be ...

Anonymous functions (lambdas) and map in Python
Why do you name variables? So that you can use them again later. But if you don't want to use them more than once, why bother with a name at all? Most programming languages create temporary or ...

The road ahead - Python 3
A couple of days ago, I mentioned Python 3 in general terms - and today I'm starting to flesh out the road ahead. print The print operator in Python was always a bit curious, with the trailing ...

Sharing variables with functions, but keeping them local too - Python
""" One of the big issues with any programming language is how in shares (scopes) variables between blocks of code. On one hand there's a desire to have variables easily accessible without a lot of ...

Looking for a value in a list - Python
In any scripting language, avoiding loops makes for easier to write and faster to run code. One example is Pythons if .. in construct, where you can avoid a loop to test whether a value matches any ...

Python 2 to Python 3 / Python 3000 / Py3k
There's a new release of Python on the horizon. Well - it's rather closer than the horizon, as there are beta test releases around, and a final production release is due within the month. It has been ...

Global - Tcl, PHP, Python
PHP, Python, Tcl and a number of other languages have a global keyword. And it's a misnomer in most (if not all) cases. To the un-initiated, "Global" means "worldwide" or "shared all around". So ...

Q - Should I use Perl or Python?
An interesting question posed to me today - and not for the first time. And not for the first time, my answer had to be "tell me more about your application, and about the people who will be writing ...

Saying NOT in Perl, PHP, Python, Lua ...
"Isn't there one standard way to say NOT?" asked one of my delegates on today's course - and it's an excellent question. But the answer to a question about a negative subject is itself in the negative ...

Python in an afternoon - a lecture for experienced programmers
Last Friday afternoon I was set a challenge - to present Python in three hours to a group of 20 very experience programmers who, however, knew nothing about this particular language. The session was ...

Equality, sameness and identity - Python
Is the number 7.0 the same as the number 7.00000? A trick question, because it depends on how you look at it. It has the same value, but it is not identical. And if eachof them is held in computer ...

Using a utility method to construct objects of different types - Python
When you call an object's constructor method, you'll be allocating memory to hold the information about that object and the method will return an instance variable - a reference with which you can ...

Tektronix 4010 series / Python Tuples
The Tektronix Storage Tube was a cathode ray screen across which a beam of electrons could be swept directed, leaving a trail behind it rather like the plume behind an aircraft (technology note). ...

Underlining in Perl and Python - the x and * operator in use
Perl's x operator - yes, that is the letter x - is used to replicate the string on the left the number of times given to the right. "What use is THAT" I have been asked in the past, by delegates ...

Advanced Python, Perl, PHP and Tcl training courses / classes
This item is adapted from an answer that I have just written by email - but the question / conundrum as to what to do with fractured advanced training requirements is a common one, so the answer is ...

Python - formatting objects
If you're going to be printing out objects from within Python, simply provide an __str__ method in the class and it will do all the work for you. Indeed - why not create classes and objects for ...

Perl, PHP or Python? No - Perl AND PHP AND Python!
"Which language is best for xxx task" I am often asked. And I'll listen to the questioner's description of his application, his background, and the sort of support he'll have at his place of coding ...

Perl, PHP, Python, Tcl, Linux, MySQL, Ruby courses ...
What's this list got in common (apart from all being countries?) BelgiumEnglandFinlandFranceGermanyGuernseyIrelandNetherlandsNorwaySaudi ArabiaScotlandSloveniaSwedenUSAWales They're all countries ...

Python Script - easy examples of lots of basics
Here's a Python script which is pretty imperfect, but shows a whole lot of the basic facilities of the language in use - a sort of "you can do it this way" crib sheet for newcomers. Written during ...

Python - input v raw input
If you use input, then the data you type is is interpreted as a [b]Python Expression[/b] which means that you end up with gawd knows what type of object in your target variable, and a heck of a wide ...

Question on division (Java) - Also Perl, PHP, Python ...
Q: What's the difference between % and /? A: / returns the result of a division % returns the remainder when you do a division. Divide 18 by 7 you get 2, with a remainder of 4 (i.e. 4 left over). ...

Integer v float - Python
If you had f failures in s samples, what proportion failed? .6666666666 you might correctly say - but Python might not come up with that answer if you have two integer counts >>> s = 6 >>> f = 4 ...

Python v Ruby
I've been asked for a comparison! • Both are object oriented scripting languages - or rather claim to be scripting languages, but are really compile-and-run via their own virtual machines, in ...

Tk locks up - 100% c.p.u. on a simple program (Tcl, Perl, Python)
Fighting packs and grids - Tk under Tcl, Perl, Python You'll use pack OR grid to place components into your frame in a Tcl/Tk application. You may use both pack and grid within the same program, but ...

2008 course schedule - Perl, Python, PHP, Linux, Java Deployment, Ruby and more
It's nearly the August Bank Holiday ... and the time of year when our minds turn to scheduling courses for the next year. For 2008, I am proud to present: Every 8 to 12 weeks: Public courses in ...

Python class rattling around
"Occupany Limit 230" says the room that I'm running my Python training course - for 8 delegates - in at the Watervliet Arsenal near Albany, New York State this week. Watervliet is being ...

Last elements in a Perl or Python list
How do we refer to the elements of a list? By index number, starting at zero and stopping one short of the number of elements in the list. So a 20 element list has element numbers 0 to 19. How can ...

Keep in touch with PHP, Perl, Python and old friends too
This year - 2007 - we'll be celebrating Geekmas on 24th and 25th November - so that's a date for your diary. It's a weekend technical get together for old friends and new, to explore the latest in ...

Trying things in Python
Are you used to writing long sections of code to validate user input? Perhaps you are, or perhaps you have shortened such code over the years using Regular Expressions where you can specify a ...

Returning multiple values from a function (Perl, PHP, Python)
Function in PHP and Python and subs in Perl can only return one "thing" - one item, one object. But all three languages allow that returned item to be a collection - in other words, a composite. And ...

No switch in Python
Question There's no switch statement in Python. Why not? (Poor) Answer Because there's no need .. you can use a series of if and elif statments. And we can't do it in Python because there isn't a ...

Turning objects into something you can store - Pickling (Python)
If you're working with objects in an OO language and you want to transfer them to another computer ... or simple save them from the current application for reloading into that application or another ...

Python decorators - wrapping a method call in extra code
Would you like to add an extra set of wrappers around a series of function of method calls - perhaps to add a profiler or logger to your application? These are examples of the things you can do with ...

__new__ v __init__ - python constructor alternatives?
The constructor you'll normally override (and call when you create an object) in Python is called __init__, but there is also a method called __new__ available to the class author. If __new__ is ...

Using a list of keys and a list of values to make a dictionary in Python - zip
If you have two lists in Python and you want to use them as the keys and values of a dictionary, you might be interested on Python's zip function. It's NOT the use of zip as we know it for file ...


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