Monday 20 November 2017

encoding HTTP request characters & > " < ' &amp; &gt; &quot; &lt; &apos; %22%27%3C%3E%26


Encoded request for """Test msg AMP GT QUOT \r &>"\r"""
POST /test HTTP/1.1
content-type: application/x-www-form-urlencoded
Host: test:8080
Content-Length: 133
various_params=whatever&text=Test+msg+AMP+GT+QUOT+%c3%96r+%26%3e%22%c3%96rHTTP/1.1 200 OK
https://www.url-encode-decode.com/
TEST AMP GT QUOT SLASHR & > " \r
TEST+AMP+GT+QUOT+SLASHR+%26+%3E+%22+%5Cr%0D%0A
INPUT:
TEST AMP GT QUOT SLASHR & > " \r
TEST+AMP+GT+QUOT+SLASHR+%26+%3E+%22+%5Cr%0D%0A
0:    (  2  <  F  P  Z  d   n   x
1:    )  3  =  G  Q  [  e   o   y
2:    *  4  >  H  R  \  f   p   z
3: !  +  5  ?  I  S  ]  g   q   {
4: "  ,  6  @  J  T  ^  h   r   |
5: #  -  7  A  K  U  _  i   s   }
6: $  .  8  B  L  V  `  j   t   ~
7: %  /  9  C  M  W  a  k   u  DEL
8: &  0  :  D  N  X  b  l   v
9: ´  1  ;  E  O  Y  c  m   w

HTTP request encoded OUTPUT:

TEST+AMP+GT+QUOT+SLASHR+%26+%3E+%22+%5Cr%0D%0A
TEST%2BAMP%2BGT%2BQUOT%2BSLASHR%2B%2526%2B%253E%2B%2522%2B%255Cr%250D%250A%0D%0A
0%3A++++%28++2++%3C++F++P++Z++d+++n+++x%0D%0A
1%3A++++%29++3++%3D++G++Q++%5B++e+++o+++y%0D%0A
2%3A++++%2A++4++%3E++H++R++%5C++f+++p+++z%0D%0A
3%3A+%21++%2B++5++%3F++I++S++%5D++g+++q+++%7B%0D%0A
4%3A+%22++%2C++6++%40++J++T++%5E++h+++r+++%7C%0D%0A
5%3A+%23++-++7++A++K++U++_++i+++s+++%7D%0D%0A
6%3A+%24++.++8++B++L++V++%60++j+++t+++%7E%0D%0A
7%3A+%25++%2F++9++C++M++W++a++k+++u++DEL%0D%0A
8%3A+%26++0++%3A++D++N++X++b++l+++v%0D%0A
9%3A+%C2%B4++1++%3B++E++O++Y++c++m+++w%0D%0A

TABLE: (with SPACE chars stripped)

0%3A        %28 2   %3C F P Z   d n x    %0D%0A
1%3A        %29 3   %3D G Q %5B e o y    %0D%0A
2%3A +      %2A 4   %3E H R %5C f p z    %0D%0A
3%3A %21    %2B 5   %3F I S %5D g q %7B  %0D%0A
4%3A %22    %2C 6   %40 J T %5E h r %7C  %0D%0A
5%3A %23    -   7   A   K U _   i s %7D  %0D%0A
6%3A %24    .   8   B   L V %60 j t %7E  %0D%0A
7%3A %25    %2F 9   C   M W a   k u DEL  %0D%0A
8%3A %26    0   %3A D   N X b   l v      %0D%0A
9%3A %C2%B4 1   %3B E   O Y c   m w      %0D%0A
Encoding of SPACE is + or %20. 
Encoding of ' ? %27 or %C2%B4 ?
The ' char from man ascii was not '! But ´. Interesting.
Encoding of ' is %27.



XML escape characters

There are only five:

"   &quot;  %22
'   &apos;  %27
<   &lt;  %3C
>   &gt; %3E
&   &amp; %26

All 5 special characters must not be escaped in comments or CDATA sections or XML processing instructions.




ASCII table from man ascii linux

  30 40 50 60 70 80 90 100 110 120
 ---------------------------------
0:    (  2  <  F  P  Z  d   n   x
1:    )  3  =  G  Q  [  e   o   y
2:    *  4  >  H  R  \  f   p   z
3: !  +  5  ?  I  S  ]  g   q   {
4: "  ,  6  @  J  T  ^  h   r   |
5: #  -  7  A  K  U  _  i   s   }
6: $  .  8  B  L  V  `  j   t   ~
7: %  /  9  C  M  W  a  k   u  DEL
8: &  0  :  D  N  X  b  l   v
9: ´  1  ;  E  O  Y  c  m   w

Tuesday 14 November 2017

Inscribe square within circle. Geometric construction.

From question on Euclidea geometry app. 

Given: circle C1 and points a1 at centre of circle and a2 on circle.
Construct: square inscribed in C1 with one corner at a2.
Must do it using only 7 elementary moves(i.e. draw circle or line)

Question is answered here:
https://math.stackexchange.com/questions/1587861/inscribing-square-in-circle-in-just-seven-compass-and-straightedge-steps#

I found that inscribing hexagon (and it's 6 equilateral triangles) in the big circle helped me to understand how the construction works. 60 degree and 30 degree and 15 degree angle divisions are key.


F

It is still difficult (for me!) to break it down and prove how it works. Anyway. I have tried. It could perhaps be simplified. Given: circle C1 and points a1 at centre of circle and a2 on circle. Construct: square inscribed in C1 with one corner at a2. 1. Draw circle C2 with centre at a2 and a1 on circle (same radius as C1). Call the points where C1 and C2 intersect p1 and p2. line lengths |a1p1| = |p1a2| = |a1a2| = radius of C1,C2 so little triangles a1a2p1 and a1a2p2 (not shown) are equilateral (60 degree angles) 6 of these triangles could be inscribed into C2 giving a smaller hexagon this smaller hexagon gives us point p3 and proves triangle p1p2p3 is equilateral. 2. Draw big circle C3 with centre p1 and passing through p2. We know Tri p1p2p3 is equilateral, we can also construct equilateral triangle p1p2p8 and construct hexagon p2p3p4p6p7p8 This construction also shows that p8 and p3 where big circle C3 intersects C2 and C1 align (vertical in diagram) with a1 and a2. 3. Draw Line a1p1 extended, this gives us points p5 and b where it intersects C3 We want to construct side of square line p8s1(s1 not marked leftmost point on square) at 15 degrees to p8p1


The squares' sides are at angles of 45 degrees from horizontal. Line p8p1 on equilateral triangle is 60 degrees from horizontal. 15 degrees between them.
     Line a1p1 bisects triangle p1p2p8 (as it does also to triangle p1p4p6 and hexagon) as it is side of little triangle a1a2p1 
     so
     
     Consider Triangle p1p5p8
     We can see
     Lines p1p5 = p1p8 = radius of big circle
     so
    So point s1 is on line p8p5 where it intersects C1 
4. Draw Line p5p8 giving square side s1p8
    
     Line p5b is diameter of circle C3
     Angle Thales' theorem
     This means Line p8b extended to p10 is another side of the square.

5. Draw Line p8b extended to p10 where it intersects C1 giving another side of square p8p10

6. Draw side a2p10

7. Draw side a2s1

That's it.

Interesting to note the angles in the circle segments. And the lengths of the circle segments. Circles C1 (and C2) give a sixth of circumference of circle C3.

Interesting also the angles around point a2 (and around p8):
     
     
      360 - 240 - 90 = 360 - 330 = 30 degrees
      So


Monday 13 November 2017

Special interest badge form template for Scouting Ireland

Special interest form templates 
For Scouting Ireland special interest badges.



EMBED .pdf doc from Google Drive:





Inspiration: 
b&w description and simple template at end. Nice.

colour slides describing special interest:
cub samples/examples:
orienteering samples:

Some ideas for special interest project tasks:
 Prepare and run an activity for your scout troop (or younger section) based on your project.
 Create and try out a game for your scout troop (or younger section) on the theme of your project.
 Create and try out a game which will teach some aspect of your project.
   With activities you bring to your troop REVIEW them and see if they can be made better.

one page desc:

template: colourful, nice BUT used it before and confused scouts topic/project/tasks areas unclear/overlap:
"What is your project? Describe what you want to do and the steps to get there"
"What do you hope to achieve doing this badge? How will you know when you are finished?"
I used as base for attached template .odg/B.pdf
GOOD content (CUBS): https://sites.google.com/site/cubsireland/personal-progression/getting-started


where on uniform and how to sew:


NameSectionFurther reading
Map-makerScoutcraftCartography
PioneeringScoutcraftPioneering
SignallingScoutcraftSignalling
CamperCampingCamping
Camp ChefCampingCamping
Campfire LeaderCampingCampfire
QuartermasterCampingQuartermaster
Camp LeaderCamping
HikerAdventureHiking
Hike LeaderAdventure
Hill WalkerAdventure
OrienteerPhysical AbilityOrienteering
CyclistPhysical AbilityCycling
AthletePhysical AbilityAthletics
SportsPhysical AbilitySport
Self DefencePhysical AbilitySelf Defence
ElectricianElectronics
ElectronicsElectronics
RadioElectronics
Computer ApplicationsElectronics
Computer ProgrammerElectronics
Computer SkillsElectronics
Car MechanicSkills
Home ManagerSkills
Metal WorkerSkills
WoodworkerSkills
WoodcarverSkills
BookbinderCrafts
ArtistCrafts
PrinterCrafts
PhotographerCrafts
BasketryCrafts
LeathercraftCrafts
CollectorCrafts
EquestrianNature
Sea FishingNature
Pet KeeperNature
GardenerNature
AnglerNature
ArchaeologistNatural Sciences
GeologistNatural Sciences
FarmerNatural Sciences
NaturalistFaith and Environment
ObserverFaith and Environment
ForesterFaith and Environment
CivicsFaith and Environment
ScriptureFaith and Environment
FaithFaith and Environment
Bell ringerEntertainment
BuglerEntertainment
MusicianEntertainment
EntertainerEntertainment
Irish DancerEntertainment
Fire SafetyPublic Service
EmergencyPublic Service
GuidePublic Service
InterpreterPublic Service
Life SaverPublic Service
Advanced Life SaverPublic Service
Home MaintenancePublic Service
Public HealthPublic Service
Public SpeakingPublic Service
ConsumerPublic Service
SecretaryPublic Service
LibrarianPublic Service
Social AwarenessSocial awareness
World FriendshipSocial awareness
ConservationSocial awareness
GaeilgeLanguagesGaeilge


Monday 23 October 2017

Bike is ok, shoulder a bit sore. bike crash Mon Oct 23 2017

From: James Coleman [mailto:gaoithe@gmail.com]
Sent: Monday 23 October 2017 10:00
To: Fionnuala; Daire
Subject: [External] Bike is ok, shoulder a bit sore

hi guys, I came off bike. Hit my shoulder. I'm at clonskeagh. Bike is fine(broken brake lever) but something wrong with shoulder. I need to goto doc or vhi clinic I think. Sorry!

Fionn hope thinks ok at work. your phone is at home, if you get a chance send me your work phone num so I have it.

Vhi clinic not great for physio so not sure do I want to go there. Shoulder sore enough now.



On Mon, Oct 23, 2017 at 10:15 AM, . . . .

Daire, - I’m just off the phone to James. He’s came off bike landing on right shoulder and is in at a doctor n Clonskeagh – can’t cycle – he’s just gone in to see doctor – I think he will need to go to Vincents to get it xrayed just in case.



On Mon, Oct 23, 2017 at 3:06 PM, James Coleman wrote:
Thanks Daire,

I am good now.
I am at home, Fionnuala came and got me from hospital.

Hospital was grand. I went to doctor first right there where I crashed at shops in Clonskeagh which was good as she put me straight in for x rays at hospital. Xrays are clear, my diagnosis is soft tissue damage to ac joint, it will take a while to heal (4-6 weeks) mainly needs rest(which I am not good at!!). But I am resting it now well - and got ice - in a sling - my left hand has to learn alot!

After doctor I got painkillers in pharmacy and breakfast in shop and got taxi with bike first to Hollingworths(front brake lever broken from crash) then on to St Vincent's. Busy morning!

Going grand now,

James


When the crash happened another cyclist stopped and helped me get out of road.
Then he also helped me and advised me not to cycle on and ignore the injury, good advice!
His name is Slava. Thanks Slava!! :-D
Immediately after accident I picked up myself and bike and realised, OW, my right arm is quite sore.
After calming down I did throw leg over bike and realised 2 things:
 1. ow right arm is quite sore
 2. right brake lever is completely broken dangling off
So we locked bike and I headed into the Doctor! :)

Now I have met Slava a few times on bike going in & out to work and chat a bit.


https://www.dublininquirer.com/2015/10/20/bicycle-collision-tracker/

bike collision log - mon 23 oict 2017 - clonskeagh
53.30534622767371,-6.236425638198853

cyclist travelling North on Roebuck road in on-road cycle lane.
Traffic backed up and moving slowly, bikes undertaking cars.
Car slow to move off after lights changed, then moving forward and started indicating to turn left (across bike lane to access Bird Ave.)
They could have indicated earlier but they were still well before junction so there was plenty of time to see their intentions.
I was about a car length behind them at this stage and there was a good gap behind them.
I moved out from cycle lane behind car to overtake on their right.
I glanced behind to check road was free and when I looked back car had completely stopped (still back a good bit from from turn in junction). I braked hard, rear wheel slid out to right and I fell on my right side arm outstretched ending up in middle of car lane. Traffic behind stopped (moving slowly so no problem), the car ahead moved off around corner gone. I grabbed bike and got off of road. Another cyclist stopped to check I was ok.

Shoulder AC joint sprained. Bike right brake lever broken bent backwards.

On 27 Oct 2017 18:27, "James Coleman" wrote:

Right arm shoulder AC joint sprained (doctor, hospital, 4-6 weeks recovery). Bike right brake lever broken bent backwards (right handlebar must have hit ground).

Road was wet & slippy but it was good weather at time of accident.





Friday 22 September 2017

Searching for non-printable chars. 'grep -c -P -n "[\x00-\x08\x0E-\x1F\x80-\xFF]" *' also cvs server searching for corrupt files

A cvs rlog (and log) command was failing.
This prevented a jenkins job from starting.

The cvs log failed when it hit a certain file.
$ cvs log dir/dir/file
cvs [server aborted]: unexpected '\x49' reading revision number in RCS file cvsroot/module/dir/dir/file,v
On the cvs server the file had cvs version/log details at start and latest text of file after but a section of binary junk in the middle.

So to check for corruption in other cvs files . . .

https://stackoverflow.com/questions/3001177/how-do-i-grep-for-all-non-ascii-characters-in-unix

Searching for non-ASCII chars just involves eliminating any char > 0x80.
Searching for non-printable chars.is more useful.
Useful grep:

    grep -c -P -n "[\x00-\x08\x0E-\x1F\x80-\xFF]" *

breakdown:

    \x00-\x08 - non-printable control chars 0 - 7 decimal
    \x0E-\x1F - more non-printable control chars 14 - 31 decimal
    \x80-1xFF - non-printable chars > 128 decimal
    -c - print count of matching lines instead of lines
    -P - perl style regexps

Instead of -c you may prefer to use -n (and optionally -b) or -l

    -n, --line-number
    -b, --byte-offset
    -l, --files-with-matches

E.g. practical example of use find to grep all files under current directory:

    find . -type f -exec grep -c -P -n "[\x00-\x08\x0E-\x1F\x80-\xFF]" {} + 

You may wish to adjust the grep at times. e.g. BS(0x08 - backspace) char used in some printable files or to exclude VT(0x0B - vertical tab). The BEL(0x07) and ESC(0x1B) chars can also be deemed printable in some cases.

Non-Printable ASCII Chars
** marks PRINTABLE but CONTROL chars that is useful to exclude sometimes 
Dec   Hex Ctrl Char description           Dec Hex Ctrl Char description 
0     00  ^@  NULL                        16  10  ^P  DATA LINK ESCAPE (DLE)  
1     01  ^A  START OF HEADING (SOH)      17  11  ^Q  DEVICE CONTROL 1 (DC1)
2     02  ^B  START OF TEXT (STX)         18  12  ^R  DEVICE CONTROL 2 (DC2) 
3     03  ^C  END OF TEXT (ETX)           19  13  ^S  DEVICE CONTROL 3 (DC3) 
4     04  ^D  END OF TRANSMISSION (EOT)   20  14  ^T  DEVICE CONTROL 4 (DC4) 
5     05  ^E  END OF QUERY (ENQ)          21  15  ^U  NEGATIVE ACKNOWLEDGEMENT (NAK) 
6     06  ^F  ACKNOWLEDGE (ACK)           22  16  ^V  SYNCHRONIZE (SYN) 
7     07  ^G  BEEP (BEL)                  23  17  ^W  END OF TRANSMISSION BLOCK (ETB)
8     08  ^H  BACKSPACE (BS)**            24  18  ^X  CANCEL (CAN) 
9     09  ^I  HORIZONTAL TAB (HT)**       25  19  ^Y  END OF MEDIUM (EM)
10    0A  ^J  LINE FEED (LF)**            26  1A  ^Z  SUBSTITUTE (SUB)
11    0B  ^K  VERTICAL TAB (VT)**         27  1B  ^[  ESCAPE (ESC)
12    0C  ^L  FF (FORM FEED)**            28  1C  ^\  FILE SEPARATOR (FS) RIGHT ARROW
13    0D  ^M  CR (CARRIAGE RETURN)**      29  1D  ^]  GROUP SEPARATOR (GS) LEFT ARROW
14    0E  ^N  SO (SHIFT OUT)              30  1E  ^^  RECORD SEPARATOR (RS) UP ARROW 
15    0F  ^O  SI (SHIFT IN)               31  1F  ^_  UNIT SEPARATOR (US) DOWN 

There was just one corrupt file on cvs server.
Remove file from local workarea, remove file from cvs, remove Attic file on server, move file back in workarea, cvs add and commit. Log and version history and tags are lost, just have latest version of file.