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

From SOBAC Wiki
Jump to navigation Jump to search
(Future topics addition)
(Add __TOC__)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{:{{BASEPAGENAME}}}}
+
{{:Scripting Languages}}
 +
 
 +
 
 +
__TOC__
 +
 
  
 
==== Resources ====
 
==== Resources ====
Line 8: Line 12:
  
 
==== Introductions ====
 
==== Introductions ====
* Testers, programmers, SysAdmins, and some non-scripting user
+
* Testers, programmers, SysAdmins, and some non-scripting users
  
  
===== Programming vs. Scripting =====
 
* "Programs" are compiled, "Scripts" are interpreted
 
* BUt mostly there's no differences in syntax
 
* Brian Kernighan still uses AWK,
 
** Touts the advantages of one-liners, which can't be compiled
 
** Lecture he gavbe in the UK, "Successful programming language, why are some more successful than others"
 
*** Keeps coming back to AWK as a successful language
 
  
* "If you want to compile AWK, just re-write it in C"
+
==== 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
 
* Use a scripting language  to prototype a concept
 +
  
 
* Non-programmers using scripts to do application installation
 
* Non-programmers using scripts to do application installation
 
** Useful for installing applications without a GUI to get that app installed to the GUI level
 
** 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
+
** 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
  
* Vagrant written in RUBY, but has its own scripting language
 
  
* Lots of variation in scritping language syntax, even within the same language
+
* Lots of variation in scripting language syntax, even within the same language
 
** "semicolons forever!"
 
** "semicolons forever!"
 
** Brackets, or no brackets
 
** Brackets, or no brackets
 
** Is whitespace significant?
 
** Is whitespace significant?
 
** Indenting
 
** Indenting
 
 
* many of these are tradeoffs  
 
* many of these are tradeoffs  
 
** Optimizing for speed, time to program, robustness  
 
** Optimizing for speed, time to program, robustness  
  
  
 
+
* [https://llvm.org/ LLVM] (originally ''Low Level Virtual Machine'') is used to create programming language
* LLVM (local level virtual machine) is used to create p[rogramming language
 
 
** take input intermediate language, p-code, generates machine language
 
** take input intermediate language, p-code, generates machine language
** Needs research. Bob can't figure out what this does
+
** Needs research. Bob can't figure out what this does ([[Wikipedia:LLVM]] may be helpful}
** LLVM is embedded in CLANG, RUST,  
+
** 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
 
**  way to create code generation for your software
  
  
* if all scripting languages were combide, could we reate a universal scripting language?"
+
* "If all scripting languages were combined, could we create a universal scripting language?"
** Probably not -- semantic ambiguity, eg. use of semicolons is different  
+
** Probably not -- semantic ambiguity, eg. use of semicolons is different in different languages, other syntax doesn't match
  
  
* Using one language is comforatable, so you tend to do everything in that language, appropriate or not
+
* 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 25 years, RUST has 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?
 
* How do you keep up with all the new languages?
 
** Need to decide what to give up
 
** Need to decide what to give up
 
** How much spare time do you have
 
** How much spare time do you have
 
** How do you know what new tech to embrace
 
** How do you know what new tech to embrace
** Depends on the lifespan of the project, don't spend 3 mo to learn a language for a 2 mo bproject
+
** 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
+
* [http://lambda-the-ultimate.org/ Lambda the ultimate] on programming language design
 
** There is a formal science to language design
 
** There is a formal science to language design
  
  
* Still worth learning C?
+
* 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
 
** 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
 
** C makes it tolerable to understand what is happening in your computer
Line 72: Line 73:
  
  
Scripting is a gateway drug to programming
+
* "Scripting is a gateway drug to programming"
  
  
How do we learn scripting?
+
* How do we learn scripting?
* Get a raspberry pi
+
** Get a raspberry pi
* JavaScript
+
** JavaScript
* YOu need a project to solve!  
+
** You need a project to solve!  
* Find something on GitHub
+
** Find something on GitHub
* Python is considered the preferred entry-level language
+
** [https://www.python.org/ Python] is considered the preferred entry-level language
* "app inventor" allows people with no programming experience ot create aps on android.
+
*** [https://www.linuxjournal.com/article/3882 Why Python?] in Linux Journal by Eric S. Raymond
* "Scratch" is another drag'n'drop learning app
+
** [http://www.appinventor.org/ App Inventor] allows people with no programming experience to create apps on Android
* Marc taught Logo to a kindergarten class
+
** [https://scratch.mit.edu/ Scratch] is another drag'n'drop learning app
** NetLogo used for serious science application, complexity science, Santa Fe Institute
+
** 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
  
  
  
  
** Other applications like Docker are written in GO, so worth learning
+
===== [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"
===== LUA =====
+
* Written in ANSI C
* LUA: Access to the Linux encryption keyring subsystem
+
* Very embeddable, no linking,  
** Using GUILE (FSF's SCHEME), not so good for encryption
 
** "Python for millennials"
 
** Written in ANSI C
 
** Very embeddable, no linking,  
 
 
* Comiles to a Virtual Machine
 
* Comiles to a Virtual Machine
 
* Two flavours, LUA and LUAJIT (Just-In-Time compiler)
 
* Two flavours, LUA and LUAJIT (Just-In-Time compiler)
 
* Seen in XMPP server, used for real-time application
 
* Seen in XMPP server, used for real-time application
* Came from Brazil, unverisity project, released "into the wild"
+
* Came from Brazil, university project, released "into the wild"
 
* Has facility for OOP, but needs your own OOP tools
 
* Has facility for OOP, but needs your own OOP tools
* Has co-routines, program in loops that are interruptable; daisychain them together
+
* Has co-routines, program in loops that are interruptible; daisychain them together
 
* Functions are first-class entities, so can do functional programming
 
* Functions are first-class entities, so can do functional programming
* Used in games, htere's a modLUA for APache; handle data in blocks without touching the Apache system
+
* 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
 
** Rather than create a web backend, it lets you create the entire web server
 
* "Embeddable extension language"
 
* "Embeddable extension language"
 
* There's a bootloader LUA for use before the OS loads in SysLinux
 
* There's a bootloader LUA for use before the OS loads in SysLinux
* Kirk has used LUA and an conversion layer for allowing Apache to work with encryption sysstyem
+
* Kirk has used LUA as a conversion layer for allowing Apache to work with encryption sysstyem
 
* Definitely a good language for testing
 
* Definitely a good language for testing
* Bulit into Wireshark for decoding packets
+
* Built into [https://www.wireshark.org/ Wireshark] for decoding packets
 
* How popular is LUA? People make stuff available on GitHub
 
* 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)
  
* LUA is used in games for event handling
+
===== 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.]
  
* Many apps have LUA built-in (on the LUA site)
 
  
* Is scripting a desirable skillin job applications?
+
* "If you want to compile AWK, just re-write it in C"
** Python I sone of the most requested skills
 
** But shell scripting is difficult, and
 
** For security eg. Wireshark, SNORT, and others need scripting to identify network traffic
 
  
  
Line 132: Line 142:
  
  
 
 
===== AWK =====
 
 
* Conrad Grebel prof Dave Huron used AWK to create a catalogue of music for Hewlett-Packard
 
* Conrad Grebel prof Dave Huron used AWK to create a catalogue of music for Hewlett-Packard
** "HumDrum Toolkit" may be the app name
+
** [http://www.humdrum.org/ HumDrum Toolkit]" is the app name
 
** Trying to analyze music, determine patterns among composer
 
** Trying to analyze music, determine patterns among composer
 
** Find out if people would be happy if music was two tones up or down
 
** Find out if people would be happy if music was two tones up or down
Line 148: Line 155:
  
 
* Bob used AWK to parse log files
 
* Bob used AWK to parse log files
** Poor programming practices
+
** 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
** Standardized CSV files
+
** Much better if data is available though an API, but these scripts were created ''because'' there were no APIs
** https://sobac.com/sobac/groupwise/code2html/
+
** Bob implemented a standardized CSV file, but not according to the [https://tools.ietf.org/html/rfc4180 RFC 4180] specification
** https://sobac.com/bin/awk/
+
** Human readable: https://sobac.com/sobac/groupwise/code2html/
 
+
** Downloadable: https://sobac.com/bin/awk/
 
 
* Much better if data is available though an API, but these scripts were created because there were no APIs
 
 
 
 
 
 
 
 
   
 
   
  
==== List of scripting  languages =====
+
===== List of scripting  languages =====
* AWK
+
* AWK - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
* Perl
+
* BASH - https://www.gnu.org/software/bash/
* Python
+
* CLANG - https://clang.llvm.org/
* BASH
+
* JavaScript - https://developer.mozilla.org/en-US/docs/Web/JavaScript
* PHP
+
** ECMAScript - http://www.ecma-international.org/memento/tc39.htm
* JavaScript (ECMAScript)
+
* Logo - https://people.eecs.berkeley.edu/~bh/logo.html
* TROFF
+
* LUA https://www.lua.org/ wiki, user groups
* LUA 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 ====
+
===== Other tools =====
 
* Keystroke  macros
 
* Keystroke  macros
 
** Record and playback keystrokes
 
** Record and playback keystrokes
 
** Bob wants this to be programmable, depending on input processed
 
** Bob wants this to be programmable, depending on input processed
** AutoIT does this on Windows
+
** [https://www.autoitscript.com/site/ AutoIT] does this on Windows
* NOt many tools in Linux
+
** Not many keystroke macro tools in Linux
 
 
  
** Muscore has LUA scripting built into it
 
*** Lilypond has SCHEME or GUILE built in
 
*** Jon Kulp of Arkansas Uni uses Lilypond (provide links)\
 
  
 +
* 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>
  
==== Future TOpics ====
+
==== Future Topics ====
 
* November: [[Tech Wobblies]]
 
* November: [[Tech Wobblies]]
* December: [[SOcial Night]]
+
* December: [[Social Night 2018]]
 
* January: [[GDPR]]
 
* January: [[GDPR]]
 
* February: [[Network Security]]
 
* February: [[Network Security]]
Line 193: Line 201:
  
  
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