How to make your Windows PC behave nicely for CSci 1103/1113 and more
0. Install Java
Follow the
instructions here to install Java if you're in CSci1103 or a class that
uses Java.
1. Get a unix-like console
If you're running Windows XP or Vista you can get a unix-like console supporting the execution of similar commands
to those you are using in the labs by installing cygwin. This can also be
used to remote login to itlabs as well as to transfer files between your machine and itlabs without using a separate
program.
Get the cygwin installer and install cygwin by running it. Then, if you're
in CSci1113 or a class that uses C++, follow
the instructions here to install g++ (the gnu C++ compiler) in cygwin.
If you have any trouble, talk to me.
2. Get a programmer's editor with syntax highlighting
You can get a useful programmer's editor with syntax highlighting by installing notepad++.
After it and cygwin are installed, you can arrange that notepad++ can be started from the command line like gedit
or emacs.
3. Arrange for the text editor to start up from the command line
Here's how: start the cygwin console, and do the following to make a directory called bin inside your home directory
(which your cygwin startup files know about if it exists), and put a cygwin link to Notepad++ in there called edit.
$ cd ~
$ mkdir bin
$ cd bin
$ ln -s "/cygdrive/c/Program Files/Notepad++/Notepad++.exe" edit
Then you should be able to type things like
$ edit Hello.java &
and have it start Notepad++ and open the file.
Note: If Notepad++.exe is not installed in
C:\Program Files\Notepad++\
then you'll have to modify the long command above correspondingly.
Note that /cygdrive/c is cygwin's unix-like way of saying C:\
4. How to remote login to your itlabs account from the cygwin console
You should be able to remote login to your itlabs account from the cygwin console by choosing
a machine name from here and using ssh. (You can use this command in the lab too.) Here's how I might do it.
$ ssh -l carl boffles.itlabs.umn.edu
Substitute your own login name for carl, and one of the machines on the list
for boffles. The first time you log in to a given machine, you'll be asked to approve its security credentials
before you're asked for a password. Go ahead and say "yes" if you're confident you got the machine name
right. When you're finished with the connection, just type the command logout
to terminate the remote session.
5. How to transfer a file from your machine to your itlabs account using the cygwin console
Once you've got a java program working, you'll want to put a copy on itlabs. Here's an example session of mine
using the cygwin console to do that. Change the username and machine name as in the previous section and you can
do this too.
$ cd lab17
$ ls
Lab17.java Lab17.class
$ sftp carl@boffles.itlabs.umn.edu
password:
sftp> mkdir lab17
sftp> cd lab17
sftp> put Lab17.java
Uploading Lab17.java to /home/blah/carl/Lab17/Lab17.java
Lab17.java 100% ...
stfp> quit
$
To retrieve a file from itlabs to your PC, use the sftp command get instead
of put in the above example.
6. Needless fussing with the Windows user interface to make things even easier
Your cygwin installation is in C:\cygwin by default, and my cygwin
home directory (the one the cygwin console starts up in) is in C:\cygwin\home\carl
so yours will be in something similar ending in your name. All of your programming work will lie in this home directory
and any subdirectories of it that you create. So it's convenient to put a shortcut to this directory on the desktop,
or somewhere equally accessible.
If you open a text editor from Windows and start programming and want to save your work in a folder in your cygwin
home directory ready to compile it, the Windows 'Save' dialog box is unhandy, as you need to push the button on
the left of it for 'My Computer', then open C: from there, then open 'cygwin' from there, then open 'home' from
there, then (in my case) open 'carl' from there, and then open the folder where you want to save the file. What
you need is a button on the left panel of the Windows 'Save' dialog box that takes you directly to your cygwin
home directory. On XP only you can do this by installing tweakUI which is a part of Microsoft
Powertoys for Windows XP. Install this and run tweakUI, open the node on the left entitled 'Common Dialogs',
and click on 'Places Bar'. Then click the 'Custom places bar' radio button, type in your home directory (C:\cygwin\home\carl
in my case) into one of the five slots. Thereafter, this will appear as a button on standard 'Open' and 'Save'
dialogs in any application that uses them. I don't know Vista; for all I know this is possible directly with Vista.
|