I have moved! New homepage https://homepages.dias.ie/jmackey/

From 1. January 2016 I have moved to the Dublin Institute for Advanced Studies. Please go to my new homepage for up-to-date information.

Each of these headings will probably get their own page eventually...

SSH tips


Mac OSX collection of useful things


Using VisIt for data visualisation

VisIt is a really powerful piece of software developed at LLNL for looking at large datasets, but it is not trivial to install, or to get it to read your data. There is lots of information on the LLNL VisIt website, from the visit-users mailing list, and on the visitusers.org wiki.

LaTeX


Version Control (SVN)

Subversion is the version control system I am using. I used to use CVS, but I found SVN to be better so I switched. This page is mostly to remind myself of how to do things with SVN because I have only used most of the commands a handful of times.

Update: I now also use Mercurial, which seems basically the same as SVN, but a bit better for some things such as merging and conflict resolution (and it is distributed, not centralised). Some info about Mercurial will make its way onto this page eventually, once I start using it more. See mercurial.html for more details.

I have a few environmental variables set in my bashrc file for SVN:

export SVN_EDITOR=/usr/bin/vim
export SVN_SSH="ssh -l[username] -p[ssh-port]"
   

Creating a project

First create a directory and a file or two as a skeleton for the project.
Then create a SVN "repository" for the files.
Then import the directory and file(s) into the SVN repository.

jm@localhost:~$ mkdir temp/; mkdir temp/new_project 
jm@localhost:~$ touch temp/new_project/log.txt
jm@localhost:~$ svnadmin create /path/to/archive/NewProject
jm@localhost:~$ svn import ~/temp/new_project file:///path/to/archive/NewProject/ -m "initial import"
Adding         ~/temp/new_project/log.txt
  

Checking out a project

Now the project can be checked out remotely using the first line below, or when on the local machine using the second line below.

jm@localhost:~$ svn co svn+ssh://host.university.country/path/to/archive/NewProject ./new_project/
jm@localhost:~$ svn co file:///path/to/archive/NewProject ./new_project/
  

Commiting changes

...

Checking information on files/directories

...

Merging a branch back to the trunk

I got the information for this from the SVN book and this blog.

You first need to have an up-to-date copy of the trunk. Then find the revision when the branch was created:

jm@localhost:/$ svn log --stop-on-copy svn+ssh://U.R.L/path/code/branches/RTupdate | tail -n5
------------------------------------------------------------------------
r359 | jm | 2011-10-06 12:29:45 +0200 (Thu, 06 Oct 2011) | 1 line

Branch for updating the raytracing module.
------------------------------------------------------------------------

Change directory to the trunk dir and see what the current revision is and make sure it is updated.

jm@localhost:/path/to/projects/code/trunk$ svn update
At revision 396.
  
Now merge the branch to the trunk.
jm@localhost:/path/to/projects/code/trunk$
  svn merge -r 359:HEAD svn+ssh://U.R.L/path/code/branches/RTupdate .
Conflict discovered in 'extra_libraries/install_all_libs.sh'.
Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: s

  (e)  edit             - change merged file in an editor
  (df) diff-full        - show all changes made to merged file
  (r)  resolved         - accept merged version of file

  (dc) display-conflict - show all conflicts (ignoring merged version)
  (mc) mine-conflict    - accept my version for all conflicts (same)
  (tc) theirs-conflict  - accept their version for all conflicts (same)

  (mf) mine-full        - accept my version of entire file (even non-conflicts)
  (tf) theirs-full      - accept their version of entire file (same)

  (p)  postpone         - mark the conflict to be resolved later
  (l)  launch           - launch external tool to resolve conflict
  (s)  show all         - show this list

Select: (p) postpone, (df) diff-full, (e) edit,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: dc
@@
export CXX=g++
export FC=gfortran

<<<<<<< MINE (select with 'mc') (13,192)
...
MY (TRUNK) COPY OF FILE
...
||||||| ORIGINAL (11,0)
=======


>>>>>>> THEIRS (select with 'tc') (11,2)
Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: mf
--- Merging r360 through r396 into '.':
U    extra_libraries/install_all_libs.sh

When there are conflicts, the branch version is denoted 'theirs', the current directory (trunk) is denoted 'mine', so you can use 'mc' to use trunk versions for conflicting regions (or 'mf' to use the full trunk file), or equivalently 'tc' and 'tf' to have branch code replace trunk code. You can display conflicts with 'dc', of the diffs with 'df', but I find the diffs are less useful because you are comparing three files and 'dc' clearly states 'MINE', 'THEIRS', or 'ORIGINAL'. In any event, I found it simpler to go to the trunk and branch copies of the source files and compare them myself and then decide which one to use.

At the end of it all I got:

U    bin_serial/Makefile.serial.icgenerator
   C bin_serial/compile_phalanx.sh
D    bin_serial/aa_compile.sh
--- Merging r360 through r396 into 'ics':
U    ics/get_sim_info.cc
U    ics/icgen.cc
U    ics/icgen.h
U    ics/blast_wave.cc
Summary of conflicts:
  Tree conflicts: 3
jm@localhost:/path/to/projects/code/trunk$  

The conflicts were from files that were deleted on the trunk since the branch was created, and I guess were not deleted on the branch. You can now see what files have changed with "svn status", and compare them against the branch files (one-by-one) with diff. As expected, all of the trunk files were identical to the branch ones except where there were conflicts and I kept the trunk copy.


So the sequence of commands is:



Imagemagick

Imagemagick is a very useful tool for converting figures between formats, cropping borders, shrinking images, etc., and it has a command-line interface so you can put it in scripts. Here are some examples I find useful (most of them taken from the imagemagick website examples).

Unix Commands

Concatenate pdf files (found here):
gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf [...] lastfile.pdf
Delete files with zero size (found here):
find -maxdepth 1 -type f -size 0 -print0 | xargs -0 rm -f
Delete files matching a pattern (e.g. file extension) (found here):
find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;

Shell scripts


Gnuplot


Nokia



Valid HTML 4.01 Transitional