Difference between revisions of "Scripting Languages/Meeting Notes 2018-08-20"

From SOBAC Wiki
Jump to navigation Jump to search
(Prepare for taking meeting notes)
(Add __TOC__)
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{:{{BASEPAGENAME}}}}
+
{{:Scripting Languages}}
 +
 
 +
 
 +
__TOC__
 +
 
  
 
==== Resources ====
 
==== Resources ====
Line 5: Line 9:
 
* [https://www.gnu.org/software/bash/ GNU Bash]
 
* [https://www.gnu.org/software/bash/ GNU Bash]
 
* [https://docs.microsoft.com/en-us/powershell/ PowerShell Documentation]
 
* [https://docs.microsoft.com/en-us/powershell/ PowerShell Documentation]
 +
 +
 +
==== Introductions ====
 +
* Testers, programmers, SysAdmins, and some non-scripting users
 +
  
  
 
==== Meeting Notes ====
 
==== Meeting Notes ====
===== Subtopic =====
+
* Programming vs. Scripting
* Point
+
** "Programs" are compiled, "Scripts" are interpreted
* Point
+
** But mostly there's no differences in syntax
** Sub-Point
+
 
 +
 
 +
* Use a scripting language  to prototype a concept
 +
 
 +
 
 +
* Non-programmers using scripts to do application installation
 +
** Useful for installing applications without a GUI to get that app installed to the GUI level
 +
** eg. [https://mailinabox.email/ Mail-In-A-Box], installed with a script
 +
 
 +
 
 +
* [https://www.vagrantup.com/ Vagrant] written in [https://www.ruby-lang.org/en/ RUBY], but has its own scripting language
 +
 
 +
 
 +
* Lots of variation in scripting language syntax, even within the same language
 +
** "semicolons forever!"
 +
** Brackets, or no brackets
 +
** Is whitespace significant?
 +
** Indenting
 +
* many of these are tradeoffs
 +
** Optimizing for speed, time to program, robustness
 +
 
 +
 
 +
* [https://llvm.org/ LLVM] (originally ''Low Level Virtual Machine'') is used to create programming language
 +
** take input intermediate language, p-code, generates machine language
 +
** Needs research. Bob can't figure out what this does ([[Wikipedia:LLVM]] may be helpful}
 +
** LLVM is embedded in [https://clang.llvm.org/ CLANG], [https://www.rust-lang.org/en-US/ RUST], other scripting languages
 +
**  way to create code generation for your software
 +
 
 +
 
 +
* "If all scripting languages were combined, could we create a universal scripting language?"
 +
** Probably not -- semantic ambiguity, eg. use of semicolons is different in different languages, other syntax doesn't match
 +
 
 +
 
 +
* Using one language is comfortable, so you tend to do everything in that language, appropriate or not
 +
** What is the lifespan of a language?  Depends on the domain -- AWK has been around for 40 years, RUST has not
 +
* How do you keep up with all the new languages?
 +
** Need to decide what to give up
 +
** How much spare time do you have
 +
** How do you know what new tech to embrace
 +
** Depends on the lifespan of the project, don't spend 3 months to learn a language for a 2 month project
 +
 
 +
 
 +
* [http://lambda-the-ultimate.org/ Lambda the ultimate] on programming language design
 +
** There is a formal science to language design
 +
 
 +
 
 +
* Still worth learning [http://www.open-std.org/JTC1/SC22/WG14/www/standards C]?
 +
** Yes, it's still efficient, has installed base, still close to the hardware
 +
** C makes it tolerable to understand what is happening in your computer
 +
** High level languages have many layers of abstraction
 +
** Knowing C leads to understanding
 +
 
 +
 
 +
* "Scripting is a gateway drug to programming"
 +
 
 +
 
 +
* How do we learn scripting?
 +
** Get a raspberry pi
 +
** JavaScript
 +
** You need a project to solve!
 +
** Find something on GitHub
 +
** [https://www.python.org/ Python] is considered the preferred entry-level language
 +
*** [https://www.linuxjournal.com/article/3882 Why Python?] in Linux Journal by Eric S. Raymond
 +
** [http://www.appinventor.org/ App Inventor] allows people with no programming experience to create apps on Android
 +
** [https://scratch.mit.edu/ Scratch] is another drag'n'drop learning app
 +
** Marc taught [https://people.eecs.berkeley.edu/~bh/logo.html Logo] to a kindergarten class
 +
** [https://ccl.northwestern.edu/netlogo/ NetLogo] used for serious science application, complexity science at Santa Fe Institute
 +
** Other applications like [https://www.docker.com/ Docker] are written in [https://golang.org/ GO], so worth learning
 +
 
 +
 
 +
* Is scripting a desirable skill in job applications?
 +
** Python is one of the most requested skills
 +
** But shell scripting is difficult
 +
** For security eg. Wireshark, SNORT, &c need scripting to identify network traffic
 +
 
 +
 
 +
 
 +
 
 +
===== [https://www.lua.org/ LUA] =====
 +
* Kirk wrote in LUA to access the Linux encryption keyring subsystem
 +
** was using [https://www.gnu.org/software/guile/ GUILE] (FSF's [http://www.scheme-reports.org/ SCHEME]), not so good for encryption
 +
** LUA is "Python for millennials"
 +
* Written in ANSI C
 +
* Very embeddable, no linking,
 +
* Comiles to a Virtual Machine
 +
* Two flavours, LUA and LUAJIT (Just-In-Time compiler)
 +
* Seen in XMPP server, used for real-time application
 +
* Came from Brazil, university project, released "into the wild"
 +
* Has facility for OOP, but needs your own OOP tools
 +
* Has co-routines, program in loops that are interruptible; daisychain them together
 +
* Functions are first-class entities, so can do functional programming
 +
* There's a modLUA for Apache server; handle data in blocks without touching the Apache system
 +
** Rather than create a web backend, it lets you create the entire web server
 +
* "Embeddable extension language"
 +
* There's a bootloader LUA for use before the OS loads in SysLinux
 +
* Kirk has used LUA as a conversion layer for allowing Apache to work with encryption sysstyem
 +
* Definitely a good language for testing
 +
* Built into [https://www.wireshark.org/ Wireshark] for decoding packets
 +
* How popular is LUA? People make stuff available on GitHub
 +
* LUA is used in games for event handling
 +
* Many apps have LUA built-in (on the LUA site)
 +
 
 +
===== AWK =====
 +
 
 +
[[Wikipedia:AWK]]
 +
 
 +
* Brian Kernighan still uses AWK,
 +
** Touts the advantages of one-liners, which can't be compiled
 +
** Lecture he gave in the UK, "Successful programming language, why are some more successful than others"
 +
*** Keeps coming back to AWK as a successful language
 +
*** <html5media>https://www.youtube.com/watch?v=Sg4U4r_AgJU</html5media>
 +
*** [https://www.youtube.com/watch?v=Sg4U4r_AgJU How to succeed in language design without really trying.]
 +
 
 +
 
 +
* "If you want to compile AWK, just re-write it in C"
 +
 
 +
 
 +
* Associative arrays in AWK,
 +
** Mainstay of Python
 +
** C only has enumerative arrays, difficult to simulate associative arrays
 +
 
 +
 
 +
* Conrad Grebel prof Dave Huron used AWK to create a catalogue of music for Hewlett-Packard
 +
** [http://www.humdrum.org/ HumDrum Toolkit]" is the app name
 +
** Trying to analyze music, determine patterns among composer
 +
** Find out if people would be happy if music was two tones up or down
 +
** Two minutes of this analysis is equal to a human analysis of years
 +
** Dave Huron one of the first
 +
 
 +
 
 +
* Raymond cleans the data before processing it with AWK
 +
** Uses BASH to insert parameters begore printing.
 +
 
 +
 
 +
* Bob used AWK to parse log files
 +
** Poor programming practices - AWK lends itself to quick&dirty hacks, but the scripts grew; good programming practices at the outset would have been beneficial later
 +
** Much better if data is available though an API, but these scripts were created ''because'' there were no APIs
 +
** Bob implemented a standardized CSV file, but not according to the [https://tools.ietf.org/html/rfc4180 RFC 4180] specification
 +
** Human readable: https://sobac.com/sobac/groupwise/code2html/
 +
** Downloadable: https://sobac.com/bin/awk/
 +
 +
 
 +
===== List of scripting  languages =====
 +
* AWK - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
 +
* BASH - https://www.gnu.org/software/bash/
 +
* CLANG - https://clang.llvm.org/
 +
* JavaScript - https://developer.mozilla.org/en-US/docs/Web/JavaScript
 +
** ECMAScript - http://www.ecma-international.org/memento/tc39.htm
 +
* Logo - https://people.eecs.berkeley.edu/~bh/logo.html
 +
* LUA https://www.lua.org/ wiki, user groups
 +
* Perl - https://www.perl.org/
 +
* PHP - https://secure.php.net/
 +
* Python - https://www.python.org/
 +
* RUBY - https://www.ruby-lang.org/en/
 +
* RUST - https://www.rust-lang.org/en-US/
 +
* TROFF - https://troff.org/
 +
 
 +
===== Other tools =====
 +
* Keystroke  macros
 +
** Record and playback keystrokes
 +
** Bob wants this to be programmable, depending on input processed
 +
** [https://www.autoitscript.com/site/ AutoIT] does this on Windows
 +
** Not many keystroke macro tools in Linux
 +
 
 +
 
 +
* Applications with embedded scripting
 +
** [https://musescore.org/en MuseScore] has  scripting built into it
 +
** [http://lilypond.org/ Lilypond] has SCHEME or GUILE built in
 +
*** Jon Kulp of Arkansas University uses Lilypond and other software with lots of scripting to create course material:  [http://hackerpublicradio.org/eps.php?id=1909 Re-Invigorating the Wheel: Creating an Open, Embedded-Media Music Textbook for the Digital Age]
 +
*** <html5media>http://hackerpublicradio.org/local/hpr1909.ogg</html5media>
  
===== Subtopic =====
+
==== Future Topics ====
* Point
+
* November: [[Tech Wobblies]]
* Point
+
* December: [[Social Night 2018]]
** Sub-Point
+
* January: [[GDPR]]
 +
* February: [[Network Security]]
 +
** Firewall software: pfSense, IPFire, Cisco, Fortinet, Juniper
 +
* March: [[Gaming]]
 +
** What value do games have in the Non-Profit sector?
  
  
Back to: [[{{BASEPAGENAME}}]]
+
Back to: [[Scripting Languages]]
  
 
[[Category:KWNPSA Meeting Notes]]
 
[[Category:KWNPSA Meeting Notes]]

Latest revision as of 03:25, 2 January 2019

Scripting Languages

Date
Monday, 20 August 2018 from 7:00pm to 9:00pm iCal
Meetup Event
https://www.meetup.com/NetSquared-Kitchener-Waterloo/events/253044847/
Location
Room 1301 -- Conrad Grebel University College, 140 Westmount Rd. N., Waterloo, Ontario Map
Event Announcement
Scripting Languages/Announcement 2018-08-20

Do you need to do the same thing again and again? Have you automated those repetitive tasks? What software tools do you use? Keyboard macros? Programmable keyboard macros? A scripting language? Which scripting language? What makes a scripting language different from a programming language? Is a scripting language Turing-complete? Can't you just do everything in PowerShell or Bash?

Let's talk about what can be solved with scripting languages, and what can't. Bring your laptop to give a demonstration of your favourite scripting languages, and maybe we can help solve some of your most annoying repetitive problems.


--Bob Jonkman & Marc Paré




Resources


Introductions

  • Testers, programmers, SysAdmins, and some non-scripting users


Meeting Notes

  • Programming vs. Scripting
    • "Programs" are compiled, "Scripts" are interpreted
    • But mostly there's no differences in syntax


  • Use a scripting language to prototype a concept


  • Non-programmers using scripts to do application installation
    • Useful for installing applications without a GUI to get that app installed to the GUI level
    • eg. Mail-In-A-Box, installed with a script


  • Vagrant written in RUBY, but has its own scripting language


  • Lots of variation in scripting language syntax, even within the same language
    • "semicolons forever!"
    • Brackets, or no brackets
    • Is whitespace significant?
    • Indenting
  • many of these are tradeoffs
    • Optimizing for speed, time to program, robustness


  • LLVM (originally Low Level Virtual Machine) is used to create programming language
    • take input intermediate language, p-code, generates machine language
    • Needs research. Bob can't figure out what this does (Wikipedia:LLVM may be helpful}
    • LLVM is embedded in CLANG, RUST, other scripting languages
    • way to create code generation for your software


  • "If all scripting languages were combined, could we create a universal scripting language?"
    • Probably not -- semantic ambiguity, eg. use of semicolons is different in different languages, other syntax doesn't match


  • Using one language is comfortable, so you tend to do everything in that language, appropriate or not
    • What is the lifespan of a language? Depends on the domain -- AWK has been around for 40 years, RUST has not
  • How do you keep up with all the new languages?
    • Need to decide what to give up
    • How much spare time do you have
    • How do you know what new tech to embrace
    • Depends on the lifespan of the project, don't spend 3 months to learn a language for a 2 month project


  • Lambda the ultimate on programming language design
    • There is a formal science to language design


  • Still worth learning C?
    • Yes, it's still efficient, has installed base, still close to the hardware
    • C makes it tolerable to understand what is happening in your computer
    • High level languages have many layers of abstraction
    • Knowing C leads to understanding


  • "Scripting is a gateway drug to programming"


  • How do we learn scripting?
    • Get a raspberry pi
    • JavaScript
    • You need a project to solve!
    • Find something on GitHub
    • Python is considered the preferred entry-level language
    • App Inventor allows people with no programming experience to create apps on Android
    • Scratch is another drag'n'drop learning app
    • Marc taught Logo to a kindergarten class
    • NetLogo used for serious science application, complexity science at Santa Fe Institute
    • Other applications like Docker are written in GO, so worth learning


  • Is scripting a desirable skill in job applications?
    • Python is one of the most requested skills
    • But shell scripting is difficult
    • For security eg. Wireshark, SNORT, &c need scripting to identify network traffic



LUA
  • Kirk wrote in LUA to access the Linux encryption keyring subsystem
    • was using GUILE (FSF's SCHEME), not so good for encryption
    • LUA is "Python for millennials"
  • Written in ANSI C
  • Very embeddable, no linking,
  • Comiles to a Virtual Machine
  • Two flavours, LUA and LUAJIT (Just-In-Time compiler)
  • Seen in XMPP server, used for real-time application
  • Came from Brazil, university project, released "into the wild"
  • Has facility for OOP, but needs your own OOP tools
  • Has co-routines, program in loops that are interruptible; daisychain them together
  • Functions are first-class entities, so can do functional programming
  • There's a modLUA for Apache server; handle data in blocks without touching the Apache system
    • Rather than create a web backend, it lets you create the entire web server
  • "Embeddable extension language"
  • There's a bootloader LUA for use before the OS loads in SysLinux
  • Kirk has used LUA as a conversion layer for allowing Apache to work with encryption sysstyem
  • Definitely a good language for testing
  • Built into Wireshark for decoding packets
  • How popular is LUA? People make stuff available on GitHub
  • LUA is used in games for event handling
  • Many apps have LUA built-in (on the LUA site)
AWK

Wikipedia:AWK

  • Brian Kernighan still uses AWK,


  • "If you want to compile AWK, just re-write it in C"


  • Associative arrays in AWK,
    • Mainstay of Python
    • C only has enumerative arrays, difficult to simulate associative arrays


  • Conrad Grebel prof Dave Huron used AWK to create a catalogue of music for Hewlett-Packard
    • HumDrum Toolkit" is the app name
    • Trying to analyze music, determine patterns among composer
    • Find out if people would be happy if music was two tones up or down
    • Two minutes of this analysis is equal to a human analysis of years
    • Dave Huron one of the first


  • Raymond cleans the data before processing it with AWK
    • Uses BASH to insert parameters begore printing.


  • Bob used AWK to parse log files
    • Poor programming practices - AWK lends itself to quick&dirty hacks, but the scripts grew; good programming practices at the outset would have been beneficial later
    • Much better if data is available though an API, but these scripts were created because there were no APIs
    • Bob implemented a standardized CSV file, but not according to the RFC 4180 specification
    • Human readable: https://sobac.com/sobac/groupwise/code2html/
    • Downloadable: https://sobac.com/bin/awk/


List of scripting languages
Other tools
  • Keystroke macros
    • Record and playback keystrokes
    • Bob wants this to be programmable, depending on input processed
    • AutoIT does this on Windows
    • Not many keystroke macro tools in Linux


Future Topics


Back to: Scripting Languages