CSCI-1080 Intro To CS: Web DevelopmentSaint Louis University Get familiar with the Linux command lineThis Code Academy Tutorial is a nice and friendly place to start learning the command line. Your first time login on the SLU server (hopper.slu.edu)This short tutorial guides you to change your temporarily password, assigned to you by our Computer Science Department when you enrolled in CSCI-1080. You should have received an email from Dennis Thomas with your credentials: username and temporary password. Please have that email handy before you continue.
ssh your_slu_username@hopper.slu.edu For example, my username is flaviostudent, so I type: ssh flaviostudent@hopper.slu.edu
To use hopper.slu.edu, you now need to repeat the ssh command shown earlier, this time with your new password. Once you are logged in agan, the Linux system that runs on the hopper.slu.edu server, by default, enters into your home directory (a default directory), indicated with the special character ~. You may check the directory that corresponds to this ~ by typing the Linux command pwd as in primary working directory. This will print the name of your current/working directory. You should see something like this: [flaviostudent@hopper ~]$ pwd /student/flaviostudent You may want to use hopper as your hosting server since it is free. Your webpages will be stored but not on the home directory. The files that you want to upload online will be located on your personal directory called www/. This is a special directory that runs the web server program (hopper runs a lot of programs). To change directory in Linux, we need to use the command cd, as in change directory: [flaviostudent@hopper ~]$ cd www [flaviostudent@hopper www]$ {}{} Now your directory has changed; note that the last letters before the cursor show you the last directory. If you type pwd again you should see: [flaviostudent@hopper www]$ pwd /student/flaviostudent/www To go back one directory you need to use cd followed by two dots [flaviostudent@hopper www]$ cd .. [flaviostudent@hopper ~]$ Congratulations! You now know a little bit of Linux, and you are ready to start hacking with your web development project. Other remote clientsYou may use your own computer to access remotely into hopper.slu.edu (in computer science jargon, we say “to ssh” into a remote machine) but you should be aware of some differences. If you use download and use the NoMachine client, you will not be asked to repeat the current password (the machines in the Linux Lab or Ritter 115 will instead ask for the repeat of the temp password). If you use another ssh client (putty or BitVise) you do not have to use the command ssh but you simply have to insert hopper.slu.edu as hostname and your username and temporary password. Then a window should popup asking you to confirm your old password. The port number to insert in putty and bitvise is 22. In a nutshell, the port number is part of the address. A computer is like a condo where all the applications leave in a separate apartment. The street address is hence not enough but the apartment numbrer is needed to reach a specific application running on a server. The command ssh already has embedded the port number. Note also that windows version after Windows 10 (included) you may download and install a Linux client just as the MAC terminal. If you decide to do so, then you may also login on hopper using the terminal. Especially if you are (or you are thinking about) a computer science major or minor, it is a good idea to start getting familiar with Linux commands on your own time. Basic Web Developer SkillsBefore you setup your web development enviroinment, you should learn how to transfer files from and to your web hosting server. You may use either FileZilla (similar programs exist), or just Linux commands. Use Filezilla to connect to Hopper (your SLU web server)You can access to hopper.slu.edu from any location (as long as you have an Internet connection)
Use the Terminal to connect to Hopper (your SLU web server)
Transfer files using Secure Copy
scp hw2/file.html YOUR_SLU_USERNAME@hopper.slu.edu:~/www/hw2/ Dissecting secure copy
With scp you may also copy files from the server to your local computer (for example inside the hw2 directory): scp YOUR_SLU_USERNAME@hopper.slu.edu:~/www/hw2/file.html hw2/ Empty www folder on hopperEven if you have successfully created an account on hopper, please note that if your www directory does not contain any (html) file, you will see a Not found error when you visit your URL http://cs.slu.edu/student/YOUR_SLU_USERNAME/. This is expected, since the web server does not have anything to show you. You will get the same error if you are trying to access to a file that does not exist. Development Enviroinment SetupIn this course you are going to develop HTML, CSS and Javascript. To do so, you need several tools. In this section I am going to discuss the setup of some tools that I strongly recommend for your development enviroinment. Feel free, however, to use any other tool you think are appropriate. These are some tools you may want to use:
Setup your Web Development EditorI am not going to discuss how to install Chrome, a text editor (for example Sublime Text 3) aside from asking you to google, for example “Chrome Download”. I an not going to discuss also how to signup on GitHub.com, however: When you create a GitHub account, please use a username equivalent to your SLU username if available (it will be easier to grade your assignments). Install and Setup git (on your MAC)
git --version You should see the version of the package your just installed, for example Install Browser-sync (on your MAC) (Optional)Browser-sync is an app that allows your browser to refresh automatically anytime you modify the source code of an HTML or a CSS page. To install it, we need to download and install node.js first:
sudo npm install -g browser-sync If during the installation MAC asks you to install the developer tools or other dependencies, you should go ahead and install those too. You can more details check www.browsersync.io for details.
browser-sync --version if the version shows up, then you have browswer-sync installed. Install and Setup git (on your Window)I have used Windows 10 to verify these instructions. If you have problem installing the software with another version of windows please let us know.
“Use Git from the Windows Command Prompt” and click Next > (twice)
git --version You should see the version of the package your just installed, for example Install Browser-sync on your Windows PC (Optional)Browser-sync is an app that allows your browser to refresh automatically anytime you modify the source code of an HTML or a CSS page. To install it, we need to download and install node.js first:
npm install -g browser-sync
browser-sync --version Play with browser-sync (Optional)Let's test browser-sync by creating a folder on your mac: mkdir test
<!DOCTYPE html>
browser-sync start --server --files “*” The star means any file in the current (test) directory. Now Open the index.html page with Chrome and you just see all your edits automatically refreshed in the browser as you type and save new changes. |