Archive

Archive for the ‘P2’ Category

How to use git to solve and submit your exercises

February 25th, 2010

You need git to send in assignments. You will receive the skeletons for your solution through git, presumably use git to version your intermediate steps, and when you’re all done, you’ll push your changes to the server, where we’ll grade them. This file tells you the few basic commands that you’ll need to solve the exercises.

This article is also available as a presentation: Git tutorial.

Where to get git

Download:

  • Cygwin for Windows (don’t forget to include the git package)
  • Git everyone else

Generate your ssh key

Here, and in the rest of this text, lines that start with a dollar sign ($) are to be issued on the command line (without the dollar sign itself, of course).

If you know what you’re doing, you can skip this. This creates your ssh key:

$ ssh-keygen -t rsa

Send us your ssh key

Mail the ~/.ssh/id_rsa.pub (note: only .pub file!) to: patrik.rauber@students.unibe.ch. Then, receive your confirmation.

Clone your group’s repository

$ git clone git@pinocchio.unibe.ch:groupXY

(where XY is your group number)

$ cd groupXY

Configure git

Issue the following commands:

$ git config --global user.name "YOUR NAME"
$ git config --global user.email "your@email.com"

$ git remote add p2ubungen git@pinocchio.unibe.ch:p2ubungen


Get exercise skeletons

These are the code skeletons that you will have to adapt or look at for completing your tasks. The following command copies the skeleton into your repository.

$ git pull p2ubungen master

Set up Eclipse

Eclipse is the program where you’ll write your code. Get it from eclipse.org/galileo.

Now, open Eclipse. Set your workspace to the folder: “groupXY”, i.e. the repository root.

Import p2regex project with by choosing from the menu:
File > Import … > General > Existing Projects into Workspace.

Workflow

Here are the commands that will get the code into your local repository, and into the public server, that your group and the TAs can see.

Retrieve latest exercise skeletons from server

$ git pull p2ubungen master

Retrieve your group’s changes from server

$ git pull

Commit to your local repository ###

$ git add *
$ git commit -m “I changed something!”

Retrieve your group’s changes from server

$ git pull

Upload to server

$ git push

Verify that everything went good with git

As you work, to see the status of git (what it’s about to commit, what’s in the repository and what isn’t, etc.) you can issue:

$ git status

Verify thoroughly that everything went good with git

After finishing your work, check that everything was pushed:
$ cd /tmp
$ git clone git@pinocchio.unibe.ch:groupXY
$ cd groupXY
$ ls -lh

More info on git

http://sunoano.name/ws/public_xhtml/scm.html.

Here, replace “I changed something” with a good and long description of what you changed.

nes1983 Eclipse, P2

Learning is an infinite loop

June 2nd, 2009

Ten years ago, when I learned programming, there was this one place to hang out. If you wanted to learn best practices, get latest news and meet the people, you went to the wiki. Everyone gathered there and exchanged their knowledge. A great place for learning.

Today, the internet is different. The original wiki is abandoned, and everyone—even my nice and my grandmother—knows the wiki, the other wiki. Not that I dislike Wikipedia, but is not the premium place for learning how to programming.

Today, you need an RSS reader to get to the source. There are few things more valuable than a well selected choice of news feeds. I always keep my blog roll at a size that there are about 300–400 new posts each morning. With the space bar, I can quickly skim through the headlines and open those dozen of post for further reading, that catch my interest. The news reader has became what the wiki’s recent changes page used to be.

Good starting point is for example progit.

To raise your voice and take part in discussions, best get your own blog. Commenting is nice, but real discussion only starts when answering post with post. Blogging is also the best exercise in writing, which is—that might surprise you—one of the most important skills as a software developer.

Also, this will be good exercise for the Bachelor’s and later Master’s thesis. I have seen too many students, including me, that failed writing their thesis in time. Often students postpone their work for months if not years … usegstüdelet … just to avoid writing.

Hoping to receive your pingbacks soon!

All the best,
Adrian

akuhn P2, Read this!

How to branch with Subclipse

March 16th, 2009

On the command line, you can create a branch with

svn cp http://popeye.unibe.ch/svn/p2/Group23/week04 http://popeye.unibe.ch/svn/p2/Group23/ludo01

The same is done with Subclipse as follows

  • Goto the Subclipse perspective
  • Open your group repository.
  • Select the folder you want to branch.
  • Right-click and choose “Branch/Tag”
  • In the dialog, enter the full name of the new folder.
  • Finish, and done.

PS, using the command line you should also be able to copy folders from /Common to your group account. Alas, in Subclipse this wont work.

akuhn Eclipse, P2, Tools

IndexOutOfBoundsException in JExample fixed

March 10th, 2009

All those that got an IndexOutOfBoundsException with JExample can now update to revision 281. Obviously the latest Java (version 1.6.0_10 and higher) introduced a bug that broke JExample.

For the future, you may follow JExample’s update feed.

 

TLDR new JExample available, go get it!

akuhn P2

Hello, 2009!

March 6th, 2009

Welcome to the Panopticon.

This blog will provide a constant stream of resources, pointers and side-notes related to the Programming II lecture. As the name of the blog indicates, articles will cover a broader spectrum than just the very subject of the lecture. Please use the categories on the right to browse posts by topics.

Below you find two of the shortest hello worlds for Java

enum H{W;{System.out.print("Hello, worlds!");}}
class S{static{System.out.print("Hello, worlds!");}}

The are not as short as a hello in the HQ9+ language, but they are as short as one might get in Java. I will leave it up to you to unravel the language features that are being abused in these hellos.

More hellos can be found in the initial post of my personal blog.

cheers,
AA

admin P2

Hello, world!

March 1st, 2008

Welcome to the Panopticon.

This blog will provide a constant stream of resources, pointers and side-notes related to the Programming II lecture. Please use the categories on the right to browse posts by topics.

The title of this first post follows a programmer’s tradition. When learning a programming language, it has become tradition to write, as a first step, a program that prints the character sequence “Hello, World!” on the screen.

The shortest hello world program is most probably written in the (rather esoteric) hello language, just consisting of a single letter

h

Whereas the world’s largest hello world program ever, was this breathtaking 160 by 160 meter semacode, written in a wheatfield by German artist and programmer Bernd Hopfengärtner.

via we make money not art

admin Geek, P2