Wednesday, September 3, 2014

Lesson 1 - Getting to Know the Command Prompt

Computers (and the Internet) have come a long way quickly. The typical desktop machine you are using now is a lot more powerful and a lot cheaper than machines not too long ago.

So what do you do with a computer? What is a program? How do you want to use that computer?

We will first take a good look at the good old command prompt that is extremely useful for programmers. Learning a few basic commands will help you in the long run. Modern computer users are spoiled by the UI.

We will look at a few helpful command prompt commands for file and directory handling. Start->Run->cmd

  • HELP - Provides Help information for Windows commands.
  • DIR - Displays a list of files and subdirectories in a directory.
  • CLS - clears the screen
  • CD (or CHDIR) - Displays the name of or changes the current directory.
  • DEL - Deletes one or more files.
  • RMDIR - Removes a directory.
  • REN - Renames a file or files.
  • SET - Displays, sets, or removes cmd.exe environment variables.
  • ECHO - Displays messages, or turns command echoing on or off.
  • MD (or MKDIR) - Creates a directory.
  • PATH - Displays or sets a search path for executable files.
  • TYPE - Displays the contents of a text file.
  • VER (also WINVER) - Displays the Windows version.
Get to know file extensions, "." and ".."
Just what does "C:" stand for (one previous student of mine guessed 'computer' and that's not right...).

Know how to launch a browser and launch notepad.exe.

Our first program... is a batch file. Save the following as test.bat. This is DOS batch file language... a bit weird and limited.

set /p yourname=What is your name?
echo Hello %yourname%

Unfortunately the command prompt is very limiting and things live inside a prompt... (powershell is a lot more powerful but we won't go there).

Modern versions of Windows have Visual Basic script built in. You can do some basic programming with it. Call it testvbs.vbs

name = InputBox ("What is your name?","hey")
MsgBox "Hi " +name
See glorious details in here and here.

That is just an intro about what kind of programming can you can do out-of-box, without downloading or buying anything. So far it is a bit un-interesting. Visual Basic is easy, but now all has changed with .NET.... and it runs on Windows only.

So in this class we'll program the browser, with the benefit of able to run on various devices, so we need to know how to create an html file.

Get to know the file protocol. file:///

Next we will get to know some HTML...

Tuesday, September 2, 2014

Welcome

Welcome to the Pui Tak Intro to Programming class blog!

In this class you will learn about HTML and javascript, the programming language that is used in everywhere... on desktop computers, smart phones and tablets... basically everywhere you have a web browser you can use HTML and javascript.

You don't need to buy or even install anything. All you need is a plain text editor and a web browser. Notepad for Windows is perfect.

We will start with getting to know about your computer and how then eventually make it do what you want it to do... by writing programs. Your programs can then be uploaded onto your own blog for the world to see.

There are a TON of tutorial materials out there on the web to explore. Basically just about everyone learn programming by looking around tutorials. For HTML and Javascript, I particularly like this one: http://www.w3schools.com.

At the end of the series, I hope to teach some HTML, learn about functions, loops, arrays, etc.

At the end of the 10 lessons, I'll show you how to create a function plotter that may help your Algebra 1 (and 2) class.

f(x) = (For trig functions, use Math.sin, Math.cos, Math.tan)
Your browser does not support the canvas element.