Thursday, September 10, 2015

Algol68 code samples, view on-line...

View... and then run on-line...

Maybe you want to hack your first "Hello, world!" program and run it on-line right NOW:
To see how easy Concurrent computing is, paste this specimen:
  PAR(
    print("Enjoy "),
    print("Rosetta "),
    print("Code ")
  )

See also: Have you ever wanted to test drive Algol68?... are ANY of the rumours true?

The Algol68 code specimen samples:

9

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

Y

Z

Wednesday, September 9, 2015

Facebook hates Pythagoras: a²+b²=c²

And Wikipedia love/hates "a2+b2=c2" even more! = ☹

Are you a FaceBook user? And have you EVER tried to cut-and-past the Pythagorean-theorem of "a²+b²=c²?" [ I do it EVERY day :-^) ] ... But found your resulting paste gives the grotesque result of "a2+b2=c2?" ...

Now try to cut-and-paste this Facebook/Wikipedia version: "a2+b2=c2?"

Don't believe me? ... then try to cut and paste from either: Facebook: Pythagorean-theorem or Wikipedia: Pythagorean-theorem - Proof by rearrangement.

¢ Kind of typical of the 21ˢᵗ century... after 2½ thousand years of civilisation one cannot simply cut and paste Pythagoras's theorem of a²+b²=c² from wikipedia and share it with a friend on FaceBook! ☹ ¢

Fortunately WolframAlpha has no such problem, eg. click on: a²+b²=c²

Here is a useful table you from where you CAN cut-and-paste ˢᵘᵖᵉʳˢᶜʳᶦᵖᵗˢ and ₛᵤbₛcᵣᵢₚₜ... ¢ oops... Note the b & c, maybe we need to wait until the 22ⁿᵈ century for the entire alphabet to be in all browsers? ¢

Superscript and subscripts cut-and-paste
  0 1 2 3 4 5 6 7 8 9 A B C D E F
U+00Bx                          
U+207x x⁰ xⁱ     x⁴ x⁵ x⁶ x⁷ x⁸ x⁹ x⁺ x⁻ x⁼ x⁽ x⁾ xⁿ
U+208x x₀ x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₊ x₋ x₌ x₍ x₎  
U+209x xₐ xₑ xₒ xₓ xₔ xₕ xₖ xₗ xₘ xₙ xₚ xₛ xₜ      

Ironically Wikipedia does detail how to achieve the alphabet in either ₛᵤbₛcᵣᵢₚₜ and ˢᵘᵖᵉʳˢᶜʳᶦᵖᵗˢ... Wikipedia: Unicode subscripts and superscripts.

But you can simply use this page: piliapp.com to: c̶r̶o̶s̶s̶ ̶o̶u̶t̶ ̶m̶i̶s̶t̶a̶k̶e̶s̶ or u͟n͟d͟e͟r͟l͟i͟n͟e͟ ͟i͟m͟p͟o͟r͟t͟a͟n͟t͟ ͟s͟t͟u͟f͟f AND THEN cut and paste it to share on FaceBook. Or use tiny-text to generate ˢᵘᵖᵉʳˢᶜʳᶦᵖᵗˢ.

And for even more find try: ₛᵤbₛcᵣᵢₚₜ @ panix.com

For the technically minded, here is a table of as many of the SI units that I could find, all ready for your cut-and-paste. ¢ Enjoy ¢

Wikipedia: SI Base Units

Named base SI base units.
Name Symbol Unicode Codepoint Quantity Typical Symbol for Variables
metre m

length l (lowercase L)
kilogram kg U+338F mass m
second s

time t
ampere A

electric current I (capital i)
kelvin K

thermodynamic temperature T
candela cd U+33C5 luminous intensity Iv (capital i with lowercase non-italicized v subscript)
mole mol U+33D6 amount of substance n

Wikipedia: Derived Units

Named units derived from SI base units

Symbol Unicode Expression in terms of other units Expression in terms of SI base units Quantity
hertz Hz ¹⁄s s⁻¹ frequency
radian rad m⁄m dimensionless angle
steradian sr ㎡⁄㎡ dimensionless solid angle
newton N
㎏⋅m⁄s² or ㎏⋅㎨ force, weight
pascal Pa N⁄㎡ ㎏⁄m⁄s² pressure, stress
joule J
N⋅m = C⋅V = W⋅s ㎏⋅㎡⁄s² energy, work, heat
watt W
J⁄s = V⋅A ㎏⋅㎡⁄s³ power, radiant flux
coulomb C
s⋅A s⋅A electric charge or quantity of electricity
volt V
W⁄A = J⁄C ㎏⋅㎡⁄s³⁄A voltage, electrical potential difference, electromotive force
farad F
C⁄V s⁴⋅A²⁄㎏⁄㎡ electric capacitance
ohm Ω
V⁄A ㎏⋅㎡⁄s³⁄A² electric resistance, impedance, reactance
siemens S
℧ = A⁄V s³⋅A²⁄㎏⁄㎡ electrical conductance
weber Wb J⁄A ㎏⋅㎡⁄s²⁄A magnetic flux
tesla T
V⋅s⁄㎡ = ㏝⁄㎡ = N⁄A⁄m ㎏⁄s²⁄A
magnetic field strength, magnetic flux density
henry H
V⋅s⁄A = ㏝⁄A ㎏⋅㎡⁄s²⁄A² inductance
deg Celsius °C K K temperature relative to 273.15 K
lumen lm ㏅⋅㏛ luminous flux
lux lx ㏐⁄㎡ ㏅⁄㎡ illuminance
becquerel Bq ¹⁄s s⁻¹ radioactivity (decays per unit time)
gray Gy J⁄㎏ ㎡⁄s² absorbed dose (of ionizing radiation)
sievert Sv J⁄㎏ ㎡⁄s² equivalent dose (of ionizing radiation)
katal kat
㏖⁄s ㏖⁄s catalytic activity

Wikipedia: The Metric Prefix

Unicode characters of SI derived units and other related non SI units.
Scale femto pico nano micro milli centi deci
hecto kilo Mega Giga Tera Other
Dimensionless

, ㏙, ㏗
Distance



㎞, ㏎
㍳, ㍶, ㏕, ㏌
Area


Volume
㎣, ㎖ ㎤,㏄ ㍹, ㎗ ㎥, ℓ
㎦, ㎘
Mass





㍲, ㍺, 🝲, 🝳, ℥
Pressure


, ㍴
Time

㏂, ㏘, 🝮, 🝱
Frequency


Potential





㍵, ㏞, ㋎
Current





Impedance related





Power





㏋, ㏈
Heat and Energy


, ℉, ㋍
Speed, acceleration and miscellaneous ㎧, ㎨, ㏏,㏚, ㏍
Radio Activity and light , , , , , ㎮, ㎯, , , , ㏆
Note: Struck through units are Unicode SI units already appearing in the first two tables.

Monday, August 10, 2015

Regarding the Colour of the New Zealand Flag...

(Alternative title: The ex-Empiree's New Clothes) #nzflag

Ironically the post WWII British Gov was only too happy (and in a big rush) to "grant" all "their" colonies "independence" cf. http://www.vice.com/en_uk/read/the-uk-government-are-opening-thousands-of-secret-files-to-the-public...

To achieve this the British Gov even had a special mobile hit squad of diplomats to speed up the "transition" and the British exit. Did you ever notice that when the "sun set" on the British Empire, it set WITHOUT the British Marines EVER loosing a single battle? Figure that one out! How is that a retreat?

It all culminated around 1970 when NZ (and others) became victim of combined effect of the Secret UK/US "Atlantic Charter" AND the UK/US manipulation of the Goldstandard... the net effect was the virtual crash of the NZ economy...

Meantime my grandparents quietly had their Irish/Scottish rights of descent "squished" by over eager "ex-colonies" asserting their newly found "sovereignty".

[ The ex-colonies "officials" were (in most cases) re-engineering the British "empire's" original bureaucracy to suit the pro-independence family dynasties that emerged ]

The end of the "British Empire", meant the end of the common currency, the end of border-less global travel, the imposition of ID numbers/travel-documents, the end of free trade, the increase in the ACTUAL income tax rate, and economies becoming centric on super-cities.

[ Ironically the common currency with free internal trade & travel of the US, EU & China (and even Australia) is what powers these economies. ]

If the ex-British colonies were truly smart, then they would have evicted England from the Empire and but kept the Empire. We then would have been had a chance to stand up against the emerging economic super powers and been be in a much better position to augment (and develop) the more vulnerable smaller economies.

So... just maybe... the colour of the flag is not the issue? Maybe the flag's colour is just another cleverly engineered distraction. Maybe the real question is... Who engineered this distraction? (And why?)

Wednesday, May 27, 2015

The meaning of adb

From: Drew Sullivan 
Newsgroups: comp.unix.misc
"If you are going to get your history correct, then you have to know why Bourne was at Bell Labs. He was trying to build an algol-68 compiler. The project didn't complete in the sence that there is no algol compiler but the tools that he built live on. That is why the Bourne shell has case ... esac, if ... fi, do ... done, These are all from algol-68."
Lastly the the adb was the algol debuger.  The 'a' is for algol!!!! 
I extract the following screen shot from:  Bryan Cantrill's - The Observation Deck
"Views on software from Bryan Cantrill's deck chair"
* https://blogs.oracle.com/bmc/entry/unix_circa_1984 
 
Basically the "adb" command has built into it the command "$a" for debugging Algol68 stack structures and scopes.

c.f. "abd manual page extract" & "Algol68C and Unix"
After Cambridge, Bourne spent nine years at Bell Labs with the Seventh Edition Unix team. As well as developing the Bourne shell, he ported ALGOL 68C to Unix on the DEC PDP-11-45 and included a special option in his Unix debugger "adb" to obtain a stack backtrace for programs written in ALGOL68C. Here is an extract from the Unix 7th edition adb manual pages:
NAME
      adb - debugger
SYNOPSIS
      adb [-w] [ objfil [ corfil ] ]
[...]
COMMANDS
[...]
       $modifier
             Miscellaneous  commands.   The  available modifiers
             are:
             [...]
             a      ALGOL 68 stack  backtrace.   If  address  is
                    given  then it is taken to be the address of
                    the current frame (instead of r4).  If count
                    is  given  then  only the first count frames
                    are printed.
 

Friday, January 30, 2015

Dual booting Centos: /boot/boot/grub.conf kernel root=/dev/sda0 VS root=UUID=X-X-X-X-X VS root=/dev/mapper/luks-X-X-X-X-X

I'm adding this to my blog because I'm not sure where else to post technote ...

From: kernel-2.6.32-504.3.1 To kernel-2.6.32-504.3.3

The nearest I report I found to my problem was:
[SOLVED] LVM on Luks cannot find device

I dual boot linux/Centos.  x86_64 on one partition, and i686
Basically back in Dec 2014 I upgraded my kernel on one of my partition

However "something" then cleaned up all my  "x86_64" kernels and modules...
It was manifested with the message "cannot load module.dep"

FATAL: Could not load /lib/modules/2.6.32.431.23.3.el6.x86_64/modules: No such file or directory.

The fix is to reinstall the missing kernel... IF you can boot.

This is made a little tricky when one partition is strictly i686 and the other is x86_64... I ended up booting into single user, doing a rpm install --ignorearch on i686, then manually mounting the x86_64 copying all the x86_64 kernel files (rpm -ql kernel)  from the i686 partition...

Interestingly this whole process is a bit of a time bomb, because the problem only manifested itself 6 weeks after previous kernel upgrade.  So I am not sure what "update" cleaning out all the previous kernel and modules...

Alternatively you may be abel to an easier solution by running the "recovery shell" or booting from a recovery disk/USBDrive.

Goodluck
N

ps.  If you know what is "cleaning up" the old kernels (esp. kernels on that partitions RPM database, then let me know)  Cheers.








Saturday, December 27, 2014

A bit of fun with Jabberwocky, classes, mixins, python and method resolution order (MRO)

I was trying to figure out and demonstrate python's Member Resolution Order... In particular, pay attention to the output from __str__...

#!/usr/bin/env python
# -*- coding: utf-8 -*-

class BeastBase(dict):
  def __init__(self, **characteristics):
    super(BeastBase, self).__init__(**characteristics)

  def __str__(self):
    return "; ".join(["%s=%r"%item for item in super(BeastBase, self).iteritems()])

class Mixin(object): pass

class BitingMixin(Mixin):
  def __init__(self, jaws=2, teeth_per_mouth=32, **characteristics):
    self.jaws=jaws
    self.teeth_per_mouth=teeth_per_mouth
    super(BitingMixin, self).__init__(**characteristics)

  def bite(self):
    print "Bite: jaws=%s, teeth=%s"%(self.jaws, self.teeth_per_mouth*self.jaws/2)

  def __str__(self):
    return "Jawed: %s; %s"%(self.jaws, super(BitingMixin, self).__str__())

class JawedBeast(BeastBase, BitingMixin): pass

class ClawingMixin(Mixin):
  def __init__(self, feet=4, toes_per_foot=3, **characteristics):
    self.feet=feet
    self.toes_per_foot=toes_per_foot
    super(ClawingMixin, self).__init__(**characteristics)

  def catch(self):
    print "Catch: feet=%s, toes=%s"%(self.feet, self.toes_per_foot*self.feet)

  def __str__(self):
    return "Claws: %s; %s"%(self.toes_per_foot*self.feet, super(ClawingMixin, self).__str__())

class ClawedBeast(BeastBase, ClawingMixin): pass

class FlamingMixin(Mixin):
  def __init__(self, eyes=6, flames_per_eye=1, **characteristics):
    self.eyes=eyes
    self.flames_per_eye=flames_per_eye
    super(FlamingMixin, self).__init__(**characteristics)

  def flame(self):
    print "Flames:", self.eyes*self.flames_per_eye

  def __str__(self):
    return "Eyes: %s, Flames: %s; %s"%(self.eyes, self.eyes*self.flames_per_eye, super(FlamingMixin, self).__str__())

class FlamedBeast(FlamingMixin, BeastBase): pass

class WhifflingMixin(Mixin):
  def whiffle(self): print "Whiffle...."
  def __str__(self): return "Whiffling... "+super(WhifflingMixin, self).__str__()

class WhifflingBeast(WhifflingMixin, BeastBase): pass

class BurblingMixin(Mixin):
  def burble(self): print "Burble...."
  def __str__(self): return "Burbling... "+super(BurblingMixin, self).__str__()

class BurblingBeast(BurblingMixin, BeastBase): pass

class Jabberwocky(BitingMixin, ClawingMixin, FlamingMixin, WhifflingMixin, BurblingMixin, BeastBase):
  def __init__(self, **characteristics):
    super(Jabberwocky, self).__init__(**characteristics)

  def __str__(self):
    return "JabberWocky: "+super(Jabberwocky, self).__str__()+" ... Beware! "

if __name__ == "__main__":

# Beware the Jabberwock, my son!
  jabberwocky1=Jabberwocky(personality="Friendly", consideration="Temperamental", eyes=5, flames_per_eye=3)
  print jabberwocky1

# Beware the Jubjub bird, and shun
# The frumious Bandersnatch!

# The jaws that bite, the claws that catch!
  jabberwocky1.bite()
  jabberwocky1.catch()

# And as in uffish thought he stood,
# The Jabberwock, with eyes of flame,
  jabberwocky1.flame()

# Came whiffling through the tulgey wood,
  jabberwocky1.whiffle()
# And burbled as it came!
  jabberwocky1.burble()  

Output:
JabberWocky: Jawed: 2; Claws: 12; Eyes: 5, Flames: 15; Whiffling... Burbling... consideration='Temperamental'; personality='Friendly' ... Beware!
Bite: jaws=2, teeth=32
Catch: feet=4, toes=12
Flames: 15
Whiffle....
Burble....