SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
The Power of scripting
why and how to promote
scripting languages
in schools and small businesses
Marco Fioretti

http://mfioretti.com
http://stop.zona-m.net

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

September 2010, Prishtina
Software Freedom Conference Kosova
Some rights reserved
Author introduction
Marco Fioretti
Member of
OpenDocument Fellowship (www.opendocumentfellowship.com)
Digistan.org (www.digistan.org)

Writer for Linux Journal, Linux Format, Pc Professionale and other
magazines
Author of the Family Guide to Digital Freedom (http://digifreedom.net)
Co-author of the O'Reilly Open Government book

Home page and writings:
http://mfioretti.com
http://stop.zona-m.net

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

2
Agenda
What the command line and scripting
languages really are
Practical examples
Conclusions: why scripting languages are
good for schools and small businesses
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

3
What is a graphical user interface (GUI)?
A GUI is an environment in which the computer
visually tells you what can be done, showing
possible choices in buttons or menus

And the user manually indicates (mouse clicks) what
he or she wants to do. Every time...
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

4
What are shells,command lines, terminals?
A command line is a place, inside a text terminal
window, where the user can write, that is declare in
writing, whatever he or she wants the computer to do
Depending on the context, a shell is either an
environment in which the user can give commands to
the computer, or an interpreter of those commands
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

5
GUI vs Command line: visual comparison
The GUI shows what is the content of a folder:

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

6
GUI vs Command line: visual comparison
A shell tells the user what is the content of a folder

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

7
GUI vs Command line: visual comparison
To move files and folders in GUIs, the user must point to
those objects and to the place where they should go
Select object

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

Drag it to destination

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

8
GUI vs Command line: visual comparison
To move files and folders in the terminal, the user tells the
computer where those objects should go

mv = “move this here”
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

9
GUI vs Command line: what's the difference?
There are many cases where a GUI is much more efficient (e.g.
picture editing, drawings...)
But also many others where the difference between GUI and
command line users is the same that there is between a toddler
pointing at objects and an adult saying “I need to do this”
Ignorance of real speech (GUI) = much more communication
limits, that is much more effort and time wasted to tell the
computer what it must do
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

10
And another HUGE difference is...
The fact that textual commands don't need to be given in real time!
To repeat gestures you must either repeat them or make a movie
To repeat many text commands, you can just type them all, once,
into a file...
...that the computer is able to read by itself!
And all this is much, much, much simpler than real
programming!
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

11
What are scripting languages?
A scripting language is a computer language which has an
interpreter, that is a separate program that:
Reads the commands written into files called scripts, one at a
time
And executes those commands, one at a time
Without asking the user to take care of variable declarations or
typing, memory allocation, compiling code and so on!

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

12
What does a script look like?
Declaration of which
interpreter must be used

comments

Variable
assignments

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

These are the actual commands that
the script will executes for you

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

13
Examples with OpenDocument scripting
The OpenDocument Format (ODF) which is the default format
for OpenOffice...
...is nothing else than ZIP archives containing plain text files and
other objects (e.g. images) in normally standard formats
Therefore, it is very easy to create or analyse office texts,
presentations and spreadsheet automatically...
...using the many FOSS tool created just to process plain text

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

14
Examples (1): Generate OpenDocument invoice
marco => cat my_data.sh
INVOICE_DATE='2010/05/15'
VENDOR_CODE='007'
PO_NUMBER='Purchase Order #1'
TOTAL=10
ISSUE=150
DESCRIPTION='Here is your invoice'

1 ASCII data file

+

35 lines shell script

Result directly
Usable in
OpenOffice!
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

15
Example (2): Spreadsheets with working graphs and formulas

+

Time-of-day
Midnight

•
•
•
•
•

BW 1
4.5
6.3
3.1
1.85

BW2
6.4
6.3
6.1
5.87

Still editable
formulas!!!

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

16
Example (3):Slideshows drafts from plain text outlines

Q: how did I
generate the
first version of
this
slideshow?

A: with the same

trick used in the
spreadsheet
example, same
scripts complexity
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

17
Other things very easy to do with ODF
Format math formulas and exercises created with Mathematica
Generate course DVDs from existing slideshows
Generate printable versions of multiple choice tests created in
Moodle for online teaching
Automatically import content of spreadsheets or texts to databases
Automatically add watermark or caption to each image in many
texts or presentations
Reduce image resolution, to save disk space
replace company logos or other clipart
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

18
Image processing with ImageMagick
The ImageMagick tools (www.imagemagick.org) can be run at the command line or inside a
script to:
Automatically resize all your
pictures
Generate thumbnails for web
publishing
Add captions, frames or
watermarks to them

Example from
www.rubblewebs.co.uk/imagemagic
k/compair.php

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

19
Automatic (collaborative) picture geotagging
Minimap is a
Firefox extension
that lets the user
create lists of
points of interests
and of their
geographical
coordinates

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

20
Automatic (collaborative) picture geotagging (2)
The Minimap user needs to know nothing about geotagging or
geographical coordinates at all
1) click on point of interest in Google Maps
2) give it a name and optional description in
the Minimap pop-up window
3) repeat for as many other points as you
like
3) save all place names and coordinates as
ONE plain text file

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

21
Automatic, collaborative picture geotagging (3)
Coordinates captured with Minimap can then be automatically
inserted inside digital or scanned photographs with the Exiftool
utility

Coordinates!

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

22
Flow for (collaborative) geotagging
Create plain text listing of place names and their coordinates with Minimap:
Cannigione Harbour: Long: 9.01E, Lat 42.03N
Cannigione Church:

Long: 9.04E, Lat 42.06N
...

Create plain text list that associates each picture to a place
picture_1.jpg: Cannigione Harbour
picture_2.jpg: Cannigione Church
picture_3.jpg: Cannigione Harbour
.....

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

23
Flow for (collaborative) geotagging (2)
Run one script that:
Reads the two lists
Associates to each picture its coordinates
Tells the exiftools program to write those
coordinates in the EXIF standard format inside
the corresponding JPG file
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

24
Advantages of collaborative geotagging
Lists of coordinates must be created only once for
each point of interest
It can be made with Minimap, that is extremely easy
to use and multiplatform, just like Firefox
Being plain text files, lists of coordinates by many
different people can be merged without problems
The person that runs the script can be somebody else
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

25
Conclusions: what's the power of scripting?
Computers should save our time, not waste it!
Scripting can save huge amounts of time in all areas of
computer work!
The examples presented are directly relevant and useful in
any school or small business
Scripting automates creation of homework, exercises,
budget reports...

Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

26
Why is scripting so powerful?
Because it is equivalent to moving from sign language to real
language
We have ten fingers to type on 101 buttons, only one hand to
move one mouse: what's more efficient?
Therefore, scripting makes it much easier to quickly explain to
your computer all you want it to do for you
No matter what you do with computers, there surely is
something that can be automated by scripting
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

27
Last but not least...
Even if you're an absolute beginner, there are
thousands of scripting tutorials and practical
examples online
Scripting is multiplatform: while it is already
“built-in” in any Gnu/Linux distribution, the same
scripts can also be run on Windows or Mac systems
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

28
Note for Free/Open Source Software activists
Explaining the power of scripting can also be an
effective way to introduce to FOSS many people
that would be intimidated or bored by other
approaches
Did you notice that in all these slides there is NO
mention of: source code, sw licenses etc...?
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

29
Resources
ODF scripting
http://freesoftware.zona-m.net/odf-scripting

Collaborative geotagging:
www.tuxradar.com/content/geotagging-linux
www.linux.com/archive/feature/147564

Command line recipes
www.commandlinefu.com
Questions?
For more info: marco@digifreedom.net
Marco Fioretti (marco@digifreedom.net)
http://mfioretti.com
http://stop.zona-m.net

August 2010, Prishtina
Software Freedom Conference Kosova
Some Rights Reserved

30

Weitere ähnliche Inhalte

Ähnlich wie The Power of scripting

Fist Global Initiative Presentation
Fist Global Initiative PresentationFist Global Initiative Presentation
Fist Global Initiative Presentation
Shan Kane
 
MozTW SUMO Introduction 2012 Aug
MozTW SUMO Introduction 2012 AugMozTW SUMO Introduction 2012 Aug
MozTW SUMO Introduction 2012 Aug
Ernest Chiang
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash Platform
Peter Elst
 

Ähnlich wie The Power of scripting (20)

The crucial role of file formats in building and preserving Digital Media Cul...
The crucial role of file formats in building and preserving Digital Media Cul...The crucial role of file formats in building and preserving Digital Media Cul...
The crucial role of file formats in building and preserving Digital Media Cul...
 
A New Approach For Slideshow Presentation At Working Meetings
A New Approach For Slideshow Presentation At Working MeetingsA New Approach For Slideshow Presentation At Working Meetings
A New Approach For Slideshow Presentation At Working Meetings
 
BIMserver presentation at Digital Mix, BuildingSMART week Copenhagen
BIMserver presentation at Digital Mix, BuildingSMART week CopenhagenBIMserver presentation at Digital Mix, BuildingSMART week Copenhagen
BIMserver presentation at Digital Mix, BuildingSMART week Copenhagen
 
Fist Global Initiative Presentation
Fist Global Initiative PresentationFist Global Initiative Presentation
Fist Global Initiative Presentation
 
Lotus Symphony has matured quite a bit the past year, but are you taking full...
Lotus Symphony has matured quite a bit the past year, but are you taking full...Lotus Symphony has matured quite a bit the past year, but are you taking full...
Lotus Symphony has matured quite a bit the past year, but are you taking full...
 
Software for creating and displaying multimedia
Software for creating and displaying multimediaSoftware for creating and displaying multimedia
Software for creating and displaying multimedia
 
Percloud in 10_slides
Percloud in 10_slidesPercloud in 10_slides
Percloud in 10_slides
 
Accelerating BIM - CIB W78 Cairo 2010
Accelerating BIM - CIB W78 Cairo 2010Accelerating BIM - CIB W78 Cairo 2010
Accelerating BIM - CIB W78 Cairo 2010
 
OpenDocument Scripting
OpenDocument ScriptingOpenDocument Scripting
OpenDocument Scripting
 
Open Source Software - Arctic Blast Workshop
Open Source Software - Arctic Blast WorkshopOpen Source Software - Arctic Blast Workshop
Open Source Software - Arctic Blast Workshop
 
Translation ; Recent Information about LibreOffice
Translation ; Recent Information about LibreOfficeTranslation ; Recent Information about LibreOffice
Translation ; Recent Information about LibreOffice
 
MozTW SUMO Introduction 2012 Aug
MozTW SUMO Introduction 2012 AugMozTW SUMO Introduction 2012 Aug
MozTW SUMO Introduction 2012 Aug
 
Open file formats favour real innovation and really free markets
Open file formats favour real innovation and really free marketsOpen file formats favour real innovation and really free markets
Open file formats favour real innovation and really free markets
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash Platform
 
Professional Open Source
Professional Open SourceProfessional Open Source
Professional Open Source
 
Goobi
GoobiGoobi
Goobi
 
Multimedia Authoring Tools.ppt
Multimedia Authoring Tools.pptMultimedia Authoring Tools.ppt
Multimedia Authoring Tools.ppt
 
2013 pharo is yours revisited. Santiago DCC University of Chile Presentation.
2013 pharo is yours revisited. Santiago DCC University of Chile Presentation.2013 pharo is yours revisited. Santiago DCC University of Chile Presentation.
2013 pharo is yours revisited. Santiago DCC University of Chile Presentation.
 
Task Management for OpenNTF
Task Management for OpenNTFTask Management for OpenNTF
Task Management for OpenNTF
 
Une décision intelligente dans un environnement hétérogène
Une décision intelligente dans un environnement hétérogèneUne décision intelligente dans un environnement hétérogène
Une décision intelligente dans un environnement hétérogène
 

Mehr von Marco Fioretti

The Digital DIY phenomenon: challenge or opportunity for degrowth?
The Digital DIY phenomenon: challenge or opportunity for degrowth?The Digital DIY phenomenon: challenge or opportunity for degrowth?
The Digital DIY phenomenon: challenge or opportunity for degrowth?
Marco Fioretti
 

Mehr von Marco Fioretti (20)

Personal Clouds to replace corporate-controlled platforms
Personal Clouds to replace corporate-controlled platformsPersonal Clouds to replace corporate-controlled platforms
Personal Clouds to replace corporate-controlled platforms
 
How and Why Open Hardware and Open Source can and should be used in non-weste...
How and Why Open Hardware and Open Source can and should be used in non-weste...How and Why Open Hardware and Open Source can and should be used in non-weste...
How and Why Open Hardware and Open Source can and should be used in non-weste...
 
Open Data: luxury, fashion or REAL need?
Open Data: luxury, fashion or REAL need?Open Data: luxury, fashion or REAL need?
Open Data: luxury, fashion or REAL need?
 
Open Data e Apps4Italy: contesto e suggerimenti d'uso
Open Data e Apps4Italy: contesto e suggerimenti d'usoOpen Data e Apps4Italy: contesto e suggerimenti d'uso
Open Data e Apps4Italy: contesto e suggerimenti d'uso
 
The Catholic Church in the age of Digital Formats
The Catholic Church in the age of Digital FormatsThe Catholic Church in the age of Digital Formats
The Catholic Church in the age of Digital Formats
 
I nuovi media nella Cooperazione Internazionale
I nuovi media nella Cooperazione InternazionaleI nuovi media nella Cooperazione Internazionale
I nuovi media nella Cooperazione Internazionale
 
Digital DIY: social cultural and economic impacts
Digital DIY: social cultural and economic impactsDigital DIY: social cultural and economic impacts
Digital DIY: social cultural and economic impacts
 
Gender differences and barriers in access to Digital DIY, in schools and beyond
Gender differences and barriers in access to Digital DIY, in schools and beyondGender differences and barriers in access to Digital DIY, in schools and beyond
Gender differences and barriers in access to Digital DIY, in schools and beyond
 
How will Digital DIY change society, the economy and lawmaking processes?
How will Digital DIY change society, the economy and lawmaking processes?How will Digital DIY change society, the economy and lawmaking processes?
How will Digital DIY change society, the economy and lawmaking processes?
 
Ethical Challenges in Digital DIY
Ethical Challenges in Digital DIYEthical Challenges in Digital DIY
Ethical Challenges in Digital DIY
 
Globalizzazione dal basso delle reti collaborative: caratteristiche principal...
Globalizzazione dal basso delle reti collaborative: caratteristiche principal...Globalizzazione dal basso delle reti collaborative: caratteristiche principal...
Globalizzazione dal basso delle reti collaborative: caratteristiche principal...
 
Creativity vs Copyright and the Digital World: who will win? Who SHOULD win?
Creativity vs Copyright and the Digital World: who will win? Who SHOULD win?Creativity vs Copyright and the Digital World: who will win? Who SHOULD win?
Creativity vs Copyright and the Digital World: who will win? Who SHOULD win?
 
E-government e Open Data: uno sguardo a benefici e rischi per PA e aziende lo...
E-government e Open Data: uno sguardo a benefici e rischi per PA e aziende lo...E-government e Open Data: uno sguardo a benefici e rischi per PA e aziende lo...
E-government e Open Data: uno sguardo a benefici e rischi per PA e aziende lo...
 
Emerging trends and issues related to Open Data
Emerging trends and issues related to Open DataEmerging trends and issues related to Open Data
Emerging trends and issues related to Open Data
 
Are citizens ready for Open Government?
Are citizens ready for Open Government?Are citizens ready for Open Government?
Are citizens ready for Open Government?
 
Digital Citizenship Basic Education
Digital Citizenship Basic EducationDigital Citizenship Basic Education
Digital Citizenship Basic Education
 
Digital DIY opportunities and challenges for the european society
Digital DIY opportunities and challenges for the european societyDigital DIY opportunities and challenges for the european society
Digital DIY opportunities and challenges for the european society
 
The Digital DIY phenomenon: challenge or opportunity for degrowth?
The Digital DIY phenomenon: challenge or opportunity for degrowth?The Digital DIY phenomenon: challenge or opportunity for degrowth?
The Digital DIY phenomenon: challenge or opportunity for degrowth?
 
Fai-da-te digitale: Barriere legali e normative alla sua diffusione su larga ...
Fai-da-te digitale: Barriere legali e normative alla sua diffusione su larga ...Fai-da-te digitale: Barriere legali e normative alla sua diffusione su larga ...
Fai-da-te digitale: Barriere legali e normative alla sua diffusione su larga ...
 
Digital DIY: it can change society, but how much space is it leaving to women?
Digital DIY: it can change society, but how much space is it leaving to women?Digital DIY: it can change society, but how much space is it leaving to women?
Digital DIY: it can change society, but how much space is it leaving to women?
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

The Power of scripting

  • 1. The Power of scripting why and how to promote scripting languages in schools and small businesses Marco Fioretti http://mfioretti.com http://stop.zona-m.net Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net September 2010, Prishtina Software Freedom Conference Kosova Some rights reserved
  • 2. Author introduction Marco Fioretti Member of OpenDocument Fellowship (www.opendocumentfellowship.com) Digistan.org (www.digistan.org) Writer for Linux Journal, Linux Format, Pc Professionale and other magazines Author of the Family Guide to Digital Freedom (http://digifreedom.net) Co-author of the O'Reilly Open Government book Home page and writings: http://mfioretti.com http://stop.zona-m.net Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 2
  • 3. Agenda What the command line and scripting languages really are Practical examples Conclusions: why scripting languages are good for schools and small businesses Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 3
  • 4. What is a graphical user interface (GUI)? A GUI is an environment in which the computer visually tells you what can be done, showing possible choices in buttons or menus And the user manually indicates (mouse clicks) what he or she wants to do. Every time... Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 4
  • 5. What are shells,command lines, terminals? A command line is a place, inside a text terminal window, where the user can write, that is declare in writing, whatever he or she wants the computer to do Depending on the context, a shell is either an environment in which the user can give commands to the computer, or an interpreter of those commands Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 5
  • 6. GUI vs Command line: visual comparison The GUI shows what is the content of a folder: Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 6
  • 7. GUI vs Command line: visual comparison A shell tells the user what is the content of a folder Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 7
  • 8. GUI vs Command line: visual comparison To move files and folders in GUIs, the user must point to those objects and to the place where they should go Select object Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net Drag it to destination August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 8
  • 9. GUI vs Command line: visual comparison To move files and folders in the terminal, the user tells the computer where those objects should go mv = “move this here” Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 9
  • 10. GUI vs Command line: what's the difference? There are many cases where a GUI is much more efficient (e.g. picture editing, drawings...) But also many others where the difference between GUI and command line users is the same that there is between a toddler pointing at objects and an adult saying “I need to do this” Ignorance of real speech (GUI) = much more communication limits, that is much more effort and time wasted to tell the computer what it must do Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 10
  • 11. And another HUGE difference is... The fact that textual commands don't need to be given in real time! To repeat gestures you must either repeat them or make a movie To repeat many text commands, you can just type them all, once, into a file... ...that the computer is able to read by itself! And all this is much, much, much simpler than real programming! Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 11
  • 12. What are scripting languages? A scripting language is a computer language which has an interpreter, that is a separate program that: Reads the commands written into files called scripts, one at a time And executes those commands, one at a time Without asking the user to take care of variable declarations or typing, memory allocation, compiling code and so on! Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 12
  • 13. What does a script look like? Declaration of which interpreter must be used comments Variable assignments Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net These are the actual commands that the script will executes for you August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 13
  • 14. Examples with OpenDocument scripting The OpenDocument Format (ODF) which is the default format for OpenOffice... ...is nothing else than ZIP archives containing plain text files and other objects (e.g. images) in normally standard formats Therefore, it is very easy to create or analyse office texts, presentations and spreadsheet automatically... ...using the many FOSS tool created just to process plain text Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 14
  • 15. Examples (1): Generate OpenDocument invoice marco => cat my_data.sh INVOICE_DATE='2010/05/15' VENDOR_CODE='007' PO_NUMBER='Purchase Order #1' TOTAL=10 ISSUE=150 DESCRIPTION='Here is your invoice' 1 ASCII data file + 35 lines shell script Result directly Usable in OpenOffice! Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 15
  • 16. Example (2): Spreadsheets with working graphs and formulas + Time-of-day Midnight • • • • • BW 1 4.5 6.3 3.1 1.85 BW2 6.4 6.3 6.1 5.87 Still editable formulas!!! Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 16
  • 17. Example (3):Slideshows drafts from plain text outlines Q: how did I generate the first version of this slideshow? A: with the same trick used in the spreadsheet example, same scripts complexity Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 17
  • 18. Other things very easy to do with ODF Format math formulas and exercises created with Mathematica Generate course DVDs from existing slideshows Generate printable versions of multiple choice tests created in Moodle for online teaching Automatically import content of spreadsheets or texts to databases Automatically add watermark or caption to each image in many texts or presentations Reduce image resolution, to save disk space replace company logos or other clipart Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 18
  • 19. Image processing with ImageMagick The ImageMagick tools (www.imagemagick.org) can be run at the command line or inside a script to: Automatically resize all your pictures Generate thumbnails for web publishing Add captions, frames or watermarks to them Example from www.rubblewebs.co.uk/imagemagic k/compair.php Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 19
  • 20. Automatic (collaborative) picture geotagging Minimap is a Firefox extension that lets the user create lists of points of interests and of their geographical coordinates Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 20
  • 21. Automatic (collaborative) picture geotagging (2) The Minimap user needs to know nothing about geotagging or geographical coordinates at all 1) click on point of interest in Google Maps 2) give it a name and optional description in the Minimap pop-up window 3) repeat for as many other points as you like 3) save all place names and coordinates as ONE plain text file Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 21
  • 22. Automatic, collaborative picture geotagging (3) Coordinates captured with Minimap can then be automatically inserted inside digital or scanned photographs with the Exiftool utility Coordinates! Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 22
  • 23. Flow for (collaborative) geotagging Create plain text listing of place names and their coordinates with Minimap: Cannigione Harbour: Long: 9.01E, Lat 42.03N Cannigione Church: Long: 9.04E, Lat 42.06N ... Create plain text list that associates each picture to a place picture_1.jpg: Cannigione Harbour picture_2.jpg: Cannigione Church picture_3.jpg: Cannigione Harbour ..... Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 23
  • 24. Flow for (collaborative) geotagging (2) Run one script that: Reads the two lists Associates to each picture its coordinates Tells the exiftools program to write those coordinates in the EXIF standard format inside the corresponding JPG file Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 24
  • 25. Advantages of collaborative geotagging Lists of coordinates must be created only once for each point of interest It can be made with Minimap, that is extremely easy to use and multiplatform, just like Firefox Being plain text files, lists of coordinates by many different people can be merged without problems The person that runs the script can be somebody else Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 25
  • 26. Conclusions: what's the power of scripting? Computers should save our time, not waste it! Scripting can save huge amounts of time in all areas of computer work! The examples presented are directly relevant and useful in any school or small business Scripting automates creation of homework, exercises, budget reports... Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 26
  • 27. Why is scripting so powerful? Because it is equivalent to moving from sign language to real language We have ten fingers to type on 101 buttons, only one hand to move one mouse: what's more efficient? Therefore, scripting makes it much easier to quickly explain to your computer all you want it to do for you No matter what you do with computers, there surely is something that can be automated by scripting Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 27
  • 28. Last but not least... Even if you're an absolute beginner, there are thousands of scripting tutorials and practical examples online Scripting is multiplatform: while it is already “built-in” in any Gnu/Linux distribution, the same scripts can also be run on Windows or Mac systems Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 28
  • 29. Note for Free/Open Source Software activists Explaining the power of scripting can also be an effective way to introduce to FOSS many people that would be intimidated or bored by other approaches Did you notice that in all these slides there is NO mention of: source code, sw licenses etc...? Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 29
  • 30. Resources ODF scripting http://freesoftware.zona-m.net/odf-scripting Collaborative geotagging: www.tuxradar.com/content/geotagging-linux www.linux.com/archive/feature/147564 Command line recipes www.commandlinefu.com Questions? For more info: marco@digifreedom.net Marco Fioretti (marco@digifreedom.net) http://mfioretti.com http://stop.zona-m.net August 2010, Prishtina Software Freedom Conference Kosova Some Rights Reserved 30