Programming problems, done within a repo so we can all see each other's code and the teacher can grade your results.
The 'users' folder contains one folder per student. Within each student folder we store:
- Source code files like 'Arrays.js' and other files we use t osolve weekly classes.
- Jupyter JavaScript notebooks assigned by the instructor.
The 'users/Answer' folder will be updated with the problems and one possible answer after class, for those who missed it.
- Install Git from https://git-scm.com/download/win (for Windows), or https://git-scm.com/download for other operating systems.
- Install Node.js from https://nodejs.org (click the Current button to get the latest).
- Install Visual Studio Code from https://www.visualstudio.com/products/code-vs
- Install Anaconda from https://www.continuum.io/downloads - choose the Windows 64-bit installer
- Open a Windows console: Windows+R (to open the Run box), then type
cmd
and press Enter. - Create a new folder:
mkdir c:\Prog
- Move to that folder:
cd c:\Prog
- Clone the Git repo to your new folder:
git clone https://github.com/6KidsGames/Prog .
When you're developing code with a team, you're going to need to get their code as well as upload your code. A good time to do this is at the start of each day, unless you're in the middle of something.
- (If you don't already have a console open) Open a Windows console: Windows+R (to open the Run box), then type
cmd
and press Enter. - Change location to that folder:
cd c:\Prog
- Create some useful console shortcuts:
init
- See if you have any files changed locally, and if you're in a working branch:
stat
- If you are not on the
master
branch, rungit checkout master
- If "package.json" is listed in red, run
git checkout -- package.json
- If you have other files changed, get it committed and
git checkout master
, or talk to the teacher. - Pull down the latest code:
pull
- Run Setup.cmd (which installs the latest packages from the Internet) by entering:
Setup
When we are using Jupyter notebooks, you need to run the Jupyter server, which uses Node.js. To run Jupyter we have a script command that you run from within your c:\Prog folder:
jupyter
We also create our own JavaScript code using Visual Studio Code, and run it with node.js.
To edit your code:
- Change to your user directory:
cd c:\Prog\users\<your-user-name>
(Obviously, replace with the folder name for yourself.) - Run Visual Studio Code in that directory:
code .
- If you need to create a new JavaScript program file, use the File menu's New command, then save the resulting file with a new filename as directed during class. Use the ".js" extension which is the extension for JavaScript.
To run your code:
- Alt+Tab back to the cmd console window
- Use NodeJS to run your code:
node myfile.js
For example:node Arrays.js
Unlike our other code projects like ZombAttack, all users in class can push to the cloud. So all you need to do is to check in your changes to master, then push to the cloud, and pull back again to get the latest code.
You can do this quickly using the helper script in c:\Prog: PushMyWork