2007-PHYS-339 Introduction to Programming
From McGill University Physics Department Technical Services Wiki
Synopsis
- Equipment available: Tuesday January 4th through Thursday January 11th 2007.
- Report due: Monday January 15th 2007.
Introduction
This is a two week exercise designed to get you up to speed with using the computer.
Do not overlook this step. Several of the programs you will need to write for the exercise can be used in later experiments. Write code that you can understand next month when you will not have time to reinvent the wheel.
This page should have a great deal more content!
Tutorial
The following links will take you to a tutorial section.
- Help - This is a brief introduction to this help system
- Login - How a login should work
- X Desktop - How to interact with the desktop manager
- Emacs - How to use my favorite editor
Resources for the exercise
- Introduction To The PC - the work in progress Wiki version of the handout.
Right click on these links to save them to disk.
- intro.pdf (http://www.ugrad.physics.mcgill.ca/resources/339/intro/intro.pdf) - PDF version of document handed out in class
- exercise.pdf (http://www.ugrad.physics.mcgill.ca/resources/339/intro/exercise.pdf) - PDF version of document handed out in class
- sinusoid.data (http://www.ugrad.physics.mcgill.ca/resources/339/intro/sinusoid.data) - Data to be used for exercise
- gaussian.data (http://www.ugrad.physics.mcgill.ca/resources/339/intro/gaussian.data) - Data used in examples, may be useful for testing programs.
- stub.c (http://www.ugrad.physics.mcgill.ca/resources/339/intro/stub.c) - A sample of code which could be extended to manipulate the data.
- LaTeX Template - this page documents the LaTeX template mentioned in the exercise handout.
Printing
If you wish to print a text file, use the command enscript.
kukucan:~# enscript window.c [ 2 pages * 1 copy ] sent to printer
\begin{scarcasm}
For a slightly more in depth treatment of this topic, follow the link printing.
\end{sarcasm}
Wierd problems
- When I log out the screen turns grey ... and stays grey forever ... just a stupid X mouse pointer ... can't login!
- This is a weird problem, I've been trying to figure out what triggers this 50% probability since September. I had to tinker with and recompile XDM, the login manager, to allow the very long usernames required by McGill ADS, I suspect I botched something. The simple solution is to press [Ctrl]-[Alt]-[Backspace], this will kill X and thus restart XDM; brute force, but it works. Don't hit the reset or power buttons, this will just waste more time and possibly corrupt the filesystem.
- Executable programs which used to run now repond like this
kukucan:/mnt/scratch# ./alien-slaughter bash: ./alien-slaughter: Permission denied
- This is also a painful problem. The origin is clear in this case however, the correct solution is not so obvious. As a result of the New World Order unified ADS policy, your home directory is not something originating in the Physics Department, it is exported from the bowels of Burnside Hall, from Windows 2003 Server servers. Because of this, they don't have proper execute bits, which are used by unix to determine if a file is an executable ... Windows decides based upon the extension of the file, for example "
foo.exe" or "bar.com". To negotiate this disaster the Linux kernel remembers the setting of execute bits during a session, but when you log out or a certain amount of time passes, the settings are forgotten. One solution would be to run thechmodcommand like this
- This is also a painful problem. The origin is clear in this case however, the correct solution is not so obvious. As a result of the New World Order unified ADS policy, your home directory is not something originating in the Physics Department, it is exported from the bowels of Burnside Hall, from Windows 2003 Server servers. Because of this, they don't have proper execute bits, which are used by unix to determine if a file is an executable ... Windows decides based upon the extension of the file, for example "
kukucan:/mnt/scratch# chmod 0755 alien-slaughter kukucan:/mnt/scratch# ./alien-slaughter
This will set the execute bit for the duration of the current session which will make the program executable again.
(http://www.ugrad.physics.mcgill.ca/~beek/alienslaughter/)
Long term, home directories really should be native, but given that there are 70k potential logins due to ADS, it is a bit tricky.
