Tuesday, 24 December 2019

Blog before Christmas and Tartare sauce

Fri 20
Last day in work for this year. Bake off in afternoon.

Sat 21
Prep house/food. Shop. Groceries/food amd some drinks, quest for non alcoholic beer. Help cleaning house.

Sun 22
Family get together, meet Ticknock wait a bit until all arrive. Parking pretty busy but ok just enough space. Fionn heads back to house, a few not coming on walk. 10 kids, well, 11 if include Daire. 7 adults incl Daire.
Fairy castle loop widdershins at rear encouraging/distracting chatting. Dry. Decent but not too bad breeze. Sun shining in distance on city. Low clouds brushing Cruagh in distance. Bye to 10 kids at three rock except the smallest.
Party, food, chat, a bit of music.

Mon 23
Kids all off shopping in Dundrum separate travel bike luas bike.
Shopping for tiny top up of groceries to Stillorgan
2 Book shops
Nimble fingers
Love books.

Tue 24
I sleep in v late. Breakfast. Tiny bit of food prep sprouts and clean cooker. Prep presents. Off to Sandyford house, walk with girls. Meet friends by accident. D&N later for dessert. F&I walk home. And we go for walk Belarmine, walkers woods, back down slate cabin. Dark in woods. Twinkly city lights, faded stars. Films on tv @ home star wars, father ted, die hard 4, the guard. Pylos.

@ lunch we wonder what is:
Lupin (allergen)
Tartare sauce(and steak)
. . Other things

Lupin = lupin beans, lupin flour, italian.

Tartare sauce and steak have same ingredients. Oil egg blend with chives capers herbs pickle. Named after Tartars (mistaking Huns for Tartars not accurately by Europeans).


Wednesday, 6 November 2019

soapui MockService script to get value from request and set in response

REST MockService with Property msisdn, value empty (not sure if this is needed)

REST MockService with OnRequest Script containing:
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
// no need to mess with urn or namespace
//holder.namespaces["ns"] = "http://mbleh"
//holder.namespaces["urn"] = "urn"
msisdn = holder.getNodeValue("//urn:msisdn")
log.info("set context.msisdn="+msisdn)
context.msisdn = msisdn
// and get/set several other parameters
for ( item in ["a", "b", "c"]) {
    log.info "Item : [$item]"
    v = holder.getNodeValue("//urn:" + item)
    log.info("set context." + item + "="+v)
    context.setProperty(item, v)



Example of incoming request:
POST /path HTTP/1.1
soapaction: XXXX
content-type: text/xml;charset=UTF-8
Host: hostname:8081
Content-Length: 525
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:va.a.a">

Part of Mock Action, Response:  see ${msisdn}  var set in Mock Service context
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <RESPONSE version="1.0" xmlns="urn:va.a.a" xmlns:ns2="urn:vb.b.b" xmlns:ns3="urn:vc.c.c" xmlns:ns4="urn:vd.d.d" xmlns:ns5="urn:ve.e.e">

And the actual response sent: (msisdn filled in via script and context.msisdn)
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 888
Server: Jetty(6.1.26)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <RESPONSE version="1.0" xmlns="urn:va.a.a" xmlns:ns2="urn:vb.b.b" xmlns:ns3="urn:vc.c.c" xmlns:ns4="urn:vd.d.d" xmlns:ns5="urn:ve.e.e">

Sunday, 3 November 2019

Weekend diary, more bike maintenance, pumpkin salad dinners, Tibradden GAP hike.

Weekend some more bike maintenance jobs and pumpkin salad dinners.

Pumpkin salad with red onion, red pepper, pomegranite. With black pudding and egg. For Halloween dinner.

More pumpkin salad with home made burger and halloumi. Nom. Sat dinner.

Daire's bike dropped to shop needing a good all round service, new tyres front and back, rear wheel made true, brake pads, brake/gear cables.

Kate's bike counted cogs and links, new brake pads on back. 14-34 7 speed cassette found same or 11-32. 114 links in chain.

Kate rear cassette 14-34 7 speed (7 rings, smallest(hardest gear) with 14 teeth, largest(easiest gear) with 34 teeth.

Bit of a hike Sunday. Tibradden zip it to Fairy Castle, down to the GAP. I ran back from before fairy castle to bring car to GAP.

Railway sleepers across from Tibradden eastwards towards Fairy Castle. Old volcanos big and little sugar loaf in distance. Lovely sunny day after very wet rainy day yesterday.

Good submission, from cyclist.ie positive towards use of electric scooters and similar vehicles without extra rules and regulations.

As a cyclist and driver I have found training that I have done for motorcycling and MTB(mountain bike) to have been useful for cycling on roads(urban and rural). Everyone would benefit from training but more from experience. I think it is very important that mandatory training and safety gear beyond what is the current law is not a requirement(for cycling and PPT) as the most important priority for safety is better designed and segregated infrastructure and lower speeds. If all drivers had experience using a form of PPT or cycling then sharing the roads would be safer so requiring that as part of licence would be very good.

The RSA ad campaigns seem to work well, more training ads on vehicles (especially large vehicles) sharing roads with PPT and cyclists and pedestrians would be good.

https://www.irishtimes.com/news/crime-and-law/vigil-held-for-cyclist-who-died-in-collision-with-cement-truck-in-dublin-1.4069178?mode=amp 9am fri morn. Front left bumper cement truck en route st james hospital building site. truck was turning left off the South Circular Road at the junction with Brookfield Road. local resident, said the danger posed by the junction was an issue the community had raised with Dublin City Council “for many years”.
8th cyclist death on road for 2019. 122 total road deaths 2019 so far.


Today, Sunday, 11:20am
Group of 20 walkers on right today on road from lamb's cross towards marlay park. Road not wide enough for 2 cars and pedestrian. No footpath. Cars driving on anyway in same lane as walkers squeezing them into ditch. !? Have these drivers never been a walker on a road before? :-(

I have not seen PPT users being a hindrance to other road users beyond the odd inexperienced or mistake which you also get with vehicles and cyclists.

A few PPT engines seem powerful and it would make sense to require those with larger power to weight ratio to require licencing/training/safety gear like mopeds/small powered vehicles.

TLDR; hyperloop, electric vehicles, autonomous (self-driving) vehicles, faster a to b travel doesn't improve quality of life. Simpler existing tech like bus bike and elevator can.

Friday, 4 October 2019

Things that sometimes occasionally fail or sometimes permanently fail in google apps scripts - the 'art' of writing goole apps scripts . . .

We have a google apps script that takes automatically generated status and software upgrade and test reports and processes them into spreadsheets.

It's cool and great to have this stuff in spreadsheet :)
And be able to use it manually and do automatic things with it.

We have learned over time a bit about quirkiness of scripting for google drive.

* resource limits

* timing of script, . . . crafting run time of script loop, batching up processing of files after we have problems

* writing code to be robust against certain types of failures

* oops I used up all cells in spreadsheet

* it works great for a long time and then . . . moving files to a folder stops working

* it works great for a long time and then . . . call to getOwner.getEmail doesn't work for some files
   (not "at random" but not consistent over owner of file or other things)
  and . . . on occasion, removing a file stops working

BATCHING files processing:

We have a cron/regular scheduled task processing files coming in. 
Every 5 mins.

We don't want to update every page n sheet on every event as that is really slow.
So we read multiple of files in one go and process them in batch.
 And then update sheets.

Originally we read in ALL files . . 
 but if there was service problem(or we caused new behaviour and script error)
  we ended up with multiple of same script running all processing same files
   our spreadsheet would be updated at end of each job and ended up getting corrupt.
To solve this we put time limit in loop in script to try and make sure it doesn't overlap.
Script runs every 5 mins. 
We give it 3 mins to run it's file processing loop.
If service is really really slow this works ok just a few events processed.
If service running ok all events from 10 to 100s are processed.
If events coming in faster than being processed they build up but they eventually end up being processed.
If we had a problem and 1000s 10000s of files built up to be processed then this batch processing works ok gradually cranks through events. Also we have helper functions which process quickly less important events and remove them. AND the processing script is written to be tolerant of files disappearing(from the helper functions).

We tried to solve this by taking a lock and releasing.
But several flavours of locking mechanisms . . just didn't work.

How do we know what files are processed . . . 

Easy, just move them to Processed dir when we are done. :) Yes?
2 stages of processing so move to Processed_Partial and Processed_Done

Myeh, problem:
The simple file moving to Processed dir just stopped working for us at one stage.
So we are living with this behaviour for now. 
As long as script runs all way through without error it works ok.

If something goes wrong in script it ends with failure and we have already removed the files half processed. Oops. 
(so we have to handle any kind of occasional service error, permissions error, resource limiting error)


      try {
      } catch(e) {
        Logger.log("ERROR moving " + fn + " to Processed");
        console.log("ERROR moving " + fn + " to Processed");

CHANGE TO: add before remove

CHANGE also: try catch around remove (as saw that cause a fail)
although that might not be needed, script continued I think.

I think on this line:

noticed because QA xxx event didn't get through

Debug Oct 4, 2019, 6:37:50 AM File Name:
Debug Oct 4, 2019, 6:37:52 AM ERROR moving to Processed

YAY and can see the try catch in yesterday is working:
BUT, interesting, error on removing file ? access denied . . but it didn't cause script to exit with failure . . . until a bit later.

Debug Oct 4, 2019, 6:39:12 AM File Name:
Debug Oct 4, 2019, 6:39:12 AM Cannot get Owner/Email of the file, eh?
Debug Oct 4, 2019, 6:39:12 AM Cannot read the file
Debug Oct 4, 2019, 6:39:12 AM more stuff 
Debug Oct 4, 2019, 6:39:12 AM more updated row 98 . . . 

Error Oct 4, 2019, 6:39:13 AM Access denied: DriveApp.
    at ourEventProcessingFunction(Code:875)

ADDITIONAL quirk: the execution doesn't show up as Failed in the executions list/
It ran @6:37am, it's 2:30pm now and that job and many others showing as Running even though from log our last log entry "done" is in there.

oops we used up all cells in spreadsheet

So when a particular biggest sheet gets very big we:
 * send email with warning
 * make a copy of sheet for reference
 * delete all rows in that sheet
 * send email with successful cleanup message

We used to do this by hand after we received the email warning.

Oct 3 some events were missed, the events processing had failed a few times because call to getOwner.getEmail doesn't work for some files!
   (not "at random" but not consistent over owner of file or other things)
## put try/catch around it, log error, set the email to a sensible default

Project. Apps script code. Function.

Using executions view . . .

ourEventProcessingFunction Time-Driven Oct 3, 2019, 9:22:37 AM 113.192 s

ourEventProcessingFunction Time-Driven Oct 3, 2019, 9:17:37 AM 114.537 s

otherEventProcessingFunction Time-Driven Oct 3, 2019, 9:17:27 AM 4.279 s

Error Oct 3, 2019, 9:19:32 AM No item with the given ID could be found, or you do not have permission to access it.
    at ourEventProcessingFunction(Code:818)

    // sometimes getting permission denied/not found here:
    var user="error+" + fn + "@httpcats.com"
    try {
      user = childFile.getOwner().getEmail().toLowerCase();
    } catch (e) {
      Logger.log("WARNING: Cannot get Owner/Email of the file, eh? "+fn);
      console.log("WARNING: Cannot get Owner/Email of the file, eh? "+fn);

On occasion scripts were ended prematurely due to service limits being reached:

: googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded

$ drive trash -id $g
- 1C2JttNUnEbRceBDinb8HGksdM8qSay6r ()
Deletion count 1 dest: 3.47KB
Proceed with the changes? [Y/n]:
 0 / 3550 [---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------]   0.00%googleapi: Error 403: Insufficient permissions for this file, forbidden
 3550 / 3550 [===================================================================================================================================================================================================================================================] 100.00% 1s

move: 195ZOyMqKQHtoNknHCGdLOmeJrHEy_uG0: already exists. Use `force` flag to override this behaviour

move: 1X5DL54FdRf1cv4qCe_esysypCICA2xNN: dest: '' remote path doesn't exist

3/8/19 9:14 AM  monitorEvents   Service using too much computer time for one day        time-based      3/8/19 9:14 AM
3/8/19 2:14 PM  monitorEvents   There are too many LockService operations against the same script. (line 710, file "Code")      time-based      3/8/19 2:14 PM
3/8/19 10:29 PM monitorEvents   Service using too much computer time for one day        time-based      3/8/19 10:29 PM


The error report emails are useful . . . 

Error Message   Count
Service using too much computer time for one day        2
We're sorry, a server error occurred. Please wait a bit and try again. (line 848, file "Code")  1
Start   Function        Error Message   Trigger End
3/9/19 9:02 AM  ourEventProcessingFunction  Service using too much computer time for one day        time-based      3/9/19 9:02 AM
3/9/19 9:12 AM  ourEventProcessingFunction  Service using too much computer time for one day        time-based      3/9/19 9:12 AM
3/9/19 10:12 PM ourEventProcessingFunction  We're sorry, a server error occurred. Please wait a bit and try again. (line 848, file "Code")  time-based      3/9/19 10:14 PM

Monday, 16 September 2019

The Quakers, Chocolate and Sweets and Science and Bloomfield Hospital

Quaker Beginnings in England (from Wikipedia)

George Fox, an early Quaker
During and after the English Civil War (1642–1651) many dissenting Christian groups emerged, including the Seekers and others. A young man, George Fox, was dissatisfied with the teachings of the Church of England and nonconformists. He had a revelation that "there is one, even, Christ Jesus, who can speak to thy condition",[22] and became convinced that it was possible to have a direct experience of Christ without the aid of an ordained clergy. . . .  he travelled around England, the Netherlands,[23] and Barbados[24] preaching and teaching with the aim of converting new adherents to his faith. The central theme of his Gospel message was that Christ has come to teach his people himself.[22] His followers considered themselves to be the restoration of the true Christian church, after centuries of apostasy in the churches in England.
In 1650, Fox was brought before the magistrates Gervase Bennet and Nathaniel Barton, on a charge of religious blasphemy. According to Fox's autobiography, Bennet "was the first that called us Quakers, because I bade them tremble at the word of the Lord".[22]:125 It is thought that Fox was referring to Isaiah 66:2 or Ezra 9:4. Thus, the name Quaker began as a way of ridiculing Fox's admonition, but became widely accepted and is used by some Quakers.[25] Quakers also described themselves using terms such as true Christianity, Saints, Children of the Light, and Friends of the Truth, reflecting terms used in the New Testament by members of the early Christian church.
James Nayler, a prominent Quaker leader, being pilloried and whipped
Quakerism gained a considerable following in England and Wales, and the numbers increased to a peak of 60,000 in England and Wales by 1680[26] (1.15% of the population of England and Wales).[26] But the dominant discourse of Protestantism viewed the Quakers as a blasphemous challenge to social and political order,[27] leading to official persecution in England and Wales under the Quaker Act 1662 and the Conventicle Act 1664. This was relaxed after the Declaration of Indulgence (1687–88) and stopped under the Act of Toleration 1689.
The movement in its early days faced strong opposition and persecution, but it continued to expand across the British Isles and then in the Americas and Africa.
The Quakers, though few in numbers, have been influential in the history of reform. The colony of Pennsylvania was founded by William Penn in 1682, as a safe place for Quakers to live and practice their faith. Quakers have been a significant part of:
 * the movements for the abolition of slavery
 * movements to promote equal rights for women, and peace. 
* They have also promoted education and the humane treatment of prisoners and the mentally ill, through the founding or reforming of various institutions. 
* Quaker entrepreneurs played a central role in forging the Industrial Revolution, especially in England and Pennsylvania.

Conscientious objection

FAU ambulance and driver, Germany, 1945
During World War I and World War II, Friends' opposition to war was put to the test. Many Friends became conscientious objectors and some formed the Friends Ambulance Unit with the aim of co-operating with others to build up a new world rather than fighting to destroy the old, and the American Friends Service Committee. Birmingham, UK had a strong Quaker community during the war.[58] Many British Quakers were conscripted into the Non-Combatant Corps during both world wars.
Religious Society of Friends orFriends Church
Quaker Star
Symbol used by Friends' service organizations since the late 19th century

Famous Quakers

You may have heard of some of the following Quakers:
  • George Fox – founder of Quakers, 1624–1691
  • William Penn – friend of George Fox, founder of Pennsylvania, 1621–1670
  • John Woolman – American Quaker involved in the abolition of slavery, 1720–1772
  • John Dalton – British scientist who invented the atomic theory of matter, 1766–1844
  • Edward Pease – first Quaker member of Parliament, 1767–1858
  • Elizabeth Fry – British prison reformer, 1780–1845
  • Joseph Rowntree – Chocolate manufacturer, 1837–1925
  • George Cadbury – Chocolate manufacturer, 1839–1922
  • Arthur Eddington – physicist, 1882–1944
  • James Dean – actor, 1931–1955
  • Jocelyn Bell Burnell – astronomer, discoverer of pulsars, born 1943
  • Bonnie Raitt – musician, born 1949
  • Tom Robinson – musician, born 1950
John Dalton
John Dalton FRS was an English chemist, physicist, and meteorologist. He is best known for introducing the atomic theory into chemistry, and for his research into color blindness, sometimes referred to as Daltonism in his honour. Wikipedia
John Dalton was born in 1766 into a Quaker family in Eaglesfield, near Cockermouth, in Cumberland, England. His father was a weaver. He received his early education from his father and from Quaker John Fletcher, who ran a private school in the nearby village of Pardshaw Hall. Dalton's family was too poor to support him for long and he began to earn his living at the age of ten in the service of a wealthy local Quaker, Elihu Robinson. When he was 15, Dalton joined his older brother Jonathan in running a Quaker school in Kendal, Westmorland, about 45 miles (72 km) from his home.

George Cadbury, aged 78
George Cadbury (19 September 1839 – 24 October 1922) was the third son of John Cadbury, a Quaker who founded Cadbury's cocoa and chocolate company in Britain.


He worked at the school for adults on Sundays for no pay, despite only going to school himself until he was fifteen. [1] Together with his brother Richard he took over the family business in 1861. In 1878 they acquired 14 acres (57,000 m²) of land in open country, four miles (6 km) south of Birmingham, where they opened a new factory in 1879. He rented 'Woodbrooke' - a Georgian style mansion built by Josiah Mason, which he eventually bought in 1881.
In the early 20th century, he and John Wilhelm Rowntree established a Quaker study centre in the building,[2] and it remains the only such centre in Europe today, offering short educational courses on spiritual and social matters to Quakers and others. He also created a hospital in Normandy called "l'hopital de Normandy".
The Cadbury brothers were concerned with the quality of life of their employees and provided an alternative to grimy city life. As more land was acquired and the brothers moved the factory to a new country location, they decided to build a factory town (designed by architect William Alexander Harvey), which was not exclusive to the employees of the factory. This village became known as Bournville after the nearby river and French word for "town". The houses were never privately owned, and their value stayed low and affordable. Bournville was a marked change from the poor living conditions of the urban environment. Here, families had houses with yards, gardens, and fresh air. To the present, the town offers affordable housing.
The brothers cared for their employees; they both believed in the social rights of the workers and hence they installed canteens and sport grounds. Nineteen years after brother Richard died, George opened a works committee for each gender which discussed proposals for improving the firm. He also pressed ahead with other ideas, like an annuity, a deposit account and education facilities for every employee.
In 1901, disgusted by the imperialistic policy of the Balfour government and opposed to the Boer War, Cadbury bought the Daily News and used the paper to campaign for old age pensions and against the war and sweat-shop labour.[3]
George Cadbury was one of the prime movers in setting up The Birmingham Civic Society in 1918. Cadbury donated the Lickey Hills Country Park to the people of Birmingham. He also donated a large house in Northfield to the Birmingham Cripples Union that was used as a hospital from 1909. It is now called the Royal Orthopaedic Hospital.[4] In 1890 he, along with a number of other leading Quakers, helped re-establish Grove House School as Leighton Park School in Reading as the leading Quaker school in Britain.
He died at his home, Northfield Manor House, on 24 October 1922, aged 83.

Joseph Rowntree Joseph Rowntree in 1862.jpg
Photo: Rowntree around the age of 26

Born: 24 May 1836, York, England
Died: 24 February 1925 (aged 88)
Occupation: Chocolatier
Julia Seebohm (m. 1862; died 1863)
Emma Seebohm (m. 1867)

Children: 6
Rowntree Society

Joseph Rowntree (24 May 1836 – 24 February 1925) was an English Quaker philanthropist and businessman from York. Rowntree is perhaps best known for being a champion of social reform, partner and friend of Charles Booth, and his time as a chocolatier at family business Rowntree's, one of the most important in Britain. Even as a powerful businessman, he was deeply interested in improving the quality of life of his employees; this led to him becoming a philanthropist, pursuing many charitable causes. In 1904 he created three trusts, the Joseph Rowntree Village Trust (JRVT) which was originally set up to build and manage the garden village of New Earswick, the Joseph Rowntree Charitable Trust (JRCT) and the Joseph Rowntree Social Services Trust (JRSST). The latter two were both set up to effect social reform, the difference between them being that whereas the Charitable Trust was set up as a charity, the Social Services Trust was set up as a limited company so that if necessary it would be able to undertake social and political work not legally allowed by a charitable Trust. He suggested that only the JRVT would be permanent but in fact all the trusts are still in existence although the Social Services Trust has changed its name to the Joseph Rowntree Reform Trust and with the separation of the Joseph Rowntree Housing Trust from the Village Trust in 1968, there are now four trusts that exist today.

Early life[edit]

Rowntree was born the son of Sarah and Joseph Rowntree, on Pavement (the name of a street) in York where his father owned a grocer's shop.[2] He attended Bootham School.[3] At fourteen he accompanied his father on a visit to Ireland, and witnessed the effects of the potato famine.[4] This experience was to provide the grounding for his political views and business ideas later in life.

Jocelyn Bell Burnell - Wikipedia

Dame Susan Jocelyn Bell Burnell DBE FRS FRSE FRAS FInstP is an astrophysicist from Northern Ireland who, as a postgraduate student, co-discovered the first radio pulsars in 1967.

Bloomfield Hospital https://www.bloomfield.ie/
Bloomfield Health Services is an independent non-profit healthcare provider located at the foot of the Dublin mountains at Stocking Lane in Rathfarnham.

Bloomfield was founded in 1812 by the Religious Society of Friends (Quakers) using money from annuities, donations and annual subscriptions from individuals Friends and Monthly Meetings. 
Almost from day one, the management committee wished to admit non-Quakers to Bloomfield, and this wish was formally ratified in 1828, arguably making Bloomfield an early model of multi-faith tolerance.
 . . . we continue to deliver our services routed in those principles, honouring the intrinsic dignity of each person.

In 2005, Bloomfield moved from Donnybrook to its current site in Rathfarnham.

Our services bridge both neurological and psychiatric disciplines and this joint approach is part of what sets us apart from other providers.

We provide specialist mental health assessment, treatment and support services to adults with a range of serious and enduring mental health issues and neuro-psychiatric disorders, such as 
 * Alzheimer’s Disease, 
 * Schizophrenia, 
 * Parkinson’s and 
 * Huntington’s Diseases.

Our Mental Health service is also an approved teaching hospital and clinical site affiliated with Trinity College Dublin (TCD).

Online References: 

Tough topics but good to learn a bit about them.