28 January 2009

Return of the "pickup notice"

I have gotten one or two of these in the past. This time it was a lot less mysterious. Even though it had a legitimate non-bulk stamp on it, it was labeled with "enroll at www.feinfo.org" and had a sticker that told me to "CHOOSE [MY] GIFT." Among my choices were a "condo stay," an "iPod shuffle," and a "visa gift card." This one was also labeled with a copyright by "NETWORK DIRECT, INC" which is one of these bogus advertising companies. I've heard about these "just show up to a meeting and you'll get a prize" before. They've been around for decades, and you have to resist a salesman's insistent pushes for an hour or more. That doesn't sound pleasant, and I imagine that if it were too good to be true, it probably would be.

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.

" Run LaTeX through TexShop
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

Incidentally, the plot I posted yesterday was only of the intensity averaged over the daylight hours. Multiplying by the hours of daylight (generated with the same program) should give the total amount of solar energy deposition per unit area in a day.
insolation fluence

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

Today's topic is not "insulation," as in "my apartment doesn't have enough insulation to keep me warm in this frigid weather." Rather, insolation is how much sunlight hits the earth's surface.
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:
insolation

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.