\newcommand{\cclicense}{%
\smash{\raisebox{-0.45ex}{%
\setlength{\unitlength}{1em}%
\begin{picture}(1,1)%
\put(0.5,0.5){\circle{1}}
\put(0.5,0.5){\hbox to 0pt{%
\hss\raisebox{-.45ex}{\tiny\textsf{CC}}\hss}}%
\end{picture}%
}}%
\hskip -1em%
\href{http://creativecommons.org/licenses/by-sa/3.0/}%
{\ \hskip 1em \textsf{BY-SA}}%
}Update: thanks are due to Mike for pointing out my use of an externally defined term, which I thought was in base/latex.ltx but was actually defined elsewhere.
18 February 2009
CC license
05 February 2009
MCNP syntax highlighting in vim
This syntax highlighter for MCNP in VIM is due to Giacomo Grasso. The file on his page is inaccessible other than through the white paper, so I have taken the liberty of extracting it and putting into a file available for download. Put it inside the ~/.vim/syntax folder.
There's no easy sure-fire way of detecting an MCNP input file, but if you create a file at ~/.vim/scripts.vim with the contents
if did_filetype() " filetype already set.. finish " ..don't do these checks endif if getline(2) =~ '^C.*\<mcnp\>\c' setfiletype imcnp endif
it will load the MCNP syntax coloring if the second line of your input deck is a comment (the first letter of the line is a 'c') with the word MCNP in it somewhere.
28 January 2009
Return of the "pickup notice"
19 January 2009
Vim/TeXShop integration
I like to edit my LaTeX documents in vim (with the VIM-LaTeX package), but for various reasons, I like to use TeXShop to actually compile and view the document. In TeXShop, make sure that the "Configure for External Editor" button is checked, and then quit it. Once you add the following lines to your ~/.vim/ftplugin/tex.vim file, you just have to hit Cmd-R for the document to automatically open in TeXShop, and compile. You can use everything else just as you would expect. It really works great.
function! SRJ_runLatex()
if &ft != 'tex'
echo "calling srj_runLatex from a non-tex file"
return ''
end
"write the file
:w
let thePath = getcwd() . '/'. expand("%")
let execString = 'osascript -e "tell app \"TeXShop\"" -e "set theDoc to open ((POSIX file \"'.thePath.'\") as alias)" -e "tell theDoc to latexinteractive" -e "end tell"'
exec 'silent! !'.execString
return ''
endfunction
no <expr> <D-r> SRJ_runLatex()
vn <expr> <D-r> SRJ_runLatex()
ino <expr> <D-r> SRJ_runLatex()
The <D-r> means that hitting Command-R will save and compile it. You can change it in the syntax of any of the other vim command shortcuts.
EDIT 3/24/2009: To make it compatible with 10.4, since apparently the "open" command does not return the opened document as it does in 10.5, change the osascript line to:
let execString = 'osascript -e "tell app \"TeXShop\"" -e "set theDoc to open ((POSIX file \"'.thePath.'\") as alias)" -e "try" -e "tell theDoc to latexinteractive" -e "on error" -e "set theDoc to front document" -e "tell theDoc to latexinteractive" -e "end try" -e "end tell"'UPDATE 9/25/2011: I've switched from using TeXShop to Skim. See my new Vim-LaTeX/Skim scripts here
15 January 2009
Insolation pt. 2

UPDATE This actually seems to give the wrong values, according to here and here. Maybe the NASA calculations are weighted differently than they say, or I'm misunderstanding what they mean. Either way, ignore this plot and use the values shown by those links.
14 January 2009
Insolation
Ever since moving up north and noting how low the sun is in the sky and how short are the days during winter, I've wondered about how much actual energy gets dumped onto a unit area on the surface of the earth.
After googling all sorts of permutations on "day integrated solar flux" and similar terms, I stumbled upon the more accurate term of insolation (which, after the fact, I remembered having heard through science bowl). Searching around some more resulted in this factual page, and further searching led me to a NASA page with all sorts of useful information. Based on values from one of NASA's programs, which takes into account most of the important stuff, here is a plot of the solar intensity as a function of the days of the year:

It's no wonder it feels dark and cold here in the winter. A similar plot of the average solar angle shows how the sun is always lower in the sky here, too.
Of course, the plot does not include the extra atmospheric attenuation from the sun coming in at lower angles. (The same thickness of clouds will require sunlight to travel further as a result.) That gives Ann Arbor and the other northern places an even more severe disadvantage.
Incidentally, the MATLAB code to display the months (where the x axis data is stored as days) is:
monthlengths = [0 31 28 31 30 31 30 31 31 30 31 30];
months = {'J' 'F' 'M' 'A' 'M' 'J' 'J' 'A' 'S' 'O' 'N' 'D'};
set(gca,'XTick',cumsum(monthlengths));
set(gca,'XTickLabel',months);and I created the graphic with the same script I posted about earlier.
10 December 2008
A lot of effort went into this
22 October 2008
14 October 2008
Trilinos on the mac
./configure \
--cache-file=config.cache \
--prefix=/usr/local/trilinos-8.0.8-serial \
CC=/usr/bin/gcc CXX=/usr/bin/g++ F77=/usr/local/bin/gfortran \
--with-libs="-framework vecLib" \
--with-ldflags="-Wl,-multiply_defined -Wl,suppress" \
--enable-amesos \
--enable-epetra \
--enable-anasazi \
--enable-aztecoo \
--enable-examples \
--enable-didasko \
--enable-teuchos \
--enable-triutils \
--enable-galeri
I believe that the only software needed to get this to work is the gfortran compiler available at the mac High Performance Computing site.
I found that the with-ldflags line was necessary because otherwise the "pow" check would die from "Undefined symbols: "___gxx_personality_v0", referenced from: __gxx_personality_v0$non_lazy_ptr in ccJ9fzb2.o".
To get a trilinos-base program to compile, run g++ with the Apple compiler with options "-framework vecLib -I/usr/local/trilinos-8.0.8-serial/include -L/usr/local/trilinos-8.0.8-serial/" with the libraries (e.g. "-lepetra").
08 October 2008
Word movement in terminal
Also, this inputrc modification (which makes the up arrow complete to the last occurrence of everything before the cursor) is even better than ctrl-r reverse search.