• Why learn programming?

    • in the future, everything will be run be computers, electronics, and software
    • understanding programming and how programs work will give you the power to build and create the programs of the future
    • it's pretty cool to watch your robot or program do something that would've taken a human hours (if not more) to do
    • here's why others think you should program: http://www.youtube.com/watch?v=nKIu9yen5nc&feature=player_embedded
  • Goals for this Course

    • learn the basics of programming
    • learn how to engineer solutions to problems using programs
    • we will be using the C language to understand core programming concepts
    • learning the basics of the C programming language, you can learn any other program pretty simply
  • Syllabus

  • Terminal Command Line

    Basic Commands:

    • pwd: print working directory

    • cd: change directory

      • the cd command does not generate any output
      • if you print the current directory with pwd, it'll show a change in the working directory if cd was successful
      • example usage:
        • cd ee160_directory

          will change to ee160_directory under current working directory

        • cd ee160_directory/subdirectory

          will change to subdirectory under ee160_directory (with ee160_directory being under the current working directory)

        • cd ~ or cd

          will change to home or user root directory, i.e. highest level acessible from user account

        • cd ..

          will change to parent directory, i.e. up one level

        • cd /

          will change to system root directory, i.e. highest level accessible

      • more info:
    • mkdir: make directory

      • the mkdir command does not generate any output
      • if you list the current directory with ls, it'll show the added directory if mkdir was successful
      • example usage:
        • mkdir ee160_directory

          will make ee160_directory under the current working directory

        • mkdir ee160_directory/subdirectory

          will make subdirectory under ee160_directory (with ee160_directory being under the current working directory)

      • more info:
    • ls: list directory content

      • example usage:
        • ls

          outputs:

          • Gemfile         Gemfile.lock    _config.yml     _includes       _layouts        _posts          _site           css             index.html      js              labs            lectures
        • ls -la

          outputs:

          • total 56
            drwxr-xr-x  16 Gina  staff    544 Aug  2 18:07 .
            drwxr-xr-x   3 Gina  staff    102 Jul 20 13:11 ..
            drwxr-xr-x  13 Gina  staff    442 Aug  3 07:58 .git
            -rw-r--r--   1 Gina  staff      5 Jul 20 19:16 .gitignore
            -rw-r--r--   1 Gina  staff    223 Jul 20 13:05 Gemfile
            -rw-r--r--   1 Gina  staff    992 Jul 20 13:06 Gemfile.lock
            -rw-r--r--   1 Gina  staff     93 Jul 20 19:28 _config.yml
            drwxr-xr-x   3 Gina  staff    102 Aug  2 08:55 _includes
            drwxr-xr-x   3 Gina  staff    102 Jul 20 19:28 _layouts
            drwxr-xr-x   2 Gina  staff     68 Jul 20 13:31 _posts
            drwxr-xr-x   9 Gina  staff    306 Aug  3 15:26 _site
            drwxr-xr-x   4 Gina  staff    136 Aug  3 08:16 css
            -rw-r--r--   1 Gina  staff  11203 Aug  2 18:07 index.html
            drwxr-xr-x   3 Gina  staff    102 Aug  3 08:15 js
            drwxr-xr-x   3 Gina  staff    102 Jul 26 08:55 labs
            drwxr-xr-x  24 Gina  staff    816 Jul 27 00:29 lectures
      • more info:
    • touch: update file timestamp

      • the touch command does not generate any output
      • if you list the directory the file is in with ls, it'll show a new timestamp (the time when the file was touch'd), for all touch'd files
      • we'll use it to create an empty file
      • example usage:
        • touch new_file.c

          will make new_file.c under the current working directory

        • mkdir ee160_directory/new_file.c

          will make new_file.c under ee160_directory (with ee160_directory being under the current working directory)

      • more info:
    • rm: remove file

      • the rm command does not generate any output
      • if you list the directory the file was originally in with ls, it'll no longer show the rm'd file in the directory, if rm was successful
      • example usage:
        • rm file_to_be_deleted.c

          will remove file_to_be_deleted.c from the current working directory

        • rm ee160_directory/file_to_be_deleted.c

          will remove file_to_be_deleted.c under ee160_directory (with ee160_directory being under the current working directory)

        • rm -rd ee160_directory

          will remove all subdirectories and their files under ee160_directory, including ee160_directory (with ee160_directory being under the current working directory)

          r flag is for recursive, e.g. files under subdirectories

          d flag is for directories, i.e. delete directories as well

      • more info:
    • mv: move file

      • the mv command does not generate any output
      • if you list the origin directory with ls, it'll no longer show the mv'd file in the directory, if mv was successful and the file wasn't moved to the same directory
      • example usage:
        • mv file_to_be_moved.c moved_file.c

          will rename file_to_be_moved.c to moved_file.c in current directory

          essentially just renamed the file

        • mv ee160_directory/file_to_be_moved.c ee160_directory/subdirectory/.

          will move file_to_be_moved.c under ee160_directory (with ee160_directory being under the current working directory) to subdirectory (under ee160_directory, which is under current directory)

          the name of the file will be the same because of .

      • more info:

    Extras:

    • help: help

      • example usage:
        • help pwd

          outputs:

          pwd: pwd [-LP]
          Print the current working directory.  With the -P option, pwd prints
          the physical directory, without any symbolic links; the -L option
          makes pwd follow symbolic links.
    • tab: auto-complete

      • pressing tab will show all auto-complete options or will auto-complete if there's only 1 option
      • useful in conjunction with cd to show available directories
    • up: previous command in history

      • pressing up will show last command in history

      • keep pressing up until you find the command in history you want to execute
      • when you've reached the desired command, press enter to execute command
      • pressing down will go in reverse order
      • to start new command, press down until there's no more commands in the command prompt

    More Info:

    • Cloud9 gives you access to an Ubuntu Linux Terminal
    • Dr. Sasaki's Unix Introduction can also be helpful in getting you started
      • Unix is very similar to Linux; read more here and here
      • If you decide to not use Cloud9 and would rather use UH's Wiliki, then Dr. Sasaki's Introduction can help you get set up
  • Assignment

    Homework Assignment 1.1, at the end of this assignment there is nothing to turn in

    Sign up for UH username/email:

    Sign up for Wiliki account:

    • A Wiliki account is needed to access the lab computers so please do this before your first lab session
      • you can get a Wiliki account at Student Services in Holmes Hall 250
      • if your Wiliki account still needs a couple more days to obtain, then ask for a guest Wiliki account to use for the time being

    Sign up for Piazza:

    Sign up for Cloud9 IDE:

    • Sign up for free account at https://c9.io/web/sign-up/free
    • Create a new workspace:
      • Name your workspace with lastname_firstname_uhid (e.g. li_zhao_12345678)
      • Make your workspace private; do not make it Open and Discoverable
      • If you get stuck, follow these instructions
      • Verify the workspace has the following lock icon to ensure the workspace is private:
    • Once inside the newly created private workspace, open a terminal and run wget -O - https://raw.githubusercontent.com/zhaol/ee160_scripts/master/bootstrap.rb | ruby
    • Use the command line commands listed above (Command Line Section), to create the following folder structure and files under ee160/homeworks/01_1:
    • If you have an intermittent internet connection or just don't like using Cloud9, then you can look into setting up an alternate development environment
  • Extra References

    This video walks through how to setup your workspace: How to boostrap your workspace