The name “Project 1.1” means “Project 1, Phase 1”. You'll be turning in all of your projects in phases. The first project is concerned with building a tool for programmers to investigate Unicode strings, but first we've got to get comfortable with our tools.
This portion of the first project is structured as a sort of lab. Here's what you should know after this assignment:
Your practical goals for this assignment are:
You'll have lots of questions. You'll be able to answer some of them through experimentation and searching the Internet, but don't hesitate to ask other people (including me) for help.
So, here we go...
Go to bitbucket.org and create an account for yourself based on your Carleton email address. (It's important to use an address ending in “.edu” so you will get a free, unlimited academic account.)
Log in to your Bitbucket account, go to Repositories→Create repository and create a Git (not Mercurial!) repository named EncodingHelper. Keep it private.
A repository is essentially a folder in which you can store whatever files and subfolders you want. What makes a repository more than a folder, however, is that the version control system (Git, in this case) keeps track of all the changes that get made to the files in the repository. This saving of history makes it possible for you to retrieve old work, track down the time when a bug was introduced (and who introduced it), collaborate on a project with a team of programmers, easily back up your work, etc., etc. Version control systems are a bit of a hassle to learn for the first time, but they're indispensable programming tools and unquestionably worth the effort.
You can get Git here. It's possible that you already have Git on your computer, but you would probably know it if you did.
Once you install Git, you'll be able to use it from the command line. For many people, that's sufficient. However, there are some benefits to using a GUI Git client, too. Since we'll be using Bitbucket to host our Git repositories, I recommend that you take Bitbucket's advice and install Atlassian SourceTree, which integrates very well with BitBucket. IntelliJ also has Git integration, so you could hold off for now and try that out instead. It's all up to you.
For the rest of this document, whenever there's need to show a Git operation, I will show you the Git command-line version of that operation. If you're using SourceTree or IntelliJ's Git features or any other Git client, you'll need to figure out the equivalent operations in your client.
Right now, your EncodingHelper repository is stored only on the Bitbucket server. To add files to it, you'll need to “clone” a copy of the repository onto your own computer. You will then add files to your local copy of the repository and push your changes back up to Bitbucket.
Bitbucket gives you some setup instructions right after you create a new repository, and they work just fine, but there's a simpler way to make your clone.
First, make sure you've got a directory where you'll work on stuff for this class. Each project will have a directory of its own within this. Change into this directory on the command line, and then:
git clone https://YOUR_USER_NAME@bitbucket.org/YOUR_USER_NAME/encodinghelper.git EncodingHelper
Of course, replace YOUR_USER_NAME
with your actual username on Bitbucket.
(Note that Bitbucket instructs you to use git@bitbucket.org:YOUR_USER_NAME/encodinghelper.git instead of the https version above. However, this latter version only works if you have installed an SSH key in your Bitbucket account. Doing so can make some Bitbucket operations simpler, but it's not required.)
You should now have a directory called EncodingHelper, containing only a subdirectory called .git. A word of caution: it's critical that you not change anything inside the .git directory. It can be really informative to poke around in it and see what's there (it gets more interesting once you've got some files in your repository), but if you want to change anything about your repository, you need to do so using your Git client. Mucking around with the inner workings and metadata of your VCS is a major cause of headaches, heartbreak, data loss, hives, and so on.
IntelliJ is already installed on the CMC lab machines. Before you can use it, though, it needs to be set up on your account. This is really easy, and Mike wrote up a wonderful set of instructions to follow.
If you prefer to work on your own computer, download the IntelliJ Ultimate Edition. We've got a license for anyone at Carleton to use it. When you first start it up, you'll be asked for your registration key; this is documented in a post on Piazza. (Once it's up, hopefully I'll remember to edit this paragraph and add a link. If I haven't yet, please post on Piazza and ask me to do so!)
Here are the steps. (There's also good help at the JetBrains IntelliJ Help page.)
git clone
created previously. Make sure it's not a directory inside that one! (You can also just put the project in a temporary location for now, and in the next step move it over. But creating the project directly in the repository folder worked for me.)edu.carleton.jadrian
.Open up the Preferences dialog in IntelliJ. (On a Mac, it's under the main IntelliJ application menu, in the upper left.) Then open up the Editor→Code Style pane. Set these three preferences:
Apply your changes. By default, IntelliJ is configured to insert spaces instead of tabs, and uses a four-space tab width. This is the correct configuration; test your editor to make sure it's right.
git add .idea src EncodingHelper.iml
Commit your changes. That is, you tell Git to make your changes a permanent part of the history of your repository. When you perform the commit operation...
git commit
... you will be required to type a commit message. In this case, your message should be something like “Added the initial IntelliJ project files to the repository.”
git push
Everything up-to-date
. In that case, try instead executing git push origin master. That's explicitly saying: “Hey git, push the code that's on my local master branch (the default one) back to the origin server.“System.out.println("hello, world!");
to your main method. (Note that the indentation is incorrect in the starter code — the commented line is indented by a tab character, not four spaces. Make sure to delete the whole line and indent your code properly!)Most of the code submission in this class will be done using Git and Bitbucket. Here's how:
“Tag” your code at the point where you want it graded. Since you may start work on Phase 2 of the EncodingHelper project before the graders finish grading Phase 1, they'll need to be able to get a copy of your code as it was when you were done with Phase 1. To do that:
git tag -a phase1_final -m "Tagged for assignment due 2015-04-01" git push origin phase1_final
Please use that exact tag name (phase1_final) so it's easy for the graders to access everybody's Phase 1 code. Note that in the push command we're explicitly naming the destination (origin) and the tag to push.