≡ Menu

Using Dropbox and Git to write LaTeX papers

First things first — Dropbox is awesome. (Also, if you signup through that link, we both get extra free space… so do it). It’s a service that syncs a folder on your computer with a central server — and any other computers you have Dropbox installed on. But it does much more than that — you can share subfolders with other Dropbox users. For example, if I want to give my roommate a directory full of PDFs, I can just drag the directory into our shared folder, and Dropbox will automatically sync it so that he gets all the files without doing anything. Also, the files are on your computer — so if you lose internet or are on an airplane, you interact w/ the files just like any others on your computer.

Writing anything with LaTeX can be a trying experience. Writing an academic paper with multiple authors in LaTeX can be especially tricky. Dropbox comes in handy — but so does being able to use version control to track who changed what and when. Since Dropbox syncs files (and keeps a record of how the file looked in the past) it can sorta do the version control thing on its own.

Let’s just say you have the desire to use git (the fast version control system).

EDIT 1: Hannes (comment below) has warned that this is probably a bad way of doing these things.

Instead of Dropbox, use something like github to sync git repositories.

One trick I’ve found handy is to write LaTeX papers with each sentence on a new line — rather than putting returns on some number of characters. This way, diff and version control finds changes between sentences instead of just lines, which makes everything much easier to understand.

EDIT 2: Lelio (comment below) has suggested that this trick is unnecessary, instead use: git diff –word-diff. I haven’t tried it yet, but it seems reasonable enough to mention in the post itself.

I wanted for git to ignore a number of the helper files that get created when compiling LaTeX and found a useful repository of gitignore flags here. (Read the gitignore manual page here).

Easy enough to setup — I put it in my home directory, so keep that in mind if you put it somewhere else — so I did the following:

git clone git://github.com/github/gitignore.git

Now, I was actually confused about what to do at this point. After playing around with it for a while, I ended up making a bash script that keeps the git-ignore repository updated and referenced for my laptop. You can find the bash script here.

bash ~/Dropbox/scripts/git/gitignore.bash

Assuming you have my bash script in that location, that should create the .gitignore in your home directory. Next, you have to tell git that you want it to use the .gitignore file that the bash script created at ~/.gitignore for everything.

git config --global core.excludesfile ~/.gitignore

Here’s how I have cobbled together how I work with

On my laptop:

cd ~/Dropbox/Writing/
mkdir New-Project.git
cd New-Project.git
git --bare init
cd Project/location
git init
git add .
git status
git commit -m "First commit"
git remote add dropbox ~/Dropbox/Papers/2011-02-17-Whitmore-KeckCalibration.git
git push dropbox master

On another computer with a Dropbox account:

mkdir Papers; cd Papers/
git clone -o dropbox ~/Dropbox/Papers/2011-02-17-Whitmore-KeckCalibration.git

change some file

git commit -a 
  "First other computer edit"
git push dropbox master

Back on my laptop:

git pull dropbox master

work work work

git push dropbox master

Back on other computer the destination isn’t required:

git pull

work work work

git push

That should do it. If you have a better way of accomplishing the same thing, please let me know, I’m always on the lookout for doing things the right way.


Jonathan plays the piano…

I was messing around and recorded myself playing Gershwin’s Prelude 2 (which is still under copyright, funny enough).

I’ve been meaning to force myself to record and post myself playing piano more frequently in an effort to publicly shame myself into practicing more… It’s only working a little. As always, I welcome constructive criticism!

Enhanced by Zemanta

Making PyMinuit play nice on Ubuntu

Python logo

Image via Wikipedia

I finally have a working python setup on my Ubuntu desktop that has all the bells and whistles that I want at the same time with the same setup.

The python setup I use comes from the Enthought Python Distribution.

System specs:

Ubuntu 10.10 x86 64-bit
Python 2.7.1 |EPD 7.0-1 (64-bit)| (r271:86832, Nov 29 2010, 13:51:37)

I also wanted to have the python wrapper for Minuit, pyminuit, available for use with some code that I’ve written.

Following the installation instructions verbatim for the linux distribution will spew the following errors:

MnUserTransformation.cpp: In constructor 'MnUserTransformation::MnUserTransformation(const std::vector >&, const std::vector >&)':
MnUserTransformation.cpp:30: error: 'sprintf' is not a member of 'std'
make[2]: *** [MnUserTransformation.lo] Error 1
make[2]: Leaving directory `/home/jonathan/Minuit-1_7_9/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jonathan/Minuit-1_7_9'
make: *** [all] Error 2

The way I got it to work

$ sudo apt-get install g++

I also did (but not sure if it was necessary):

$ sudo apt-get install python-dev

The error I talk about above can be fixed by going into the Minuit-1_7_9/src/MnUserTransformation.cpp file and adding to the fifth line:

#include <cstdio>

Just like this well-hidden gem says to do.


After finding where Minuit-1_7_9a.tar.gz downloaded, move it somewhere convenient (or just do what I do):

$ mv Minuit-1_7_9a.tar.gz ~/Minuit-1_7_9a.tar.gz
$ cd ~
$ tar -xvzf Minuit-1_7_9a.tar.gz
$ cd Minuit-1_7_9a

Find where pyminuit-1.1.0.tgz was downloaded

$ tar -xvzf pyminuit-1.1.0.tgz
$ cd pyminuit
$ python setup.py install --with-minuit=/home/[your-username]/Minuit-1_7_9a

Add the following to your .bashrc and you should be set to fly!

$ export LD_LIBRARY_PATH=/home/[your-username]/Minuit-1_7_9a/src/.libs:$LD_LIBRARY_PATH
$ export PATH=/home/[your-username]/epd-7.0-1-rh5-x86_64/bin:$PATH

Hopefully that helped!

Enhanced by Zemanta

My first 10K

Dunes at Death Valley, Ca looking east towards...

Image via Wikipedia

So, my first half marathon turned into my first 10K race: The Death Valley Borax 10K. A few other friends I talked into running came with me and in the end Stephanie and Jeff raced and completed the half marathon, while Kelsey kindly ran the 10K with me.

Death Valley is a beautiful place — and in the early morning in February, it’s a great temperature. I had a great time (as in fun, not finish).

I ran with my Forerunner 305 and I exported the GPS data and used Google Earth to run the same route — so you could enjoy following along!

Enhanced by Zemanta

IDL print header to a file

Here is a snippet to grab the headers of fits files and print them into a real format like ascii.

openw, 1, 'Headers/2011.0101.header'
printf, 1, headfits('Raw/hires0101.fits.gz') 
close, 1

Vaccines, Autism and Paying More

The following is the author's description of t...
Image via Wikipedia

I gladly found the article on cnn.com by Rahul Parikh: Make anti-vaccine parents pay higher premiums. It it written by a physician who advocates making parents who are anti-vaccine pay higher insurance premiums.

The reasons he give are compelling. First of all, not vaccinating your children is not just a danger to the child, but to the larger community. It simply is not the case that only the direct people who don’t get the vaccine who will be put at risk of the disease. Children too young for the vaccine are in particular risk. Take, for example, the fact that Whooping Cough deaths are at the highest level in California since 1950! Second, the choices that parents who refuse vaccinations for their children directly lead to an increase in the cost of healthcare for the rest of society.

It makes me sad to hear the rationalizations that people give for not getting vaccines — they think they are being risk averse by not getting the vaccine. I’m sure there is some cognitive bias in people that makes it difficult to see how taking action is in any way less risky than not taking action… but I would bet that the majority of the parents who are opting out of vaccines have no idea what the risks are.

The last rationalization that I hear is some odd conspiracy theory about how every medical scientist who ever runs a study to find out whether vaccines are dangerous is in the pocket of a company who is paying them to fake or misrepresent the data. All of those scientists whose life work is to study what makes healthy… promoting things they know are unhealthy, for the money. That’d be pretty damn incredible.

Remember kids: get your shots!

Enhanced by Zemanta

My keyboard will do until I get a real piano

Casio PX 130I’ve played classical piano since I was 5 years old. The piano that I love playing the most is at my parent’s house — it’s a Mason & Hamlin grand piano. When I did my undergrad at Vanderbilt, I lived about 150 yards from the music building and had card access 24 hours a day. I could go and play in the practice rooms whenever I wanted. At grad school, I didn’t have such easy access at all, and so for a few years I played intermittently.

Having a piano is not an option at all in my apartment, so the only remaining idea is to purchase a keyboard.

I used to hate — truly hate — playing on a keyboard of any kind. It was like running in the mud rather than on the pavement. I eventually found some very nice and very expensive weighted keyboards, but I never found a weighted keyboard that I could stand both the price and how it felt to play it.

About 10 months ago I finally caved to my mounting need to play the piano and I found that the Casio PX-130 both felt decent enough to play on, and was cheap enough for me to purchase. I’ve been playing on it ever since, and I still like my decision.

Since I live in an apartment, I play with headphones on exclusively, and the sound is fine through headphones. It’s also useful that there’s a second headphone jack which makes it easy to play for another person. The sound if I don’t plug it in is… well it’s loud enough. I don’t play on the keyboard for performing, I play on it for practice and for playing maybe for another person or two.

If you are thinking of buying an electric piano or keyboard for serious classical-style playing, I recommend that you play on what you’re thinking of purchasing first. It’s a subjective thing and you really need to know that you won’t hate playing on it every second.

I think I might record myself playing and post it on YouTube for feedback in the near future… I’m sure they’ll be brutal!

Enhanced by Zemanta

Review of The Thirteenth Tale: A Novel

The Thirteenth TaleI just finished reading The Thirteenth Tale: A Novel by Diane Setterfield.

I think it was a fine book (not great), but I probably wasn’t the intended audience. The book is about a young “bookish” woman who works in her father’s bookstore and occasionally writes obscure historical biographies. A famous and reclusive writer, Vida Winter, contacts her to write her biography. Vida is famous for her writing — and infamous for inventing stories about her own life to reporters and would-be biographers. There are mysteries to solve and ghost sightings to reconcile. They are all dealt with in a satisfactory enough manner, but the whole enterprise comes together in a “just so” fashion that seems too easy.

Spoiler — Don’t read the following if you have not yet read the book.

For example, Vida insists on telling her story the way she wants — and since it’s being consciously crafted, it can contain just-so results. I have no problem with that. The kinds of things that annoyed me are the interactions and subsequent revelations of the entire backstory of every person she meets at the old Angelfield house. Margaret is stomping around the burned out and soon to be demolished Angelfield house when she runs into Aurelius. Who is Aurelius? A giant of a man who is in a constant state of melancholy because he doesn’t know who his parents were — he was a foundling. Turns out he’s the son of Emmeline. The mother and two children who are also seen at the place? Turns out she is Aurelius’s half-sister (though they don’t know this until the end). Any other characters we meet or interact with? Sure, but the characters either have a defined and set role, or they are introduced without a direct role and end up being an integral part of the entire mystery.

Anyway, it’s a fine book, don’t take my criticism as though I think I’ve found fatal flaws.

My rating: 3 out of 5 stars.

Enhanced by Zemanta

Clever Internet Comments

Gaius Julius Caesar, Art History Museum, Vienn...
Image via Wikipedia

On the website reddit.com, there are lots of comments that truly make me happy to be alive. For example, I was reading through the comments on a thread about people being sick of all the attention the Wikileaks story is receiving, and I thought I’d share a few of my favorites.

Sometimes they can be enjoyed in isolation:

TheoreticalFunk: “Don’t believe all the quotes you read on the Internet” – Julius Caesar

PictureofPoritrin: “I am pretty sure I warned you guys allegorically.” – George Orwell

Other times it’s the way the comments build on the previous ones:

theparagon: “No government ought to be without censors & where the press is free, no one ever will.” – Thomas Jefferson, letter to George Washington, September 9, 1792

xtom: “No government ought to be without censors & where the press is free, no one ever will.”
…put some context on that quote and you’ll see he was talking about false political campaigns and claims, not legitimate/factual information.

theparagon: Very good. At least someone caught it. Though I’m not sure you understood my point. People should stop using quotes out of context.

njdfan1241: “People should stop using quotes out of context.” – theparagon, 2010.

Dereliction: “People should stop using quotes.” – the paragon, 2010.

mugwump10: “People should stop.” – theparagon, 2010.

Seaborgium: “People should…(quote) out of context.” – theparagon, 2010.

throwaway2481632: Fox News “People should…(quote) out of context.” – (D) theparagon, 2010. Some people say, an alleged rapist. When asked an opinion on the matter, Sarah Palin quoted that:
This is exactly the sort of thingy-ma-jig that the american people are tired of… big government and taxes should be cut, because jobs are vital to our economy and, hey joe dontchaknow, its all about context. – Sarah Palin

Next up: Biography of a 5 year old beauty pageant winner – we peek into the glamorous lifestyle of Little Miss Gaga

DemonPaladin: “Someone caught … people using context.” – the paragon 2010

wreckemtech: Very good. At least someone . . . understood my . . . quotes” – the paragon, 2010.

There are some clever people out there.

Enhanced by Zemanta

If you like dancing…

How about hand-dancing? Don’t know what I’m talking about? Watch the following, it’ll brighten your day: