using the computer turning it on – your computers in the lab should be turned on, but if you...
TRANSCRIPT
Using the Computer
Turning it on – Your computers in the lab should be turned on, but if you arrive and the screen is blank, do the following:
Hit the return key to make sure the machine is not in power-saving mode
Ask the lab instructor if the machine is turned off for a reason, like repairs
Make sure it is plugged in. Press power button for the computer – probably in the middle front of
the tower. Press power button for the monitor – probably below the screen.
Turning it off (do one of the following and follow the instructions) Use the START button and select SHUT DOWN. Use ALT-CTRL-DELETE Unplug it
Breaking it You can’t break the machine by typing anything wrong or turning it off
or on. You can break it by forcing floppy discs into the wrong places.
Using the Computer
Turning it off – you shouldn’t have to do turn the machine off during lab unless it stops responding completely. You will want to log off at the end of lab, though. Do one of the following and follow the instructions the machine provides.
Click the START button (lower left corner of screen) and select SHUT DOWN. Then select “shut down”, “restart”, or “log off” from the menu.
Use ALT-CTRL-DELETE then follow directions (particularly if the machine has stopped responding)
Unplug it – last resort, ask lab instructor first. Breaking it
You can’t break the machine by typing anything wrong or turning it off or on.
You can break it by forcing floppy discs into the wrong places.
Using the Computer
Breaking it – its pretty hard to break it. You can’t break the machine by typing anything wrong or turning it off
or on. So don’t worry about experiementing with your programs. A good way to learn things like JavaScript is to say “I wonder what happens when I do THIS.” and then go do it. The worst that can happen is that you have to restart the machine.
Deleting important files. This is possible, but hard to do by accident. You should always keep the lab machines free of your assignments. Bring floppy disks to lab to store your files on, or transfer them to Pegasus and then delete them from the lab machine. When you delete files, the machine will ask you if you are sure you want to do it. Be careful at this point – just verify that only the files you want deleted are selected before you hit the “ok” button.
You can break it by forcing floppy discs into the wrong places.
Using the Computer
Finding Files Use the “Find files” feature if you know the file name.
Click “Start” and then “Find”. A quicker way (usually) is to traverse the directory structure using “My
Computer” icon. Double click on the icon and then maneuver your way around the directory structure with more clicking. For the most part, you will only need to go to the “A:” directory (the floppy disk) and the Desktop.
Editing files The main thing is to remember that your files must be text only. In
other words, using MS Word with the default save settings will not work. My favorite program for editing in a text-only mode is Notepad. It comes standard on MS machines (usually click on Start, then Programs, then Accessories then Notepad).
You may use any other editor you like, but make certain it saves in plain text format.
Some Notes on Programming Languages
Syntax – the mechanical way that programs can be assembled
Programming languages are very specific about syntax This means that putting in a single quote ‘ where a double
quote “ should be can ruin your entire program. Putting a square bracket [ where a parenthesis ( should be can
ruin your entire program. This can be frustrating. Capitalization almost always counts. Be conscious of things
like that. Many things come in pairs (quotation marks, parenthesis for
example). Make sure that things that should be in pairs are. If your program does absolutely nothing, you probably have a
small syntax error. If your program does something, but its wrong, then you
probably have an error in your logic when you designed the program.
Introduction to HTML
HTML = Hypertext Markup Language Language
HTML is A very weak computational language (basically nil).
An interpreted language (interpreted by the browser).
Designed specifically to tell browsers how to display web pages.
Requires a browser for the page to be displayed.
Can only suggest display preferences to the browser (this surprises a lot of people).
Structure of HTML
HTML uses tags to suggest how to display items on a page Learning HTML is really about learning how to use the tags. Makes it easy to do useful pages quickly.
Most tags come in pairs: <tag> starts the action </tag> stops the action Example: <HTML> begins all html documents and </HTML> ends
them Example: <center>Title</center> will center the word “Title” on the
page.
Some tags do not come in pairs: <br> is a line break, causing the display to continue on a new line <hr> inserts a horizontal rule (line) across the page.
Structure of HTML
Anything that is not specified by tags is displayed per the browsers preference
Adding extra spaces in between words won’t have any effect on the page.
Putting things on a new line won’t have any effect on the displayed web page (the <BR> tag does that).
Example: “Hello, World.” and “Hello, World.” will look the same. “Hello, World.” and “Hello,
World.” will both be shown on the same line.
Structure of HTML
There are 4 tags required in any HTML document.
<HTML></HTML> Tells the browser where the web page starts and stops
<HEAD></HEAD> Tells the browser where the informational portion of the web page starts and stops
<BODY></BODY> Tells the browser where the displayed portion of the web page starts and stops
<TITLE></TITLE> Tells the browser what title to display for this page.
Structure of HTML
<HTML>
<HEAD>
<TITLE>Example of HTML structure</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
Information hidden from the viewer.
Visible web page.
“Hello, World!”
There is a particular, simple program called “Hello, World!” that many CS people use when first encountering a new language.
“Hello, World!” prints the words “Hello, World!” on the screen.
The idea is that if you can get this simple thing to work, then- You’ve learned how to write, save, and run the program. The language is working on your computer. Your computer is working as expected.
So “Hello, World!” acts as a simple check that things are working ok before you get involved in a complicated programming effort.
An HTML Example
<HTML>
<HEAD>
<TITLE>Hello, World!</TITLE>
</HEAD>
<BODY>
Hello, World!
</BODY>
</HTML>
<- Begins HTML ->
<- Begins Header portion -> <- Title -> <- Ends Header portion -> <- begin body -> <-Displayed on web page -> <- End body ->
<- End HTML ->
Introduction to JavaScript
JavaScript Was developed to be compatible with web page design, so it runs
inside of web page documents.
That means that JavaScript programs sit inside of HTML documents. It allows computation to be performed within web pages, and uses the web page for input and output.
The <script language=“JavaScript”> and </script> tags define the limits of the JavaScript program inside of the HTML document.
JavaScript is general purpose (fully computational language), but it is limited as to file access for security reasons.
An interpreted language (interpreted by the browser). This makes it a little slow when running, but makes it easy to quickly change your program and see the result.
A JavaScript Example
<HTML>
<HEAD><TITLE>JavaScript Hello,
World!</TITLE></HEAD><BODY><SCRIPT LANGUAGE=“JavaScript”>document.write(“Hello, World!”);</SCRIPT></BODY>
</HTML>
<- Begins HTML ->
<- Begins Header portion -> <- Title -> <- Ends G=Header portion -> <- Begin Body -> <- Begin Script -> <-Displayed on web page -> <- End Script -> <- End body ->
<- End HTML ->
Getting Started with JavaScript
JavaScript requires that you declare every variable you intend to use. Declarations look like this for simple variables:
var x; Var myvariable;
JavaScript uses the following arithmetic operators on integers and numbers:
+ is addition - is subtraction * is multiplication / is division
JavaScript has many special purpose functions built in for your convenience
Output of Results with JavaScript
JavaScript is an Object-Oriented language, which means it treats everything as if it were a physical object.
There are specific built-in objects with specific built-in functions.
The object that deals with input and output is the “document” object. Outputting results with the document object looks like this:
document.write(“Hi.”); -> Displays the word “Hi.” document.write(17); -> Displays the number 17 document.write(x); -> Displays the value of x. document.write(“x”); -> displays the letter “x”.
The Tiny Von Neumann Architecture
000 MEMORY
001
100
002
ADDRESS
The Instruction Cycle:
FETCH: Fetch an instruction from the memory address pointed to by the PC (Program counter), place it in the instruction register (IR) and increment the PC by one.
EXECUTE: The OP tells the computer what is the instruction that must be executed.
NOTE: The PC always points to the instruction that will be fetched. When the program is loaded in memory, the PC points to the first instruction of the program.
Instruction Set Architecture:
LOAD <X>Loads the contents of memory location “X” into AC (AC stand for Accumulator).
ADD <X>The data value stored at address “X” is added to the AC and the result is stored back in the AC.
STORE <X>Store the contents of AC into memory location “X”.
SUB <X>Subtracts the value located at address “X” from the AC and stored the result back in the AC.
IN <Device # >* A value from the input device is transferred into the AC.
OUT <Device #> *
Print out the contents of the AC in the output device.
ENDThe machine stops execution of the program.
JMP <X>Causes an unconditional branch to address “X”.
PC X
SKIPZIf the contents of the Accumulator = 0 the next instruction is skipped.
* Device # Device 5 Keyboard 7 Printer 9 Screen
For instance you can write: 003 IN <5> “23” where “23” is the value you are typing in.
Instruction Set Architecture continued
LOAD 0004
01 LOAD 02 ADD 03 STORE 04 SUB 05 IN 06 OUT 07 END08 JMP 09 SKIPZ Instruction format assuming 6 digits, 2 are used for the op-code and 6 for the address, for example LOAD <0004> will be represented as:
It can be written as “010004” using decimal numbers.
Instruction Set Architecture Codes: