Developer: Difference between revisions

From bone.wiki
Jump to navigation Jump to search
Pauchard (talk | contribs)
Redirecting to Main Page#Developer
 
(44 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Other Development Pages ==
#REDIRECT [[Main Page#Developer]]
 
Here is a list of other development-related pages.  (Some material has been moved because this page is getting very long.)
 
*[[Development on OS-X]]
*[[Development for Linux]]
*[[faim development]]
 
==Hardware==
 
Used Alpha stations at http://www.islandco.com
 
==VMS Development==
 
==="Hello, world!"===
 
 
====A simple "Hello, world!" application====
 
In C:
 
Write the following program in your favorite text editor (e.g. eve) and save it as hello.c:
 
<pre>
#include <stdio.h>
 
int main(void)
{
  printf("Hello, world!\n");
 
  return(0);
}
</pre>
 
Compile and link using the following lines:
 
<pre>
CC /OBJECT=hello.obj hello.c
LINK hello.obj /EXECUTABLE=hello.exe
</pre>
 
Run it:
 
<pre>
$ run hello
Hello, world!
$
</pre>
 
In C++:
 
Write the following program in your favorite text editor (e.g. eve) and save it as hello.cxx:
 
<pre>
#include <iostream>
 
int main()
{
  cout << "Hello, world!" << endl;
 
  return 0;
}
</pre>
 
Compile and link using the following lines:
 
<pre>
CXX /OBJECT=hello.obj hello.cxx
CXXLINK hello.obj /EXECUTABLE=hello.exe
</pre>
 
Run it:
 
<pre>
$ run hello
Hello, world!
$
</pre>
 
 
====A "Hello, world!" application with parameters====
 
 
Write the following program in your favorite text editor (e.g. eve) and save it as say_hello.c:
 
<pre>
#include <stdlib.h>
#include <stdio.h>
 
int main(int argc, char *argv[])
{
  if (argc < 2)
  {
    printf("Usage: hello <name>\n");
    exit(0);
  }
 
  printf("Hello, %s!\n", argv[1]);
 
  return(0);
} 
</pre>
 
Compile and link using the following lines:
 
<pre>
CC /OBJECT=say_hello.obj say_hello.c
LINK say_hello.obj /EXECUTABLE=say_hello.exe
</pre>
 
Now you need to define a symbol for your executable:
 
<pre>
hello :== $DISK1:[DEVEL.FABIO.EXAMPLES.HELLO]SAY_HELLO.EXE
</pre>
 
This allows you to run your program by simply calling "hello". You can give it parameters too, Unix style. The mechanism is known in VMS as "defining a foreign command".
 
Run it:
 
<pre>
$ hello
Usage: hello <name>
$ hello Steve
Hello, steve!
$ hello "Steve"
Hello, Steve!
$
</pre>
 
 
====Writing a (Unix) Makefile for the say_hello application====
 
Once the application described above is written, type the following into a file named "Makefile"
 
<pre>
all: say_hello.exe
 
clean:
        delete say_hello.exe;*
        delete say_hello.obj;*
 
say_hello.exe: say_hello.obj
        LINK say_hello.obj /EXECUTABLE=say_hello.exe
 
say_hello.obj: say_hello.c
        CC /OBJECT=say_hello.obj say_hello.c
</pre>
 
''IMPORTANT'': the space before the commands in the Makefile (i.e. the space before "delete ...", "LINK ...", etc) is a single TAB character.
 
You can now compile your program by calling "gmake"
 
<pre>
$ gmake
</pre>
 
I am assuming, of course, that gmake is installed in your system. In the bone lab, gmake is installed in duck.kin.ucalgary.ca.
 
 
===Developing new IPL commands in C===
 
A short manual on how to develop new IPL commands in C: [[Media:IPL_programming.doc| Download .doc file]]
 
 
 
 
====Advanced topics====
 
A list of nice things to add to this short tutorial:
 
* Status of cmake in VMS
 
===Getting started===
 
Editor:
<pre>
$! Define the editor
$ eve == "spawn/nowait edit/display=decwindows/tpu"
$ eve filename.txt
</pre>
 
Compiler:
<pre>
$! Define the compiler
$ C64 :== CC/POINTER_SIZE=64/check=pointer=all/optimize=(tune=ev6,level=5)
 
$! Compile the program 'ipl_scanco_c' and link it to existing libraries
$ c64 ipl:ipl_scanco_c
$!
$ link /exe=ipl:ipl_SCANCO_c -
        ipl:ipl_scanco_c, -
        ipl:ipl_scanco_c_ident/opt, -
        ipl:ipl_proc/lib, -
        ipl:ipl/lib, -
        mu:scanco_ext/lib, -
        dsrc:d3p_scanco/lib, -
        scanco_lib/lib
</pre>
 
===SCEVA3 (Itanium)===
<pre>
sceva3.ucalgary.ca
</pre>
Login <code>devel</code> with <code>bone5Rus</code>.
 
Note that scp is configured to use ssh2 and scp2. Linux (openssh) uses scp1:
 
http://www.snailbook.com/faq/scp-ossh-to-ssh2.auto.html
 
Whereas ssh and sftp work out of the box, successfully using scp requires a scp2 client.
 
===SCTHIN (DS10L)===
<pre>
duck.kin.ucalgary.ca has been assigned IP address 136.159.130.33
netmask 255.255.255.0
default router 136.159.130.34
DNS servers 136.159.130.130, 136.159.130.3
</pre>
 
Login <code>microct</code> or <code>devel</code> with <code>bone5rus</code>.
 
To boot into the cluster
<pre>
>>>boot ewa0
</pre>
To boot out of the cluster, unplug the ethernet cable and
<pre>
>>>boot
</pre>
 
To get to boot prompt, type <code>shutdown</code> on the login screen.  Or, after powerdown, hit <code>ctrl-P</code> repeatedly.
 
There are two accounts:
:*microct
:*devel
 
===Installing packages on VMS===
 
Contacts:
Piet Schuermans
Mark Blanchard
 
====Freeware source====
http://h71000.www7.hp.com/freeware/freeware80/
 
Instructions for unpacking .tar.gz files on VMS
:1. Rename the file to file.tgz
:2. gunzip file.tgz (creates a file.tar)
:3. vmstar file.tar
 
====VMSTAR====
 
A tar program for VMS.
 
Either install from the source (build it), or apparently the binary can be downloaded from
 
http://h71000.www7.hp.com/freeware/freeware50/vmstar/alpha/
 
where you will find VMSTAR.EXE
 
When extracting files that contain "unix" filenames (e.g., config.h.in), make sure to extract the files with
<pre>
$ cvstar xof file.tar  ! Option 'o' extracts ODS5 files with ODS2 format
</pre>
 
====CVS====
 
The sources can be retrieved from http://ftp.gnu.org/non-gnu/cvs/source/stable/
 
You will need a C compiler on OpenVMS.  There are several versions of CVS available, but all of them need some tweaking before they can be successfully built.
 
:cvs-1.11.18 (see build instructions at http://lists.gnu.org/archive/html/bug-cvs/2005-01/msg00280.html)
:cvs-1.11.21 (do not use)
:cvs-1.11.22 (latest version as of May 26, 2007 -- may be built, but follow instructions as per v.18 above)
 
Download the .tar.gz file, rename it to .tgz once on vms system, use gunzip then vmstar:
<pre>
$ rename cvs-1.11.22.tar.gz cvs-1.11.22.tgz
$ gunzip cvs-1.11.22.tgz
$ vmstar xof cvs-1.11.22.tar  ! option 'o' allows ODS2 naming.
</pre>
 
For all versions, make the following changes before starting:
:1. Before you attempt to compile 1.11.22 or later you will need make a copy of [.LIB]FNMATCH_H.IN as [.LIB]FNMATCH.H
:2. Correct typo in [.SRC]BUILD_SRC.COM  change "libz" to "zlib"
 
<b>Note:</b>
The directory names would have been cvs-1.11.21.dir on Linux.  However VMS doesn't allow more than 1 . in the name.  If you enter
 
<pre>$ set process/parse=extended</pre>
 
in a terminal you'll be able to access these files.  You rename them (i.e. cvs-1_11_21.dir).
 
<b>NOTE</b>
Piet Schuermans (mailps@mac.com) sent me a binary version of CVS on May 25, 2007 that I am currently using.
 
<b>USAGE</b>
 
Note that I have a "getting started on cvs for vms" document that can help. 
 
OpenVMS is case sensitive for passing parameters. So put the parameters between " "
 
<pre>
$ cvs -d ":pserver:anonymous@public.kitware.com:/cvsroot/VTK" login
$ cvs -d ":pserver:anonymous@public.kitware.com:/cvsroot/VTK" co "vtknew/CMake"
</pre>
 
If your using this repository location frequently then
<pre>
$ define cvsroot ":pserver:anonymous@public.kitware.com:/cvsroot/VTK"
</pre>
after this you can skip the -d ...... parameter
<pre>
$ cvs login
vtk
</pre>
 
This will create .cvspass file in your home directory so your only 
need to use the cvs login once
<pre>
$ cvs co "vtknew"
</pre>
 
public.kitware.com has ip address 66.194.253.19
 
===Update VMS licenses===
 
As user system:
 
<pre>$ lic list/full</pre>
 
and check which licenses are currently from 'MONTAGAR' and expire on Aug 31.
 
I recommend to only then replace those licenses with the new ones, and not load the whole license text file that you get from HP.  Make a 'shortlist' of the licenses you need, then FTP them to the VMS system and copy and paste.
 
Layered Products (any licence, but NOT the openvms-Alpha itself!)
 
<pre>
$ lic del OPENVMS-ALPHA-USER
$ LICENSE REGISTER OPENVMS-ALPHA-USER -
/ACTIVITY=CONSTANT=100 -
/AUTHORIZATION=EDU-711643-12345 -
/DATE=31-AUG-2007 -
/ISSUER=MONTAGAR -
/PRODUCER=DEC -
/TERMINATION=31-AUG-2007 -
/UNITS=0 -
/CHECKSUM=1-BBME-NKAP-EAFK-CNCA
$ lic load OPENVMS-ALPHA-USER
 
 
$ lic del vmscluster
$ LICENSE REGISTER VMSCLUSTER -
/ACTIVITY=CONSTANT=100 -
/AUTHORIZATION=EDU-711643-12345 -
/DATE=31-AUG-2007 -
/ISSUER=MONTAGAR -
/PRODUCER=DEC -
/TERMINATION=31-AUG-2007 -
/UNITS=0 -
/CHECKSUM=1-GOOP-ALPF-PGKG-OBND
$ lic load vmscluster
</pre>
 
Then, on SCTHIN, for the basic 'openvms-alpha' license itself. In a cluster, this license must be limited to one computer only, so first, to delete the correct of the multiple openvms-alpha licenses only.  If I ever wanted SCTHIN to be the server in a cluster, I should do the following (very unlikely!):
<pre>
$ lic list openvms-alpha/ful
 
$ lic delete openvms-alpha/auth=xxxxxx
! after first looking up the authori. of that montagar license.
 
$ LICENSE REGISTER OPENVMS-ALPHA -
/ISSUER=MONTAGAR -
/AUTHORIZATION=EDU-742405-743161 -
/PRODUCER=DEC -
/UNITS=0 -
/TERMINATION_DATE=31-AUG-2008  -
/ACTIVITY=A -
/OPTIONS=(NO_SHARE) -
/CHECKSUM=2-JMOA-GOFL-AKID-DHCJ
 
$ lic modify openvms-alpha/auth=EDU-742405-743161/include=scthin
! to make it available to scthin only.
</pre>
 
===MMS: VMS 'make' tool===
 
To start:
<pre>
$ mms
</pre>
 
An example from Bruno Koller of <code>descrip.mms</code>:
<pre>
.IGNORE
FFLAGS  = /FAST/OPT=(LEVEL=5,TUNE=EV68,INL=ALL)/OBJECT=$(MMS$TARGET_NAME).OBJ
FGENER  = /ALIGN=(NATURAL,SEQUENCE)/ASSUME=NOACCURACY/OPT=(LEVEL=5,TUNE=GENERIC,INL=ALL)/OBJECT=$(MMS$TARGET_NAME).OBJ_G
 
.FOR.OBJ
        $(FORT)$(FFLAGS) UD:$(MMS$TARGET_NAME).FOR
        $(FORT)$(FGENER) UD:$(MMS$TARGET_NAME).FOR
.FOR.INC
        $(FORT)$(FFLAGS) UD:$(MMS$TARGET_NAME).FOR
        $(FORT)$(FGENER) UD:$(MMS$TARGET_NAME).FOR
 
all  :: uct_reconstruction.exe, uct_reconstruction.exe_generic
        write sys$output "UCT_RECONSTRUCTION.EXE generated"
 
uct_reconstruction.exe :: -
        recoident.opt, -
        uct_reconstruction.obj, -
        scli:uct_reco_constants.inc, -
        calc_fan_beam_angles.obj, -
        rebinning.obj, -
        raw_to_rpro.obj, -
        conereco.obj
 
        link/exe=uct_reconstruction.exe -
        recoident/opt, -
        uct_reconstruction.obj, -
        calc_fan_beam_angles, -
        rebinning, -
        raw_to_rpro, -
        conereco, -
        scanco_lib/lib
 
uct_reconstruction.exe_generic :: -
        recoident.opt_g, -
        uct_reconstruction.obj_g, -
        scli:uct_reco_constants.inc, -
        calc_fan_beam_angles.obj_g, -
        raw_to_rpro.obj_g, -
        rebinning.obj_g, -
        conereco.obj_g
 
        link/exe=uct_reconstruction.exe_generic -
        recoident/opt, -
        uct_reconstruction.obj_g, -
        calc_fan_beam_angles.obj_g, -
        raw_to_rpro.obj_g, -
        rebinning.obj_g, -
        conereco.obj_g, -
        scanco_lib/lib
 
uct_reconstruction.obj :: ud:uct_reconstruction.for, -
        scli:uct_reco_constants.inc
 
calc_fan_beam_angles.obj :: ud:calc_fan_beam_angles.for, -
        scli:uct_reco_constants.inc
 
raw_to_rpro.obj :: ud:raw_to_rpro.for, -
        scli:uct_reco_constants.inc
 
rebinning.obj :: ud:rebinning.for, -
        scli:uct_reco_constants.inc, -
        scli:ctdata_header_structure.inc
 
conereco.obj :: ud:conereco.for, -
        scli:uct_reco_constants.inc
</pre>
 
Some notes:
:*UD is a logical for user disk search list over different disks, so I can compile on both alpha and vax with just having one source.
 
:*No need to put "ud:" at your site. Also, a few lines may have been wrapped which should be on one line (/fflag...) by the mail program.
 
:*Let me know if you want the mms installation file, you will need the hp campus mms license herefore (which you may already have)
 
===Alternative to MMS: MMK===
 
A free MMS replacement is called Madgoat MMK (http://www.madgoat.com/mmk.html).
 
===Alternative to EVE: NEDIT===
 
NEDIT is also available for VMS and offers a nicer editor, in my opinion (Mark Blanchard).
 
===Online VMS discussion lists===
 
info-vax (comp.os.vms)
 
===SCP hangs and is not working===
The problem occured when setting up sceva3 for development.
SCP (secure copy) can be used as follows (Linux terminal, untested):
 
<pre>
scp Readme.txt devel@sceva3.ucalgary.ca:[.Scratch]
</pre>
 
Troubleshooting:
:1. Check that all the scripts called from <code>[DEVEL]login.com</code> are present on the machine (alternatively, remove these calls from login.com, but logicals and symbols will not be setup properly, e.g. eve). Errors in the login script will cause scp to hang.
 
:2. If you get: <code>scp1 compatibility mode is not supported.</code> this means that scp on VMS is using ssh2 and scp2 and the client uses scp1 ( http://www.snailbook.com/faq/scp-ossh-to-ssh2.auto.html ). VMS could be configured for scp1, but the better option (Mark Blanchard, Scanco) is to use an scp2 client (is there one for MacosX/Linux? and Windows?).
 
==Linux Machines==
 
===Accessing Sodor disk===
 
From Konqueror in KDE, use a path like:
 
<pre>smb://HPL-NT\sboyd@hal/Sodor</pre>
 
==vtkMy==
 
===vtkMy Installation===
<b>Apple</b><br>
1. Install the code:
grab a copy from sodor/bonelab/software directory: vtkMy-osx.tar.bz2
create an /opt directory (if not already existing):
    $ sudo mkdir /opt
copy vtkMy-osx.tar.bz to /opt
    $ sudo cp vtkMy-osx.tar.bz /opt
unpack vtkMy
    $ sudo bunzip2 vtkMy-osx.tar.bz2
    $ sudo tar -xvf vtkMy-osx.tar
 
2. Edit your default paths in .bash_profile
  add the following lines to your .bash_profile file
 
<pre>
# vtkMy
if [ ! `echo $PATH | grep /opt/vtkMy-osx/bin` ] ; then
  export PATH="/opt/vtkMy-osx/bin:$PATH"
fi
if [ ! `echo $DYLD_LIBRARY_PATH | grep /opt/vtkMy-osx/lib` ] ; then
  export DYLD_LIBRARY_PATH="/opt/vtkMy-osx/lib:$DYLD_LIBRARY_PATH"
fi
</pre>
 
3. Restart your terminal session, or type:
    $ source ~/.bash_profile
 
===vtkMy Development - Windows Setup===
<br>
'''Required Software:<br>'''
Cmake 2.4.8 <br>
WinCVS 2.0<br>
ITK 2.8.1<br>
VTK 5.0.4<br>
Qt 4.4.0 Open source<br>
 
#Create directory C:\pack to keep all programs
#Download and install cmake-2.4.8.zip from: http://www.cmake.org/HTML/Download.html
#Download and install WinCvs 2.0.2.4 (released 2005-08-15) from:http://www.wincvs.org/download.html#WINCVS
#Download InsightToolkit-2.8.1.zip (hosted at SourceForge) from:http://www.itk.org/HTML/Download.htm
#Use WinCVS to download source files for VTK:
#*a. Open WinCVS and click menu Admin-> Preferences-> CVS Tab
#**Enter HOME: C:\pack
#**Click Ok
#*b. Open menu Admin-> Command Line
#**Enter the following:
#:::cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK login{space}{enter}
#:::cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK checkout –d VTK
#**Click Ok
#**You will be prompted for the password. Enter: vtk
#**Wait for checkout to complete
#Download vtkMy source using WinCVS (see SmartCVS below as option to WinCVS)
#*a. Verify home directory as set up in Step 5.a.i.
#*b. Open menu Remote-> Checkout Module
#** Enter the following settings:
#:::Module name and path on server: vtkMy
#:::Local folder to checkout to: C:\pack\
#:::Check box: CVSROOT
#:::CVSROOT: :ssh:username@m177.enme.ucalgary.ca:/localhost/cvsroot
#**Click Ok
#**You will be prompted for your password to access the machine
#**Wait for checkout to complete
#Install Qt 4.4.0 Open Source version
#*a. Extract all from “qt-win-opensource-4.4.0.zip” to your "C:\pack\qt-win-opensource-src-4.4.0" folder
#*b. Make changes to the Environment Variables which can be found in Control Panel -> System -> Advanced -> Environment Variables
#::-In System Variables, make new variable with name "QMAKESPEC" and value "win32-msvc2008" (*Note: 2008 or whichever version of VS being used)
#::-In System Variables, make new variable with name "QTDIR" and value "(your QT directory)"
#::-In System Variables, in variable Path, add ";(your QT directory)\bin;(your QT directory)\qmake;" (*Note: Ensure that there are no spaces and do not remove anything from the path that was previously there)
#*c. Ensure the Visual Studio Environment Variables are set. You may have the run either of the following in the Visual Studio Command Prompt Window:
#::- the "vsvars32.bat" file found in "Microsoft Visual Studio 9.0\VC\bin" folder
#::- or for 64-bit, "vcvarsamd64.bat" file found in "Microsoft Visual Studio 9.0\VC\bin\amd64"
#*d.In the standard Command Prompt, go to your QT directory and type "configure". (approx 10 mins)
#*e.Once completed, type "nmake". (approx 2 hrs)
#Build ITK using Cmake
#*a. Open Cmake
#*b. Choose C:\pack\InsightToolkit-2.8.1 as source code
#*c. Make C:\pack\InsightToolkit-2.8.1\bin binary code location
#*d. Click ‘Configure’ and choose desired compiler
#*e. Use the following Cache values:
#::BUILD_EXAMPLES: ON
#::BUILD_SHARED_LIBS: ON
#::BUILD_TESTING: ON
#::BUILD_BACKWARDS_COMPATIBILITY: 2.4
#::CMAKE_INSTALL_PREFIX: C:/Program Files/ITK
#*f. Click ‘Configure’, all red values should turn grey
#*g. Click ‘Ok’, wait as Cmake will close automatically
#Build ITK using Visual Studio (or desired program)
##Open C:\pack\InsightToolkit-2.8.1\bin\itk.sln (.dsw)
##Click ‘Build’
#Build VTK using Cmake
#*a. Open Cmake
#*b. Choose C:\pack\VTK as source code
#*c. Make C:\pack\VTK\bin binary code location
#*d. Click ‘Configure’ and choose desired compiler
#*e. Click the ‘Show Advanced Values’ checkbox and verify the following settings, all others can be left as defaults:
#::BUILD_EXAMPLES: ON
#::BUILD_SHARED_LIBS: ON
#::BUILD_TESTING: ON
#::BUILD_BACKWARDS_COMPATIBILITY: 2.4
#::CMAKE_INSTALL_PREFIX: C:/Program Files/VTK
#::VTK_USE_GUISUPPORT: ON
#*f. Click ‘Configure’, then new red values should appear
#::VTK_USE_QVTK: ON
#::VTK_USE_MFC: ON
#*g. Enter '4' when asked which version of Qt
#*h. Click ‘Configure’, then new red values should appear, leave as defaults
#*i. Click ‘Configure’, all red values should turn grey
#*j. Click ‘Ok’, wait as Cmake will close automatically
#Build VTK using Visual Studio (or desired program)
## Open C:\pack\VTK\bin\vtk.sln (note: file extension is .dsw for VS 6.0 and older)
## Click ‘Build’
#Build vtkMy using Cmake
#*a. Open Cmake
#*b. Choose C:\pack\vtkMy\src as source code
#*c. Make C:\pack\vtkMy\bin binary code location
#*d. Click ‘Configure’ and choose desired compiler
#*e. Click the ‘Show Advanced Values’ check box and verify the following settings, all others can be left as defaults:
#::BUILD_APPLICATIONS: ON
#::BUILD_SHARED_LIBS: ON
#::BUILD_TEST_PROJECTS: ON
#::BUILD_MIXED_PROJECTS: ON
#::BUILD_BACKWARDS_COMPATIBILITY: 2.4
#::CMAKE_INSTALL_PREFIX: C:/Program Files/VTKMY
#::USE_ITK: ON
#::USE_QT: ON
#::USE_FLTK: OFF
#*f. Click ‘Configure’, all red values should turn grey
#*g. May have to click configure again if any red values are still present
#*h. Click ‘Ok’, wait as Cmake will close automatically
#Add the following environment variables:
##Open the Control Panel
##Double click and open 'System'
##Go to the 'Advanced tab' and click on the 'Environment Variables' button
##In the System Variable Section click on the 'Path' variable and click 'edit'
##Add the following values separated by semi-colons
#:::C:\pack\vtkMy\bin\Debug
#:::C:\pack\vtkMy\bin\Utilities\tetrapack\Debug
#:::C:\pack\vtkMy\bin\Utilities\aimpack64\Debug
#:::C:\pack\vtkMy\bin\Unsorted\Debug
#Build vtkMy using Visual Studio (or desired program)
##Open C:\pack\vtkMy\bin\vtkmy.sln (.dsw)
##Click ‘Build’
 
===Setting up CVS access from Linux/Unix===
*To understand the codes for a CVS update, see page 121 of CVS users guide, section A.16.2.
# Valuable resource for understanding ssh:
#* http://www-106.ibm.com/developerworks/library/l-keyc.html
#* http://www-106.ibm.com/developerworks/library/l-keyc2/
# Setting up SSH access from "localbox" to "remotebox": <BR> <U>Localbox:</U>
#* ssh-keygen -t rsa [use a passphrase]
#: NOTE: Put the "id_rsa" (private file) in ~/.ssh.  There should only be one of these on a machine account.
#: NOTE: Put the “id_rsa.pub�? (public file) in ~/.ssh as “authorized_keys�? on remote machines; see “Remotebox�? below.
#* scp identity.pub skboyd@remotebox: [don't forget the last colon]
#* in ~/.bashrc:
#* export CVS_RSH=ssh
#* export CVSROOT=:ext:skboyd@m177.enme.ucalgary.ca:/localhost/cvsroot
#* eval `ssh-agent` {use the funny back single quotes}
:<BR><U>Remotebox:</U>
#* cat identity.pub >> ~/.ssh/authorized_keys
# To avoid writing your passphrase every time you log on, run ( on the local box!):
#* ssh-add ~/.ssh/ida_rsa
#: Should work if ssh-agent is already running (eval `ssh-agent`  in the .bashrc file).
# Do the following to limit access to cvs for the users:
#* edit the public key installed in the .ssh/authorized_keys file with the following at the beginning of the public key line:
#: command="/usr/bin/ssh server"
 
<U>NOTES ABOUT KEYS</U>
Remember, the "authorized_keys" file is a concatenation of public (id_rsa.pub) keys,
and the "id_rsa" is the private key. 
Every user on every computer should only have ONE "id_rsa" file,
but can have multiple "id_rsa.pub" files concatenated into
their "authorized_keys" file.
 
===Using CVS from a command line===
# To find a difference:
#* <code> $ cvs diff mylocalfile.cxx </code>
# To add a new file:
#* <code> $ cvs add mynewfile.cxx </code>
#* <code> $ cvs commit mynewfile.cxx </code>
# To update local file:
#* <code> $ cvs update -dCP </code>
#: or
#* <code> $ cvs update -dCP myfile.cxx </code>
# To check if a more recent version is available:
#* <code> $ cvs diff myfile.cxx </code>
#:  or (this will change the files):
#* <code> $ cvs update </code>
#:  or (local files are unchanged):
#* <code> $ cvs -nq update </code>
#:  update outputs are:
#*  <code>U file</code> new or newer file in repository
#*  <code>M file</code> newer file in local directory
# To update CVS repository:
#* <code> $ cvs commit mylocalfile.cxx </code>
# To look at the changes made to a file:
#* <code> $ cvs log mylocalfile.cxx </code>
 
===Add a project to vtkMy===
 
# Add a new project directory in the vtkMy/src/Applications directory.
# Update the CMakeLists.txt file in /src/Applications to include the new directory in the SUBDIRS() list.
# Copy the CMakeLists.txt and source code files from an existing project such as AppMohr and put them into the new directory. These files can be edited for your new project.
# Edit the copied CMakeList.txt file and the change the name of the .cxx to the name of the new project.
# Run CMake, taking the source code from vtkMy/src and building the binaries in vtkMy/bin.
# Open the Visual C++ workspace and edit the source code (since at the moment it will be a duplicate of whatever project you copied in step 3).
# Compile your new code. Usually, all the development should be done in the “Debug�? mode (rather than “Release�?, etc.).
# If, to run your application, you need to include command line arguments, go to the menu item [Project][Settings], and on the ‘debug’ tab set the Program Arguments as shown.
 
 
[[Image:VtkMy_Project_Settings.jpg|center]]
 
 
===WinCVS and PuTTY for vtkMy===
 
NOTE: An alternative CVS client has been suggested, see following section:
<pre>
SmartCVS from www.syntevo.com with a foundation license.
</pre>
 
Setting up WinCVS to use PuTTY is fairly straightforward, but does require a few configuration settings in addition to installing the software. You can do it with the following steps.
 
#Install PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/).
#Install wincvs (http://www.wincvs.org/)
#Make a key:
#*Follow menus: Start/Programs/PuTTY/PuTTYgen From the PuTTY Manual: <br>
#:...press the "Generate" button and PuTTYgen will begin the process of actually generating the key.
#*First, a progress bar will appear and PuTTYgen will ask you to move the mouse around to generate randomness. Wave the mouse in circles over the blank area in the PuTTYgen window, and the progress bar will gradually fill up as PuTTYgen collects enough randomness. You don't need to wave the mouse in particularly imaginative patterns (although it can't hurt); PuTTYgen will collect enough randomness just from the fine detail of exactly how far the mouse has moved each time Windows samples its position.
#*When the progress bar reaches the end, PuTTYgen will begin creating the key. The progress bar will reset to the start, and gradually move up again to track the progress of the key generation. It will not move evenly, and may occasionally slow down to a stop; this is unfortunately unavoidable, because key generation is a random process and it is impossible to reliably predict how long it will take.
#*When the key generation is complete, a new set of controls will appear in the window to indicate this.
[[Image:putty_key_generator.jpg|center]]
# Set the key comment and password. Set the key comment to your email address by typing it into the "Key Comment" box. Set the password by entering it twice, once in the "Key passphrase" box and once in the "Confirm Passphrase" box.
#Save the keys:<br> save the public key on your desktop as <code>identity.pub</code> and the private one as <code>identity.ppk</code>
#Email the identity.pub file as an attachment to skboyd@ucalgary.ca and ask for it to be added to the .ssh/authorized_keys file for your cvs repository. Please specify which repository you are requesting access to in the e-mail (i.e., vtkMy).
#Setup environment variables
#* Choose Menus:<br>Start/Settings/Control Panel
#* Double click on the "System" Control Panel
#* Pick the "Advanced" tab and pick "Environment Varibles..."
#* Add User environement variables
#:- Add PLINK_PROTOCOL value "ssh"
#:- Add CVS_RSH value "plink"
#:- Edit or Add PATH appending value ";C:\Program Files\PuTTY"
# In WinCVS, bring up the "Preferences" dialogue box from the Admin menu
#* In the "General" tab put in your CVSROOT value, (i.e. <code>:ext:myusername@m177.enme.ucalgary.ca:/localhost/cvsroot</code>)<br>[[Image:Wincvs general.jpg|center]]
#* Switch to the "Ports" tab.
#* Tick the box there labelled "Check for an alternate rsh name" and in the text entry field to the right enter "plink". <BR>[[Image:Wincvs ports tab.jpg|center]]
#* Select "OK" on teh "Preferences" dialogue box.
# Once you've heard back from the administrator (skboyd) that your ssh keys have been added, test your putty key configuration:
#*Double click on "identity.ppk" on your desktop. If this doesn’t start pagaent.exe automatically, then manually start the program from the directory you installed putty.exe.
#* If your identity file isn't already loaded, you will be prompted for the password you entered in step 4.
#*The Pageant icon (a little PC with a hat) should appear in the bottom right menu bar.
 
 
You should now be able to use WinCVS to access the repository, with a secure connection whenever Pageant is running. You can start Pageant by double-clicking on your identity.ppk file.
 
===SmartCVS===
 
This program is an option instead of using WinCVS.  While it is easier to setup it is slower and WinCVS is preferred.
 
#Download program from: http://www.syntevo.com/smartcvs/download.html
#Run program
#Choose “Check out project from repository”
##Click Manage
##Click Add
##Click “Enter CVS-Location”
##Type:  :ext:username@m177.enme.ucalgary.ca:/localhost/cvsroot
##Click “Next”
##Choose password or Public/Private Key
#Either enter password or load key file and passphrase
#Click ‘Finish’
#When back to Check out project window, click next and wait for checkout
 
==XEmacs==
 
===Pretty print===
 
:*For colour printing, select "Options", "Syntax Highlighting", "In this buffer"
:*In "Page Setup" set the margins to be 10 mm on the left and rights sides
:*In the "Printer Properties" on the "Effects" tab, use 90% of Normal size
 
==C Shell Scripts==
 
These scripts must be executable.
<pre>
$ chmod 775 myscript.com
</pre>
 
===Sample 1===
 
This file <code>aim2voi.com</code> shows the use of command line arguments in a CSH script.
 
<pre>
#!/bin/csh
#------------------------------------------------------------------------------
onintr end
if ($#argv < 1) goto usage
#------------------------------------------------------------------------------
aix $1.aim > $1.dsc
aic2voi $1.aim $1.voi
goto end
#------------------------------------------------------------------------------
usage:
#
echo ""
echo "Usage:"
echo ""
echo "aim2voi aim_filename (without aim extension)"
echo "will create a voi and dsc file from an aim"
echo ""
#
exit
#------------------------------------------------------------------------------
end:
exit
#------------------------------------------------------------------------------
</pre>
 
===Sample 2===
 
Similar to above, but <code>aim2bid.com</code> generates a temporary file called <code>stack</code> which
is used as input.
 
<pre>
#!/bin/csh
#------------------------------------------------------------------------------
onintr end
if ($#argv < 4) goto usage
#------------------------------------------------------------------------------
set i = $3
while ($i <= $4)
  set nr = $i
  if ($nr<10)  set nr = "0"$nr""
  if ($nr<100) set nr = "0"$nr""
#  if ($nr<1000) set nr = "0"$nr""
  echo "XY" >! stack
  echo "$i" >> stack
  echo "$5" >> stack
  if ($6 != "") then
    echo "0" >> stack
    aio $1 "$2"_"$nr".bid 14 < stack
    convert -size "$7" "$2"_"$nr".bid "$2"_"$nr"."$6"
    \rm -f "$2"_"$nr".bid
  else
    echo "2" >> stack
    aio $1 "$2"_"$nr".bid 14 < stack
  endif
  \rm -f stack
  @ i = $i + 1
end
goto end
#------------------------------------------------------------------------------
usage:
#
echo ""
echo "Usage:"
echo ""
echo "aim2bid aim_filename bid_prefix first_slice last_slice scal_factor [form size])"
echo "                                (values are one-based)              gif/tif/..."
echo ""
#
exit
#------------------------------------------------------------------------------
end:
exit
#------------------------------------------------------------------------------
</pre>
 
===Sample 3===
 
An example where a sequence of commands are executed resulting in an e-mail to let the user
know that their job is finished.
 
<pre>
#!/bin/csh
#
nohup faim -s $1; /bin/csh -cbf "Mail -s 'JOB $1 FINISHED' boyd@kin < ~/adm/mailer/faimjob.txt" &
</pre>
 
You would run this script called <code>faim.com</code> as follows
 
<pre>
$ faim.com inputfile
</pre>
 
===Sample 4===
 
This example uses two files.  One called <code>wrap.com</code> is the base program that is called in
a more general program called <code>wrap_all.com</code> so that many different files can be processed
by the base script.
 
*wrap.com
<pre>
#!/bin/csh
 
echo "0" >! stack
echo "0" >> stack
echo "0" >> stack
 
/home/skb/works/fio/aim_io $1.aim $1_sub.aim minimal 15 < stack
 
/rm -f stack
 
exit
</pre>
 
*wrap_all.com
<pre>
#!/bin/csh
 
~/works/com/wrap calgary_dog_aclx_03-04_med_fem_left
~/works/com/wrap calgary_dog_aclx_03-04_med_fem_right
~/works/com/wrap calgary_dog_aclx_03-04_med_tib_left
~/works/com/wrap calgary_dog_aclx_03-04_med_tib_right
 
echo "DONE!"
exit
</pre>
 
==temple.ucalgary.ca==
 
===Configuration Details===
 
I include in the attachments my checklist I use for a Solaris 10
installation, adjusted to show only items particular to yours
and not my entire decision tree. I added brief explanations
for some of the items that might seem arbitrary otherwise.
 
Very similar decisions are made when installing any release
of Linux, Solaris, MS Windows or yet another operating
system - the details vary though.
 
http://docs.sun.com/ has all (too many) the details.
 
:*Operating System [[Media:01_OS.pdf| Download PDF]]
:*Configuration [[Media:02_Configuration.pdf|Download PDF]]
:*Mirror [[Media:03_Mirror.pdf|Download PDF]]
:*RAID5 [[Media:04_RAID5.pdf|Download PDF]]
:*Finishing Steps [[Media:05_Finishing_Steps.pdf|Download PDF]]
 
===Install XEmacs===
However, I would not install both Emacs and XEmacs at the same
time. Nowadays, I highly recommend installing only one of them,
with my preference given to XEmacs. Of course, only when
there are no specialized Lisp packages that require Emacs.
 
Then my installation would be like below:
<pre>
$ cd /cdrom/s10_software_companion/components/sparc/Packages
$ cat > /tmp/nointeraction
  mail=
  instance=unique
  partial=nocheck
  runlevel=nocheck
  idepend=nocheck
  rdepend=nocheck
  space=quit
  setuid=nocheck
  conflict=quit
  action=nocheck
  basedir=default
 
$ pkgadd -a /tmp/nointeraction -d . -n SFWbdb SFWgcc34l SFWxmacs
  [ Copyright and legal notices omitted for brevity. ]
  21872 blocks
 
  Installation of <SFWbdb> was successful.
  [ Copyright and legal notices omitted for brevity. ]
  69953 blocks
 
  Installation of <SFWgcc34l> was successful.
  [Copyright and legal notices omitted for brevity. ]
  264202 blocks
 
  Installation of <SFWxmacs> was successful.
 
$ emacs () { /opt/sfw/bin/xemacs $* ; }
 
$ pkgadd -a /tmp/nointeraction -d . -n SFWddd SFWgbin SFWgdb
  [ To complete installation of the other packages you require. ]
 
$ pkginfo SFWbdb SFWddd SFWgbin SFWgcc34l SFWgdb SFWxmacs
  system      SFWbdb    berkeleyDB - Berkeley Database Library
  system      SFWddd    ddd - GNU Data Display Debugger
  system      SFWgbin  binutils - GNU binary utilities
  system      SFWgcc34l gcc-3.4.2 - GNU Compiler Collection Runtime Libraries
  system      SFWgdb    gdb - GNU source level debugger
  system      SFWxmacs  XEmacs - text editor
</pre>
 
==Developing on Duck==
 
===Installing GNV (GNU is not VMS)===
 
====Downloading GNV====
 
First, download GNV version 1.9 for VMS 7.3-2<br>
http://h71000.www7.hp.com/opensource/gnv.html
<p>
Unzip the file on <b>your workstation</b>. FTP the two <code>.pcsi</code> to duck using the "binary" mode (i.e. type <code>bin</code> before you use <code>get</code>. Make sure that all letters in the file name are uppercase, so, for example, if you got the following after unzipping:
 
<pre>
dec-axpvms-gnv-v0109-000-1.pcsi$compressed;1
dec-axpvms-gnv-v0109-000-1.pcsi$compressed_esw;1
</pre>
 
rename them to
 
<pre>
DEC-AXPVMS-GNV-V0109-000-1.PCSI$COMPRESSED;1
DEC-AXPVMS-GNV-V0109-000-1.PCSI$COMPRESSED_ESW;1
</pre>
 
====Installing GNV====
Login as user <code>system</code> to do the installation.
 
Follow the installation instructions on http://openvms.compaq.com/OpenSource/gnvreadme_first.html, section 6.
 
<pre>
$PRODUCT INSTALL GNV /SOURCE=device:[dir.where.pcsi.are]
</pre>
 
====Setting up GNV====
 
Follow the installation instructions on http://openvms.compaq.com/OpenSource/gnvreadme_first.html, section 7.
<br>
The following modifications were made to configuration files on duck:
 
1. File SYS$MANAGER:SYSTARTUP_VMS.COM: the following line was added
 
<pre>
$ @SYS$STARTUP:GNV$STARTUP.COM
</pre>
 
 
2. File LOGIN.COM at the devel account: added the line below
 
<pre>
$ @GNU:[LIB]GNV_SETUP.COM
</pre>
 
3.  As mentioned in http://openvms.compaq.com/OpenSource/gnvreadme_first.html, section 9.3, long file names are enabled on an ODS-5 disk by adding the follwowing line devel's LOGIN.COM file:
 
<pre>
$ SET PROCESS/PARSE_STYLE=EXTENDED
</pre>
Note that you could also make the terminal case sensitive, but this did not work well, so I did not include this command.
 
====Running GNV====
 
Just start bash:
 
<pre>
$ ssh -l devel duck.kin.ucalgary.ca
devel@duck.kin.ucalgary.ca's password:
Welcome to OpenVMS (TM) Alpha Operating System, Version V7.3-2 
 
DISK1:[DEVEL]
$ bash
bash$
</pre>
 
See the list of commands available at http://h71000.www7.hp.com/opensource/gnvreadme_first.html, section 5.

Latest revision as of 15:49, 16 September 2010