Saturday, 31 October 2015

How to add a new millestone to a FogBugz project

Open the Agile link (top-right of page)
select the project
Use the Add a milestone button at top-right, row-three

.js.map files - Source maps

These map the original developer .js file's line numbers onto locations in the .min.js file, to return proper locations in case of a bug.


Dev things I did today, Fri 30/10/15

experimented with grlDictionary, watching how the internal array of associations filled up, and automagically got bigger when full

added poolId and accessors to Bout

added roundId and accessors to Round and to Pool

Round now knows what Round it is.  Pool now knows what Round it belongs to.

So how to use the pools object in Round.  It should be a dictionary of Pool objects, keyed on poolId.


==========
What is the lowest level that is useful?

A list of fencer names.

Input a list of fencers names, and store them as fencers.

idea:
A shortcut for setting up single event competition, that automatically fills up the event data from the competition data entry

A pool.

A dictionary of bouts, each with a dictionary of boutScores

Something that will write the
pool html index file

And write the pool's Referee files

========

added competitionId and eventId to Round
added competitionId and events to Competition
added eventId and rounds to Event
added accessors for name startDate to Competition
amended  boutNumber to boutNum in BoutScores
added competitionId and eventId to Pool
added FencerRound class
added wins, draws, defeats, hitsScored, hitsReceived, indicators, rank, fencerId, roundId, poolId to FencerRound

Installed latest Seaside on Pharo 4.  Installed Gawain-Directoire on Seaside.  Installed

Set up my first component/webpage on Seaside.

Create a Root component from WAComponent.  Set (class attribute) canBeRoot to ^true
Created a renderContentOn: method that writes the HTML.













Friday, 30 October 2015

The list of Unique Short Names

i.e. Set should be used to determine uniqueness of shortNames

aSet
   listOfShortNames includes: aNewShortName
      ifTrue:
        [
            find out who also has the shortName
            make that shortname longer
            amend that original shortName everywhere it appears
            get a longer shortname for the new candidate]

Things I Did Today, Fri 30/10/15

Up just before noon
fresh t and pants and socks
Last night, washed for bed
breakfast porridge and oj

Took pill

Tidied pens up from around the house

Took Alexa to Amy's

Bought new pills

Bought treats and snacks

Put dinner in oven and on hob

Separated Thing I did Today into Dev and non-dev

Watched 3 Grimms




Thursday, 29 October 2015

Things I Did Today, Wed/Thursday 28/29/10/15

Wed. Got up, and made lunch out of noodles, beans, sweetcorn and chili sauce.  It was very *very* hot.

I had to defrost the sweet chili sauce - it had fallen off the back of the shelf in the Fridge.

Angus was pleasant when he came home tonight.

Designed the Classes and variables for Person, Fencer, SchoolFencer, Competition, Event, Round, Pool, Bout

Wrote the accessors for Classes Person, Parent, Fencer, SchoolFencer

Wrote initial addChild: and addEmail: methods to Parent

Couldn't find how to set a Date object to a certain date.  Asked the question on Stack Exchange.
Lifted my rep from 6 to 21.  It didn't answer my question,

Set up a Monticello repository for Gawain-Directoire :-)

Discovered that my Pharo 1.4 image is not saving when I Save and Quit

I played Warframe from 3:3opm, paused to watch a Grimm with Angus and CJ, and played Warframe all through the night, going to bed at 7am once CJ was up.

I then removed Warframe from the PC, to try and ensure I actually get on with creative things, rather than simply consuming things.

Thursday
Watched an episode of Japanese drama
Got up, fresh pants and T. Made a twin soup medley.

Put away the inner PC box

Went to bed at ~2:20am

Began doing Smalltalk coding.

Designed the classes BoutScores

Wrote the accessors for Classes Bout, BoutScore, Pool,

Redesigned those Classes as I went

Watched a TV movie - girl ordered to work on horse ranch by courts. "Spirit Riders"
while web-browsing

Read the answers to my question on Stack Overflow.
Asked the question I really intended to ask on Stack Overflow.  Lifted my rep to 35.  Found the answer to the question I really wanted the answer to. :-)

And also received the answer I really wanted on StackExchange

Did the foodbin x3 and the bin and cleared the surfaces with Alexandra. :-)

Read up on Matrix, Date, String, DateAndTime

Began to read OU Collections book

Discovered about Lockdown for Squeak - allows you to set up Squeak to just-run the app, rather than letting the end-users the full run of the Smalltalk image

http://stackoverflow.com/questions/19350167/can-you-deploy-applications-written-in-smalltalk-squeak-pharo-like-a-java-app
http://bike-nomad.com/squeak/





, then asked the question i really wanted

Tuesday, 27 October 2015

Things I did today, Tuesday 27/10/15

Up at 11:30am

Breakfast alpen + oj
Empty + fill the dishwasher
Take Angus to dentist
Get Angus to bring down his dirty clothes and clear up some of his floor
Warframe
Carve pumpkin w alexa
Watch Flash with Alexa



Next steps: Oct 2015

Software improvements

Often the client device ends up displaying an empty pool grid or Test Area
   Add a change to the text to say "if you see this, press refresh" 

Is this a server issue or a software issue?

Hardware improvements

Currently, Mongoose running data from D:
    Why is favicon.ico served so slowly?  Should it be served as an explicit http request in the page?
    Should the fonts be served locally?  The actual font file (T...etc.woff2) is the second slowest

 Would moving to LightTPD sort these issues?

Would it happen if it was served from Toto?
How to mount
mount //192.168.1.222/win_share -t smbfs /mnt/folder_on_linux -o "username=winuser,password=winsharepassword"


Audience  
A version of the Referee files that does not allow access to the Boutlist or bout 
Therefore - initialise.js has to have a toggle for Referee or Audience.
If Referee, the buttons for BoutList and Bout are written
If not referee, they are not written.



Data written to a DB server.  
   CloudDB
   PostgreSQL 
   (Or both)
   a Smalltalk image
   a Smalltalk image with persistence.
        
Working with Fencing Time

FT creates an pool file, empty of scores.

1) Grab the competition info.  Or have it re-entered.
2) Read the empty pool.  Create a referee page for this pool.

Referee does its thing.

3) Read the pool scores.
4) Write the scores into the FT pool file.


1) 
a) Where does FT write the files to?
b) Format of the files?
c) How to get that info from FT to Directoire
d) What will this part of Direcoire run in or on?

2) 
a) Read the .XML file in.
a) ii) Ideally, read all the XML files for the entire round in.
b) 
i) Write each pool file to Referee.  (This is the bit I need to get my head around - where do I write it to?) 
ii) Needs to be written to where it can be opened by a device's browser.
iii) So...   using Clubknight or an equivalent, create a folder for the competition's Referee files.
Put the files in the folder.
Create a competition/event/round list of Referee pools.
Or - create a single html file with the single link.  Email a bit.ly version of the link to the Referee. Or make it available to the specific device?

When the bout has been accepted by Directoire, (remove the link) 



Create a competition in ClubKnight or in Directoire.



Read an empty Fencing Time file.  Create a fresh Write 
Get the connection to Fencing Time sorted.

Monday, 26 October 2015

Things I did today, Monday 26/10/15

Washed Angus's pants
Hung up Angus's pants
Went through crushing the cardboard and plastic from the sink with Alexandra
Got rid of Dominos boxes
Cleared plastic bottles and cardboard juice boxes from kitchen
Got Angus to do the dishwasher before computer - HUGE fight
Put oven on for dinner
a little tidying of litchen
a little tidying of bathroom
clothes mountain in bedroom
put away my clothes from drying racks

Sudoku iller x 1.5


Out of bed at 11:30am

alpen + oj for breakfast
Pot noodle at 3:30pm

No warframe until 5pm!  WF from 5-5pm, 6:30pm-8pm

Attempted to track down the cause of so many badly displaying Pools from clubknight/trial
Often showing test area instead of the Pool

Sunday, 25 October 2015

The out-of-order bout scores problem

Due to timing issues, sometimes early hits from the bout arrive later than the later hits.

If these are simply appended to the list of scores, then the last score to be written to -status.js would be applied to a recovered bout.  And we want the last bout recorded, not the last bout received by PHP.

So - will freezing out the user input until the hit is recorded fix this? Yes.

Would freezing out user input for a second fix this?  Yes.

Would putting the scores into an array of scores, indexed by a score-input counter fix this?  Definitely.

So currently the scores are sent as the current score for [fencer1][fencer2] and [fencer2][fencer1]

Continue doing that, as at present.

When you send an updated score, send an increment number.

When you store the updated score (append it to -status.js) store them into an array of current bout's scores.

When restarting a recovered incomplete bout, find the current score that has the largest increment number, and use it.

If the current bout is unstarted, then no change from current code.

If the current bout is complete, no change  from current code.

So - send to getScores.php
getScores.php

change in -status.js format to include increment number




Saturday, 24 October 2015

Things I did today, Sat 24/10/15

Warframe

Bringing gawainDev, gawain and trial into synch

Getting BitBucket versions of gawainDev and gawain into synch

All brought into synch with Referee 4.0.5/CK 3.9.3 from gawainDev

Getting rid of the now-irrelevant clubknight-trial directory

Moving trial to D:\

Setting up separate D: Mongoose (port 80) and M: Mongoose (port 8080)

Setting up port forward for port 8080

Performance comparison tests on the D: + SSD and M: + NAS Clubknights

Load LightTPD

Begin configuration of LightTPD on Windows.

Things I did today

Tuesday
Warframe and Smalltalk PBE

Wednesday
Warframe and Smalltalk PBE

Thursday
Warframe and Smalltalk PBE

Friday
Warframe and Smalltalk PBE

ClubKnight Dev->Production, Mk1

There are three configurations for ClubKnight

1) Development

2) Test

3) Production

Production holds the production code in

/web_root/trial/
          /templates/  holds the .phtml files
          orgs.php
          /<orgs>/<competitions>
       



Clubknight Perforrmance on Mongoose

Clubknight is sometimes slow to response

Currently, the response comes in from the 'net,
Mongoose serves up the .php page for the pool
it requests the ancillary files from the server disk

so... net to pc, mongoose uses PHP to assemble the page, which then calls the ancillaries - .css, .js - from the NAS drives

Sometimes this can take up to 6-7 seconds total.

Firefox breaks the timings down to:
650ms to 6secs to assemble the PHP page
~300ms start to end for all the ancillaries, which all happen in parallel

Moving the files to the local SSD was meant to speed things up enormously, by doing away with the disk spin-up period in the assembly of the initial PHP web page

But....  it didn't

It is very slightly *slower* to pull from the local SSD than from the NAS drive across the intranet

So....  time to find a faster server than Mongoose?

Perhaps that will help with the PHP log append issue.

If the server becomes more responsive, then that should make any intrusion from a waiting graphic less intrusive.

A trial of LightTPD served a static file in 22ms



Clubknight server configuration, Mk2

The server is now:

M:\<etc>\gawainDev   - Dev

M:\<etc>\gawain    - Test

M: Mongoose is now on port 8080

The clubknight splash page sends the user to the D: Mongoose,
so you have to manually add the :8080 into the url again


D:\<etc>\trial  is on port 80   - Production


Doodles on what next

How to architect what's coming.

clubknight/trial

clubknight/referee

clubknight/audience

clubknight/bigscreen

except that means it's be different datasets


So.....






Friday, 23 October 2015

Things I did today, Mon 19/10/15

Went to bed with CJ
Did not sleep at all.
Got up at 8:30am
Play SkyForge til 10:30am
Went to bed and slept til 12:15pm

Got up, moved Lenny closer, ready for taking stuff to the dump and collecting the new microwave.


Tuesday, 20 October 2015

Referee architecture

getBout.php - which bout are we on
getScores.php - the latest current score in the current bout
getResults.php - all the latest info at the End of the Bout


gawainDev is the dev area
gawain is the testing area
clubknight-trial is pre-production
trial is (currently) production

Each of them uses their own Organisation lists


Things I did today, 20/10/15

Took children to dentist

Got haircut

Made Alexa and I baked potatoes in the new microwave

Helped Alexa do the baked beans

Fell asleep, watching Brooklyn 99 with Alexa

2 Warframe missions

Watched 1 Grimm

Updated getScores, getResults, getBout to use
file_put_contents("orgs/$orgId/$competitionId/$filename", $toWrite, FILE_APPEND | LOCK_EX);


Monday, 19 October 2015

Things I did today, Sat/Sun 17-18/10/15

Tidied and vacuumed the living room
Tidied and vacuumed the hall
Cleared the kitchen surfaces, filled the dishwasher
Made the bed

Played 2 missions of Warframe

Went through more chapters of Pharo By Example, including overcoming 3 issues

Watched 2 eps of Grimm with Angus

Put petrol in Lenny, parked him, and Fuelly-ed

Watched 2 Grimms with Angus & CJ

======

Set up a char x2 and played 4 missions of SkyForge

watched 2 Grimms with Angus and CJ




Friday, 16 October 2015

Things I did today Thu 15/10/15

Krispies
4 egg omelette
Pot noodle
biscuits

Shopping at Margiotta
Pizza
flat sausage
ice cream
biscuits
scones
baking powder
olive oil spray
magazines - car, new scientist
sweetcorn
kidney beans

more tidying in study
Created a skid plate for the PC
   - this lets it slide in and out of its slot very easily

Created a slot for the PC, by the radiator

Reorganised and labelled the PC cables - power;  monitor power + monitor signal x2 ; monitor audio ; keyboard
Connected up the PC. All working :-)

Played Warframe
Sudoku

Downloaded Pharo by example and the corresponding version of Pharo





Wednesday, 14 October 2015

The 5 stages of grieving

Denial

Anger

Bargaining

Depression

Acceptance

Things I did today Wed 14/10/15

Went to bed early - tried to fall asleep to videos
Slept in late

Krispies for lunch
mid-afternoon Knorr chicknoodle soup, w 2 eggs as straciatella
Cheese & pickle toasties mid-evening

Pebble charge arrived
Unpack PC
Begin tidying study (3 batches of 1/2 hour)

Put porridge oats into plastic tub

Several goes at Guardian Sudoku and Killer
One killer on phone
Found cordless handset, charged the batteries



Tuesday, 13 October 2015

Next ClubKnight step

Fix the out-of-order hit recording
=======================
a) Place a pause at the client end between each hit recorded

b) Store the hits into a PHP array as they arrive.
Do not log hits if they arrive after later hits which have already been logged
http://www.w3schools.com/php/php_sessions.asp on how to persist data between invocations of a script

or store the sequence number into SQLite rather than a session store, or into CouchDB

c) Store the hits as an array in Javascript in the client, and store the index/sequence number in status, so they are restored to the recorded-order, and not the logged order

Eliminate part-recorded data
===================
1) Hardware
a) Stop using the NAS, start using local hard disc
b) Start using local SSD to speed things up

2) Upgrade to PHP 5.5.30
Does this fix it?
NO.

3) Change from
fopen()
fwrite()
fclose()

  to

file_put_contents($file, $data, FILE_APPEND | LOCK_EX);

This also incorporates flock()

Provide Gawain Audience.
==================
List pools on a separate competition page
These pools go to pages which do not have Boutlist or Bout divs accessible (or perhaps not even included)

Next enhancement: search by fencer name, and get a list of links to only relevant pools.

Gawain BigScreen
=============
A list of which pool each fencer has been assigned to, and their referee
 to display in alphabetical order






How to block the screen until the data is sent

Custom-made 'loading/working' graphics
http://ajaxload.info/

xmlHttpRequest.onreadystatechange method fires spontaneously every time the XHR state changes - i.e. everytime there is fresh information about the XHR's progress that returns from the server

http://www.w3schools.com/ajax/ajax_xmlhttprequest_onreadystatechange.asp
readyStateHolds the status of the XMLHttpRequest. Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
status200: "OK"
404: Page not found

https://en.wikipedia.org/wiki/XMLHttpRequest#The_onreadystatechange_event_listener

http://www.antradar.com/blog-in-order-ajax-handling


position: fixed;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
background-color: white;
opacity: 0.3;
display:none;
z-index: 100; /* should be large enough to be on top of everything */



http://stackoverflow.com/questions/2941189/how-to-overlay-one-div-over-another-div?rq=1

Using a div with style z-index:1; and position: absolute; you can overlay your div on any other div.
z-index determines the order in which divs 'stack'. A div with a higher z-index will appear in front of a div with a lower z-index
========================

http://stackoverflow.com/questions/2212578/overlaying-a-image-over-a-whole-web-page


HTML<div class="overlay"></div>


CSS

.overlay{ position:absolute; top:0;left:0; width:100%;height:100%; background:url("image.png") repeat; }

You probably want to put the div at the very end of the html to ensure it's above everything else on the page, alternatively you could use z-indexing, eg.

.overlay{ position: fixed; top: 0px; left: 0px; height: 100%; width: 100%;
background-color: white; opacity: 0.3; display:none; z-index: 100; /* should be large enough to be on top of everything */ }


an example:
http://forums.asp.net/t/2043990.aspx?display+loading+image+on+button+click
http://jsbin.com/fazaxivofu/1/edit?html,output

another
https://blog.oio.de/2010/11/08/how-to-create-a-loading-animation-spinner-using-jquery/

Things I did today 12/10/15

Fell asleep on couch, ~midnight
Woke up, went to bed, ~4am
Woke up, 12:40pm
Got up 1pm
Ran bath

Made porridge w cheese
smoothie
orange juice

Put away recycling
set off dishwasher

Sudoku 70 mins

Read Sat guardian mags

Blogged Ruby variable naming


Looked up sports high scores, decided on 10,000 point limit.

Identified JavaScript's largest safely integer value : 4294967295

(2^32-1) = 4,294,967,295 or almost 4.3Billion

There is a new standard out, with a max safe integer value of 2^53-1, but it's poorly supported.

Ruby variable names convention

The first characters of a name indicate how the name is used. 

lowercase letter : Local variables, method parameters, and method names 

uppercase letter: class names, module names, and constants

Prefixes:

global variables : $

instance variables : @

class variables : @@

As no variable may begin with a digit, no digit can follow immediately after a $ @ or @@ prefix

Things I did today 10 & 11 Oct 2015

Today
====
Calculated the pumped storage potential of the Tummell/Rannoch/Pitlochrie hydro series
Read Strathclyde Uni's pumped storage document - turns out folk have thought about it
Set up two test pools, ran one with Chrome on Chromebook, ran one with Chrome on Galaxy S3. on PHP 5.5.10

Read up on PHP's manual for fwrite
Bug reported PHP fwrite issue
Discovered how to install a new version of PHP for Mongoose
Installed PHP 5.5.30
Re-configured Mongoose to use it

Installed Ruby 2.2
Looked into how to use Ruby to check all the -status.js files in /trial/orgs/ to id the ones where the write was buggy
 - if the line starts // or bo or cu then it's fine

Blogged the ClubKnight architecture
Noted the issue with restoring incomplete bouts when the hots have been recorded out-of-order
To do: record it on Fogbugz

Read up on the 60-year climate cycle

Found the curtain pole measurements, and copied them

Took out the food bag and the bin bag
Emptied the dishwasher, and filled it

Krispies
Cooked Kraft macaroni cheese
Toasted the final two pancakes
Cup-a-soup, 2 slices bread

All while 4 eps of White Collar
Started The 4400 - 3.5 eps

Yesterday
=======
Looked into Solar Slate Photovoltaic tiles
RES group have some
Solar Century c21e have some (less good looking)
Have Edinburgh council approved them for use in conservation areas?
Must install tiles by 31stDec to receive the additional £8k pounds in government funding
Must have a home energy-efficiency certificate
Must be installed by a registered MCS installer

Set up laptop as web server
Reserved the laptop's IP
Port forwarded http/port 80 to the laptop
Confirmed the configuration of the laptop's VNC server

Chopped a spare onion

porridge with cheese
sausage risotto with 2.5 peppers, an onion, mixed veg

JavaScript's largest safely integer value : 4.29 billion

JavaScript's largest safely integer value : 4294967295

(2^32-1) = 4,294,967,295 or almost 4.3Billion

There is a new standard out, with a max safe integer value of 2^53-1, but it's poorly supported.

Highest recorded scores for sports

A ceiling of 10,000 points should cover all of these:


[Association] Football - 149-0 in Madagascar

Rugby 356-3 - 53 tries

Basketball 186-184

[Field] Hockey

Ice hockey  International: 82-0, NHL 16-3

American Football NFL: 72-41, College: 171-0, 158-6

10-pin bowling - perfect score 3,000

Snooker - perfect score 147.  Up to 155 if the opponent gives away a foul.


Monday, 12 October 2015

Approaches to ensuring incomplete bouts restore to the last-recorded score

Currently, many loggings go missing or get logged out of order - if the score up/down buttons are pressed in rapid succession.

If they arrive out of order, then they would restore the wrong score - if the bout is still incomplete at the time of the restoration.

It will be wrong because the restoration takes the latest-logged result to be the latest, i.e. current result.

It is not a problem for any completed bout - the "End the Bout" button tends not to be pressed rapidly after the last hit is recorded, and the record, including scores, is re-written.

One option - record a sequence number each time a hit is recorded, and verify that the hit being restored has the highest sequence number.  This means that the format of the hit-recording array needs to be altered.

Currently it is stored as
// Bout 1
currBout=1; boutStartTimes[1] = '2015-10-12T07:47:58.401Z';
currFencer1 = 1;  currFencer2 = 2;boutStarted[1][2] = true ; boutStarted[2][1] = true ;
boutScores[1][2] = 3;  boutScores[2][1] = 0;

Make the boutScores[][] into boutScores[currFencer1][currFencer2][hitSequence] ?

And increment the hitSequence each time a hit is recorded - OR a hit is corrected - by the referee.

How would it work out on the restoration?  To be continued...

Clubknight - data loss testing

Cluknight occassionally loses the data from the beginning of a log string to the pool status file.

Rough guesstimate - 0.3% of logging attempts

Here is an attempt to re-create the data loss under controlled conditions

1st try:
From Chromebook
On local intranet
HP laptop as server, using wired ethernet, Virgin Superhub2 as router

Test / 151012 data loss / 0820
5 fencers, to 10
Alternating patterns of  10-0, 0-10, 5-10/10-5
No errors
85 hits
~105 records
679 lines of data
30KB

2nd
from Chrome on GRL's Samsung Galaxy 3
Test / 151012 data loss / 0845 Samsung Chrome
5 fencers, to 10
Alternating patterns of  10-0, 0-10, 5-10/10-5
15 bouts
~125 hits
~155 records
1098 lines
48KB

Bout 1
  Hit 1 missing
  Hits 3 and 2 are written out of order
Bout 2 Hit 2 missing entirely
Bout 3
  Hit 2,4,6,8,13 missing
  11,12 out of order
Bout 4
  3 2 1 4 7 6 9 10
  5, 8 missing
Bout 5
  4 2 1 3 5 6 7 9 8
  10 missing
Bout 6
  1 3 4 5 7 8 9 10 13 11 12 15 14
  2, 6 missing
Bout 7

3rd pool  151012-1710-Chromebook
======
Upgraded PHP to 5.5.30
(hardware - HP laptop, NAS, Mongoose 5.5 running from NAS, PHP 5.5.30 not-thread safe x86 )
A one second pause between each send is perfectly adequate
Clicking as fast as you can led to 60% data loss, and out of order for the other 40%

Clicking ~2/sec still loses
Bout 6
Reloaded into LG G3
On touchscreen, going from 10th increment to End the bout asap, lost some of the writing 





Architecture of ClubKnight

Currently:

clubknight.uk.to is the default Mongoose host domain

It links to :
http://clubknight.uk.to/trial/newOrg.php

newOrg.php creates a new 
      trial/orgs/<org> directory
   and in it
      index.html
      ((O-<org>Comps.php
      compsList.phtml
      ()-<org>NewComp.php

((O-<org>Comps.php displays 
      the list in compsList.phtml 
   and 
      a link to ()-<org>NewComp.php

()-<org>NewComp.php creates
      trial/<org>/<comp>
and 
     adds <comp> to trial/<org>/compsList.phtml
and 
     creates in trial/<org>/<comp> 
         index.html
        ((C-<comp>Pools.php
        <comp>PoolsList.phtml
        ()<comp>NewPool.php

()<comp>NewPool.php  creates
   adds <pool> to 
       trial/<org>/<comp>/<comp>PoolsList.phtml
   and 
      creates in trial/<org>/<comp>
         (P)-<comp>-Rd()-Grp0820.php
         <comp>-Rd()-Grp0820.js
         <comp>-Rd()-Grp0820-status.js
        





VNC for Black2

Port 6666, and  it's 0.110 on the Superhub atm.

PHP bug, PHP upgrade, PHP configuration

The tests are showing that the writes are happening out of order, or not happening at all.

But none of them are happening partially.

Reading up on the PHP site, PHP is indeed designed so that they should either happen in full, or not happen at all.

So it's a PHP bug.

I have upgraded from PHP 5.5.10, supplied with Mongoose, to PHP 5.5.30, the latest in the 5.5 series.

I have upgraded to non-thread safe, x86

There are reports that PHP is not threadsafe whichever of the two binaries you choose.

To alter the version used, simply place the unzipped PHP folder in the Mongoose directory, and amend the mongoose config .txt file in the Mongoose directory to refer to the new PHP directory.

Thursday, 8 October 2015

Naive thoughts on how to structure the Referee data for CouchDB

Option 1
A Database per pool
Document per match?
Sub-doc per hit?

Option 2
A Database per match
Document per hit?


For the authorised users database:
A database per user

Wednesday, 7 October 2015

Logging from Referee

Currently, Referee attempts to send any changes in data incrementally, as and when they happen.

There are three kinds:

Change of the active bout
   - if the referee is skipping a bout or returning to an earlier incomplete bout
   - send the new bout number
Example:
// Bout 3
currBout=3; currFencer1 = 1;  currFencer2 = 3;


Change to the mid-bout score
   - if a fencer scores a hit, or the referee corrects a typo
   - send all the latest info for both of the fencers in the current bout
Example:
///////////////////////////////////////////////////
// Bout 1
currBout=1; boutStartTimes[1] = '2015-01-26T19:48:00.548Z';
currFencer1 = 1;  currFencer2 = 2;
boutStarted[1][2] = true ; boutStarted[2][1] = true ;
boutScores[1][2] = 3;  boutScores[2][1] = 0;

Bout is complete
   - if the referee confirms the bout is over
   - send the final bout scores
Example:
///////////////////////////////////////////////////
///////////////////////////////////////////////////
// Bout 1 over 
///////////////////////////////////////////////////
currBout=1; boutStartTimes[1] = '2015-01-26T19:48:00.548Z';
currFencer1 = 1;  currFencer2 = 2;
boutScores[1][2] = 4;  boutScores[2][1] = 0;
boutVictors[1][2] = 'V';   boutVictors[2][1] = 'L';
boutStarted[1][2] = true ; boutStarted[2][1] = true ;
boutStartTimes[1] = '2015-01-26T19:48:00.548Z';
boutFinishTimes[1] = '2015-01-26T19:48:05.427Z';
///////////       ///////////////       ///////////

Typical lengths

Question.  What if the current bout is changed to a partially complete bout?

Then the previous logging of the latest score should still exist.
What if it did not write successfully back then?

Gawain (GW) should re-write the most recent score for the part-complete bout which has now returned to being the current bout.

Asked a question on Stack Exchange today

"Why is PHP file append only wholly successful in 99.7% attempts"

Couchbase and CouchDB

Couchbase is a merge of an earlier fork of CouchDB with MemBase.

CouchApps are only for CouchDB.


Tuesday, 6 October 2015

Gawain Current architecture

Mongoose running on Stack and on Black2

Web content stored at myBookDuo/mongoose - accessed from any XXHTWN location

Data directories are in:
   myBookDuo/mongoose/web_root

The default domain hostname is ________ and is at that level

The alternative hostnames are one level down from there, in
myBookDuo/mongoose/web_root/
   elucidiumprime
   elucidium
   clubknight
   clubknight-trial
   paff
   grantlove
   fif
   myrddin

Other folders at that level:
 

     

RPi - toto

Set up for VNC access

Set up for ssh access

Set up Mongoose on toto
OR
set up Apache on toto

What is the IP address?

What is the VNC port?

JavaScript Grid widgets

Jqxgrid

For Excel-style grids, with nested grids available
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/

BackGrid
http://backgridjs.com/
Another Excel-style grid

Gridster
http://gridster.net/
Almost it - but can't do swaps except sometimes.  It does inserts instead of swaps sometimes.



Although a post by the author at:

https://github.com/ducksboard/gridster.js/issues/54
says

"The behavior is as follows:
Widgets of smaller or equal size to the dragged widget (player) 
will swap places with the original widget.
This causes tiles to swap left and right as well as up and down.
By default smaller players will shift larger widgets down.
I have added an option to prevent this behavior:
$.gridster({
    shift_larger_widgets_down: false
});
By setting shift_larger_widgets_down to false, smaller widgets will not displace larger ones."

So it should work *if* the tiles are the same size.


sBaseline
Designed to have a tiled set of richly graphic tiles, and inserts instead of swaps sometimes.

BUT - seems to do swaps most often - just doesn;t show you that that is what is happening.

The Love Swordplay Gawain Suite

Gawain - Gordon's Application Without An Interesting Name

ClubKnight
App for phones that allows device users to enter Fencer names and start Referee for one pool at a time.

Referee
The JS app for recording and displaying scores

Later sophistication
Differing colours for complete and incomplete bouts.

Audience
Referee minus access to Bout and Boutlist, and without storing anything back to the server.

Later sophistication:
Store the bout being viewed

BigScreen
Audience

Later sophistication
Tickertapes of latest events along the bottom of the screen.
Auto slideshow from one pool to another
Additional area for who is about to fence

Directoire
The central app for adding fencers, and altering who fights who, and recording results, and then determining the next round's pools and matches

Later Sophistication
Organising Season championships results
Perhaps as a different Name
Season

AskGawain
All results for all fencers from all fights, searchable

Mercurial in the Cloud - Bitbucket.org

eme std+1 ?

Fogbugz

The way to get into the Fogbugz listing is now to go to
https://loveswordplay.fogbugz.com/
grl std+1

Pharocloud.com and Ephemerics

Pharocloud.com allows you to run zipped Pharo images on the cloud.

rig std+1

They are run in "Ephemeric" instances.  i.e. they store the image offline, until it's called for, at which point they restore it from disk and start the image running again.  It gets stored back to disk after 30 seconds of inactivity.

To set up the System, click on "Ephemerics", take note of the "API User ID" (User Id) and the "API Auth Token" (Password) and then press the "Open Cloud Client" button.

In the "Ephemerics Cloud Manager", enter the User Id and Password, and press "Sign In".

At this point, you can drag'n'drop a zipped Pharo image onto the Ephemerics browser window.






SmileUpps, CouchApps, Stripe, JSON.stringify, JSON.parse

What are SmileUpps?

They are specialised versions of CouchApps, run on the cloud at
https://www.smileupps.com/

They are easy to integrate with stripe.com

No acc

What is Stripe.com
It's a payment system.  It takes online payments made by standard credit/debit cards in a web-browser.
grl now has an account, fab std+1

What are CouchApps

They seem to be a way of storing the Javascript and graphics for web apps in CouchDB documents, and getting CouchDB to serve the assets as a web app.

There is probably some additional scripting to learn to use them, to configure the app.

JSON.parse and JSON.stringify
How turn a JS object into JSON.  And how to turn JSON back into the constituent parts.

New questions
How to assign multiple constituent parts of JSON into the correct JS variables.