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


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.

Tuesday, 25 July 2017

Autogeddon by Heathcote Williams - petrol - ROCK OL


http://dublincycling.ie/cycling/heathcote-williams-author-autogeddon-rip

Extracts from Autogeddon - by Heathcote Williams.
IN 1885 Karl Benz constructed the first automobile.
It had three wheels, like an invalid car,
And ran on alcohol, like many drivers.
Since then about seventeen million people have been killed by them
In an undeclared war;
And the whole of the rest of the world is in danger of being run over
Due to squabbles about their oil.
...

As adults are glutted by mobility,
Children wanting to play on their own doorsteps
Are hemmed in by parental fears,
Or else fatally immobilised.

The heart of the community, the street,
Is daily rent apart -
Conversation numbed
By a nervy descant of toxic shock.

Streets that were open universities,
Are now the open sewers of the car-cult.

...

OIL.
From the Sanskrit root -il, light, illumination,
And petr, Peter, the rock.
Thus, petrol is―remarkably―light from the rock.


...

Traffic control is, for most people,
Their most intimate, and direct,
Experience of government―
As well as being one of its most seminal justifications:
‘Look, you can’t do without some form of organisation,
I mean, take something basic like roads . . .
You couldn’t just have everyone driving on whichever side of the road they pleased.
Things would be chaos.’

...
Heathcote Williams died aged 75 July 2017.



http://www.etymonline.com/index.php?term=olive . . . " from Latin . .  from Greek elaia "olive tree, olive," probably from the same Aegean language (perhaps Cretan) as Armenian ewi "oil." "


The part about Oil is cute but seems to be made up. 
Petr is rock, yes, but -il/light/Sanskrit ? Doesn't seem to be true.

Wow. Sanskrit/Hindi looks like great fun! Hard though.

Let's ask the internet experts:


Koh-i-noor 
from Pers. koh کوه "mountain" نور Noor (light)." famous diamond that became part of the British crown jewels after the annexation of Punjab by Great Britain in 1849, from Persian کوہ نور Kh-i-nr, literally, mountain of light[182][183]