March 02, 2015

Overnight accommodation in Melksham - if Well House Manor is full!

We are delighted to welcome overnight guests at Well House Manor, and hope you'll make us your first choice in Melksham. However, we're sometimes fully booked and we cannot offer (for example) family rooms, so you may have to look elsewhere.

Here is a list of accommodation that's near to our training centre - within easy walking distance; as we're close to the Kingsbury House, Melksham House, the Town Centre, Melksham Assembly Hall, The Blue Pool and the Town Hall, this is a good list if you're working, meeting or attending an event at any of them. We are the closest accommodation to Bowerhill, Snowberry Lane, Queensway, Melksham Hospital, etc, and others listed here are also within walking distance.

Overnight Accommodation in Melksham

Well House Manor [That's us]
48 Spa Road; SN12 7NY; 01225 708225

We're at http://www.wellhousemanor.co.uk
Training at http://www.wellho.net
email: info@wellho.net

If we're fully booked or can't offer what you need, try

Conigre Farm
Semington Road; SN12 6BZ; 01225 702229

Kings Arms Melksham
20 Market Place; SN12 6EX; 01225 707272

Lily Rose Cottage
3 Church Walk; SN12 6LY; 01225 703694

Home from Home
16 Beech Avenue; SN12 6JP; 01225 707162

Longhope Guest House
9 Beanacre Road; SN12 7PT; 01225 706737

Antonia House
491a Semington Road; SN12 6DU; 01225 899394

Bowden Guest House
27 Beanacre Road; SN12 7PT; 01225 709443

Posted by gje at 10:52 PM | Comments (0)
More about Graham Ellis of Well House Consultants
Related topics: via article database

March 01, 2015

Combining tests into suites, and suites into bigger suites - Python and unittest

Why are you writing code? To meet a customer requirement! And that code needs to work, to be reliable, and to continue to be reliable into the future as you update it / fix bugs. If you're a programmer, have you ever applied a "quick fix" to something just to discover (perhaps later) that you've broken something else in the process?

So I'm going to encourage you to write a test program (and write it FIRST - even before the code). That probably won't be enough, so you'll write a series of test routines - a test suite - and in most languages (including python - today's subject), you'll find that there are regression or unit test frameworks which let you manage your group of tests - for example to set up data prior to each test, run and log the results, and report on how the tests have run. This means that you can simply say "retest that [class]" and have all the checks made - with a new test being added into the suite when a bug is reported or an enhancement requested to (initially) illustrtate the issue to resolved / code to be written, then later prove that it has been written, that it works, and that the old code still works too!.

From last week:

A group of classes (myTrain) to be tested - [here]
Unittests for that group [here]

A second group (station) to be tested - [here]
Unittests for that group [here]

Note - both sets of tests are representative only - there should be a lot more tests in each suite.

Requirement to combine test suites

Complete applications and systems comprise many classes and groups, and you'll want to run all the groups of tests together. You can do that too by combining your test suites. There seems to be a lack of clear, staightforward examples around - so here is the code for combining the two sets of test described above:

  # Combining Test Suites - unittest
  
  # ----------------- Unit test framework
  import unittest
  
  # ---------------- Individual test suites
  import Traintest
  import Stationtest
  
  # ----------------- Load all the test cases
  suiteList = []
  suiteList.append(unittest.TestLoader().loadTestsFromTestCase(Traintest.TrainTest))
  suiteList.append(unittest.TestLoader().loadTestsFromTestCase(Stationtest.StationTest))
  
  # ---------------- Join them together and run them
  comboSuite = unittest.TestSuite(suiteList)
  unittest.TextTestRunner(verbosity=0).run(comboSuite)

That source available [here] too in order to complete the example.

On all of our courses, we ensure we teach the need for testing from the start. We encourage good practise, with initial design work up front, and behaviour or test driven development where appropriate.

Posted by gje at 08:30 AM | Comments (0)
Useful link: Python training
Related topics: via article database

February 28, 2015

Graphing presentations in Python - huge data, numpy and matplotlib

A picture paints a thousand words. Our server log files for February are 1.6 Gbytes in size, with 5.3 million individual requests. How busy are we at what times of day? I've been looking at this through matplotlib in Python - here's a wireframe of the month - days on the X axis, hour of the day on the Y axis, and height being the accesses per hour:

Rather that extract the data each time we draw a graph, I've written the program in two stages - a data extraction routine that writes our a .json object (source code [here]) and the graph drawing program [here]. The plotting program (also used to illustrate Python graphics and numpy on last week's course) produces four different displays - here's another:

Data's available if you wish to run the graph program - [here]. And if you want to learn about numpy and matplotlib, let me know before your Python course and we''ll add an extra session on the penultimate evening of your public course, or build it in to your private course. See [here].

Posted by gje at 06:43 PM | Comments (0)
Useful link: Python training
Related topics: via article database

Elements of an exception in Python - try, except, else, finally

All the elements of an exception handler in one example ... [here]

try - enters at the top and continues through the block
except - jump to there is an exception is thrown
else - run after the try block completes without exception thrown
finally - always run after the other blocks have completed

A correctly running block
try - else - finally
(and code loops completes)

  -bash-4.1$ python duff
  (bfor) Exception demonstration
  
  (try-) Please enter a Python value: 44
  (else) Input accepted
  (finl) Tidying up
  
  (done) Value received: 44
  -bash-4.1$

A block with an error
try - except - finally
(and code loops back to have another go)

  -bash-4.1$ python duff
  (bfor) Exception demonstration
  
  (try-) Please enter a Python value: forty
  (exce) Not acceptable!
  (exce) Message: name 'forty' is not defined
  (exce) Failure Type: NameError
  (finl) Tidying up
  
  (try-) Please enter a Python value:

Code

  while True:
    try:
      n = input("(try-) Please enter a Python value: ")
    except KeyboardInterrupt:
      print "(ex/k) You give up?"
      print "(ex/k) Won't break me that way"
    except Exception,e:
      print "(exce) Not acceptable!"
      print "(exce) Message: ",e
      print "(exce) Failure Type:",e.__class__.__name__
    else:
      print "(else) Input accepted"
      break
    finally:
      print "(finl) Tidying up\n"

Posted by gje at 02:45 PM | Comments (0)
Useful link: Python training
Related topics: via article database

February 25, 2015

Seventh stay away this year - and it's still only February!

"Location, location, location". I've just stayed in a hotel in Cambridge for 3 nights - classified as "3 star" but in my view more 2 star, and I've paid significantly more per night than I would have paid at our place. But then this is Cambridge and things don't come cheap in this city. My sixth hotel stay / fourth different hotel this year - plus a seventh stay of a week self catering - it will be good to be home for most of March for a series of public courses, yet it's excellent to have the experience of these stays to look at what I notices and check our place against it.

I always feel I'm staring on the wrong foot when I have to buzz to be let in when arriving a a hotel with a significant number of rooms - especially when the door's glass and you can see the receptionist from the street. Then a signing in with that sinking feeling that you're not popular for having disturbed the receptionist from what she was doing.

It was "mind you head" and "mind your shoulders" as you went up the main staircase, and carrying your baggage as you went because there was no offer of assistance from the staff. It was tired, yellowed, old fashoined, worn.

My room was pokey-small. The bathroom door folded back because there wasn't room for it to swing and the shower door folder back because there wasn't room for it to swing either. When folded back, the shower door blocked the tap to you had to get in the shower to operate the tap.

No soap tray in the shower (but then no room for it) and no light, as the only light in the bathroom was above the toilet, in the other leg of the "L" shaped room. I suspect that the next toom completed the L though paper thin walls, judging by the sound coming through.

I wonder if someone had slipped on the bathroom floor very recently there was a brand new mat stuck to the floor, and with bright yellow grippinng material / good coming out from under it. Indeed it was so fresh that I wondered if it was still wet.

Only one power point at the desk - and in use for a light. Cheap-looking multiway at the other end of the room. Hair dryer 'home' clip on wall, but a totally different hairdryer than the one it was intended for in the draw.

The hotel has a love of glass tops on tables - fair enough. And they were well clean - good. But why put a "hand me in for a special deal" offer on a piece of paper under the glass? I wonder if that was thoughtless or provocative.

And talking about signs - they were all over the place - including poking out from behind fittings so that you had to guess what they said. One sign that was missing - a price list at the bar, which I thought was a legal requirement. My can of Tetley's on arrival night was £3.00

The breakfast room had "mood lighting" - a.k.a. dim, and it was noticable that all the larger tables were under / near the available lights with all five single tables away from those lights in the dim middle of a side or the dim middle of the room.

At the most there were 10 guests at breakfast while I was there - with around six staff. Good to have a "help yourself" buffet, but toast and tea / coffee were served - in mean portions, but the coffee was 'real'. The staff were very good when I mispushed the plunger and send liquid flying, assuring me not to worry as it happens several times a week.

If you're going to serve tiny / hold certain things back at breakfast to serve more, that's fair enough but you should be on you guard for when it's needed. The two young ladies were so busy chatting that the offer of more coffee only came just as I was getting up to leave - five minutes earlier and I would probably have said yes, 10 earlier (and an offer of more toast) would have been right. And more that one pat of butter too ... think they were rather too busy chatting to notice, but as I don't speak Spanish I don't know if it was a chat or a serious work issue.

With all the staff, it was interesting to see just how many were going in and out of the kitchen - and I do wonder about the food safety regime. I got the impression that at least one guest who was not on the staff was in the kitchen, and she came out to take breakfast. Must have been a special guest as the owner came out and sat with here, totally oblivious to other guests who were left to the staff to deal with.

I speak no Spanish. So I wouldn't look for a job in a Spanish hotel - with a smattering, yes - but not with so little I couldn't communicate. I wonder if these waitresses were being paid, or were paying to learn English - of course without a common language I couldn't ask. The german lady was well established and good with customers - and gave every appearance of loving her job and taking an interest. What a pity that she chatted with a guest in the far corned of the dining room, thet shouted out all the personal details she had learned (an unusual surname) as whe reintered the kitchen, for us all seated nearby to hear. So - privacy concern, and perhaps a good act rather than genuince care for customers.

On checkout, I queried the price being charged as the room folder, and the notice on reception, very clearly stated that a 50% deposit is taken to guarantee bookings, and I had booked with my credit card. The told me that it's not done that way with the booking agent I had used, and that it wasn't a problem as I was the first to complain. But I wasn't complaining (I didn't for the three days about anything) - I was just querying an apparent difference.

This is getting a bit long so I won't mention the lack of refilling of the hospitality tray, the need to recode the room key, the first come, first served free for all on car parking that didn't effect me, the failed bulb in the main light, or the lack of a question at any pointas to whether I'd had a good stay. Don't now about "good", but I had great fun watching.

Did the hotel want to know if I had enjoyed my stay, found everything to my satisfaction ask if I would be coming back? There was no request for feedback. No enquiring how may stay had been ... except the German lady at breakfast (with whom I had struck up a conversation, so probably all the staff knew my business) did ask if I would be back. And the answer may surprise you - yes, if it came up at a good price and I was nearby. It's quirky, it's convenient for the station and some parts of Cambridge, it's got free Wifi, and it's a good reminder for me of things to be sure we're not doing as a matter of routine.

A final memory - the German Lady explaining to one of the Spanish ones what a soup spoon was, and then being unable to explain to me why they even had soup spoons for a restaurant that only served breakfasts

Posted by gje at 07:16 PM | Comments (0)
Related topics: via article database

February 24, 2015

Mutable v Immuatble objects in Python, and the implication

In python, "everything is an object" - well, at least everything you name, and lots of standard system things too, are!

Some object types are immutable. That means tha once they have been created, they cannot be modified and any code that looks like it modifies them in reallity produces a new object that's an amdened copy with the new data.

Other object types are mutable. And in that case, they can be amended in situ once they have been created.

One of the effects of "mutable v immutable" is that is you pass an immutable object into a function or method and (attempt to) change it there, you will NOT change it in the main code. But if you pass a mutable object into a function or method, you WILL change it in the main code. See [example source].

  def one (first):
    first += 5
    return first
  f = 27
  x = one(f)
  print f

result - the ORIGINAL 27

  def two (second):
    second += [5]
    return second
  s = [27]
  y = two(s)
  print s

result - a MODIFIED list [27,5]

• Immutable obects provided by Python ... int, float, str, tuple
• Muttable objects ... most others!

Posted by gje at 09:38 AM | Comments (0)
Useful link: Python training
Related topics: via article database

Well House Consultants Ltd.
Copyright 2015