Tips and tricks

Remarks

You are free to ignore any of the below, but these tips were useful to students in the previous years.

On this page, we document a few tips and tricks that may help you with some of the day-to-day development activities. We do not support these tips. You are on your own in getting this to work.

Some of the material below was contributed by students in class. We refer to them for questions and comments on the material. Please see their posts on the course bulletin board.

Contributions from students in 2013

Benchmarking tool from E. Andersen

Benchmarking tool contributed by Evan Andersen (January, 2013)..

Evan has created a benchmarking tool for use with the ECE297 server API. Tests are distributed, accurate, and fast. They are performed by a cluster of slaves that are organized by a master server. This server splits the load and collects the results. The master also collects data from the operating system on the server process, such as memory and CPU usage.   

While the tool has been tested with millions of keys, It's still in beta, so there may be a few bugs. 

More information / source code available on github: https://github.com/charliehorse55/esb

Working from home

To have an equal playing field, as we explained to you, please note that your assignment submissions have to build and run on the undergraduate lab machines.

You may however develop your code anywhere you wish.

To work on your storage server or test whether your code builds and runs on the lab machines, you do not have to physically sit in the lab. Below, we discuss a few options for you.

Working from home via Windows

Here is what I showed you in the second lecture.

On my Windows (works for any variant of Windows), I have the free and open source Cygwin and XFree86 installed. Note that when installing Cygwin, you can simply opt to also install XFree86 or another X-server (e.g.,Cygwin/X.)

Bring up a Cygwin shell (click on the cygwin icon after installing Cygwin) and start the X-server (often you do that by running startx in your Cygwin shell. Depending on your installation, the startup script may be called initx or startwin.bat etc.)

From the shell, log into the undergrad lab machine of your choice (some of the machines could be down or loaded with other users, so you may have to try a few.)

You do this via:

  `ssh -Y <your-login>@<undergrad lab machine>.eecg.utoronto.ca'

Next time you are in the lab try to find the name of a few machines, so you can resolve the above strings.

After you successfully login, you are on the lab machine of your choice and should see your home directory. Start an xterm, start emacs, or xemacs.

  `xterm &'
  `emacs &'
  `xemacs &'

You may certainly start other applications, like for example `vi', another widely used editor.

Working from home via Linux (or Mac OS)

Start a shell and simply follow the above steps.

Working from home via Eclipse

This was contributed by a student. He'd post more details on the bulletin board, if required, just ask.

To remotely access the eecg svn repository, use:

  svn checkout svn+ssh://$USERNAME@<hostname>.eecg.utoronto.ca/groups/ECE297S/$TEAMID/svnroot

He says: "Works like a charm on Eclipse with subclipse plugin and from the command line. This should provide more incentive to use svn even when working remotely."

Thank you!

Installing This and That

A student contributed the following instructions to be watched on YouTube. More information on the bulletin board, or just watch the YTube.

Thank you!

Installing Subclipse (SVN) for Eclipse on Debian (Linux)

On YouTube at http://www.youtube.com/watch?v=PPI1c2CUna4, also see his post on the bulletin board.

Installing WinSCP (GUI Front-End SSH client) with PuTTY (OpenSource/FREE)

On YouTube at http://www.youtube.com/watch?v=_FJ6fSV_Fj8

Downloading Debian Linux OS, and installing Sun VirtualBox (OpenSource/FREE)

On YouTube at http://www.youtube.com/watch?v=MrHmtvfZDUI

Installing Debian Linux OS (without formatting), using Sun VirtualBox (OpenSource/FREE)

On YouTube at http://www.youtube.com/watch?v=oiDZw-2cmdA

Downloading and installing the GCC compiler, MAKE utility, Doxygen and LaTeX (OpenSource/FREE)

Go Latex!

On YouTube at http://www.youtube.com/watch?v=vHrlZuzDy_Y

About UML

A student contributed the following instructions to be watched on YouTube. This is for creating various UML diagrams with MS Visio.

Thank you!

While Visio (and PowerPoint et al.) are probably heavily used in practice (i.e., in industry) for sketching and drawing use cases, sequence diagrams, class diagrams, business processes et al., they are not meant for that purpose. The downside to this approach is that it is difficult to generate code from these tools and to keep the diagrams and the code synchronized to changes (i.e., changes to code, to diagrams, to processes etc.) While many of these aspects are still material for research, professional diagramming tools are available.

You may want to look at ArgoUML as a free and open source example.

Sequence diagrams

Sequence UML Diagrams: (Example) Understanding & Creating them, using Microsoft Visio

On YouTube at http://www.youtube.com/watch?v=QsNuGB9mvJk

Use case diagrams

Use Case UML Diagrams: (Example) Understanding & Creating them, using Microsoft Visio

On YouTube at http://www.youtube.com/watch?v=DnrzGZpXII0

Inconsistent results in TEST CASES

Some of you may have encountered inconsistent results when running the test cases via a1-partial or via testsumbmitece297s.

You may have observed that test cases pass most of the time but fail at other times. So called Heisenbugs are often difficult to find. But, do not worry, at least for now (Milestones 1 - 3), if a test case passes at least once, then it should most definitely pass our marking procedures. In Milestone 4, we introduce multi-threading for concurrency, where this statement has to be revisited.

The reasons for test cases to apparently randomly fail is that other students might be accessing the same machine (i.e., ssh-ing from home or elsewhere into your lab machine) while you are running your tests. Thus multiple servers will be asked to start on the '''same port number''' (unless you changed the default port specified in the configuration file). The operating system (OS) wont allow that to happen. This is why you observe certain test cases to fail at one time, while they pass at other times.

Below, we suggest a few ways to avoid this problem.

Checking for running storage server instances

You can use the "ps -fC server" command to see if there are any other instances of the storage server running on your lab machine. You can kill instances of the server you ran with the "pkill server" command. Note that you can not kill storage server instances run by other users.

Checking for used ports

The above ps command will only tell you if there are other storage server instances running, not what ports they are using. You can use the "netstat --inet --tcp -nl" command to show the ports that are already used by a listening socket.

Checking load on the machine

You can use the top command to check the load on the machine before you run your tests. If the machine is being used by other ECE297 students, you can try running your tests on another machine in the lab.

Changing the port number

You can also avoid the port number conflict by manually editing the configuration files. For example, you can change the port number in conf-onetable.conf from 4848 to 4747 or some other value between 1024 and 65535.

Note that port numbers between 0 and 1023 are reserved ports and require root privileges to be used by an application. On the lab machines we do not have root privileges and thus an application using one of these ports would fail.

Be careful when editing the configuration file to not introduce other problems due to typos, for example.

Dealing with Segmentation Faults et al.

Downloading, installing and using Valgrind

Narrow down segmentation faults and memory leaks in minutes.

On YouTube from the usual channel http://www.youtube.com/watch?v=eati_cmIrSw

Live debugging with Valgrind examples.

On YouTube from the usual channel http://www.youtube.com/watch?v=7xJuBqhlChE

Thank you!

back to top