Lesson 1 *Hello, World!

advertisement
Lesson 1
“Hello, World!”
MDST3703 – Studio Track
Alvarado
28 January 2010
Today’s Goals
• Take first steps in acquiring media fluency
– Critical
– Practical
• Begin to acquire basic understanding of a
computer as a symbolic form
– With a history and cultural logic
– With specific representational properties
• Become familiar with writing code
Why program?
“All programming entails world-making, as the
ritual act of writing and running Hello World
reminds us.”
Matt Kirschenbaum, “Hello Worlds”
“Computers should not be black boxes but
rather understood as engines for creating
powerful and persuasive models of the world
around us. … An appreciation of how complex
ideas can be imagined and expressed as a set of
formal procedures — rules, models,
algorithms — in the virtual space of a computer
will be an essential element of a humanities
education.”
What is a computer?
ß
Bush’s Memex
(Is this a computer?)
com⋅put⋅er
/kəm-pyutər/ [kuhm-pyoo-ter]
–noun
1. Also called processor. An electronic device
designed to accept data, perform prescribed
mathematical and logical operations at high
speed, and display the results of these
operations. Compare analog computer, digital
computer.
2. A person who computes; computist.
Origin:
1640–50; compute + -er 1 ; cf. MF computeur
So …
• Computers encode labor
– They have agency in the world via interactivity and
intelligent agents
• Programming is about creating and
controlling this new kind of labor
– It is writing in the imperative mode
Representation
• To perform work, a computer must represent
the world
• But a programmer must first represent that
world for the computer
– Think of examples from Hyperland
• What do we represent?
– Algorithms and data
– This is what we will learn do in this class
Plato’s Cave
The Role of Programming
Programming
Programs and Files
Operating System
Hardware (storage, input, output)
Users interact via input and output devices
Basic Toolkit
• Raw Text editor
– PC: EditPlus OR jEdit
– Mac: TextWrangler
• SSH Client
– PC: PuTTY
– Mac: Terminal
• FTP Client
– PC and Mac: FileZilla
• File compression program
– PC: WinRAR
– Mac: StuffIt
Some Explanation
• Raw text editor – not a word processor
– Basic set of characters understood by the computer
• SSH Client – allows you to perform operations on
the server
– E.g. Create and delete directories (folders)
• FTP Client – allows you to move files between
your computer to the server
– i.e. upload and download
– FTP = File Transfer Protocol
Vocabulary
•
•
•
•
Raw Text
Client and Server
Protocol
Operating System
Testing out your account
• PC users run putty.exe
• Mac users, start Terminal
– If not in toolbar or apps, use Search
• From the command line, enter:
ssh youruserid@studio1.shanti.virginia.edu
• Press “return” and follow the instructions
• Use your blue.unix password
• Let me know if you don’t know it
Exercise 1: Hello World
1. Open up your text editor
jEdit or TextWrangler
2.
3.
4.
5.
Create a new file
Add Code
Save file to the web server
View output on the browser
E1:1 Open text editor and create file
• Download and install your raw text editor
– jEdit is probably the best option
• Double click on the icon
• You should have a blank page to work with
E1:2 Add some code
<?php
echo “Hello, World!”;
?>
Elements of code
<?php
echo “Hello, World!”;
?>
•
•
•
•
Tags – structure your code, like paragraphs
Commands – verbs
Arguments – nouns
Punctuation
E1:3 Save the file
• In TextWrangler
– Choose: File  Save to FTP/SFTP Server
– Enter server info in dialog box and press “Connect”
– Enter file name as index.php, select folder, and
press “Save”
• In jEdit
– Choose: File  Save
– Enter file name (index.php) at bottom
– Then choose: Plugins  FTP  Connect to Secure FTP
Server
– Enter server info and press “OK”, then press “Save”
E1:4 View results on the Web
• Open your browser
– We prefer FireFox, but Internet Explorer or Safari
will do
• Enter this address
– http://studio1.shanti.virginia.edu/~userid
Other stuff
• Variables and arrays
– Numbers and strings
• Operators
– Arithmetic
– Logical
• A little HTML
Resources
• PHP’s Manual
– http://www.php.net/manual/en/
• W3 Schools
– http://www.w3schools.com/
• jEdit User’s Guide
– http://www.jedit.org/users-guide/
Download