A-  A  A+ RSS Feed

Deep Thoughts by Robert Felty

thoughts on wordpress, latex, cooking et alia

Archive for 2008

Tuesday, December 9th, 2008

Collapsing updates galore

I’ve been working a lot lately on some major rewrites to all 4 of the collapsing X wordpress plugins I have written. All 4 of them now have the following features:

  1. All use the same javascript file, which will only get loaded once, in case you use more than 1 of the plugins
  2. No longer use external css files. Instead, the css styling is set through an option, which should be easier to configure, and also reduces http requests, speeding page load time
  3. The inline javascript portions have been moved to the footer, to improve load time
  4. Default options are now added to the database upon installation, which solves a problem that existed when trying to use them manually

In addition, Collapsing Links and Collapsing Pages can now be used as either a widget or manually.

All of these updates are available in the development version of each of the respective download locations on the wordpress plugin repository. I am leaving them in the development version for a little while, in the hopes that some users will test them out, and I can fix some bugs before releasing them as a new version.

There is one caveat: I have been doing some testing with WP 2.7beta, and after many hours of frustration today, I never did figure out why the widgets were not showing up after adding them to the sidebar and saving. I did discover though, that if you select “show unused widgets”, then add them, that they get added just fine. If anyone has any hint on why this would be the case, and how to get them to work completely right under 2.7, I would be very happy indeed.

Thursday, December 4th, 2008

LaTeX utility scripts

Processing a LaTeX file usually takes several steps. At a bare minimum, it usually requires 2 runs through latex (or pdflatex). Two runs are necessary in order to get cross-references and the table of contents right. Since LaTeX processes a page at a time, it can’t generate a table of contents on page 1 until it knows what sections, subsections etc. are in the rest of the file. That is what the .aux file is. Then on the second run, LaTeX reads that info from the .aux file. If you are running bibtex, or making an index, there are additional programs to run. Typing this from the command line (or even hitting the compile button from a GUI like TeXshop) can be tedious. I know that many people use Makefiles to achieve this task. However, as far as I know, Makefiles are specific to a particular project. That is, for every new LaTeX project, you have to create a new Makefile. Instead, I use bash scripts. This allows me to specify a filename on the command line, and I also get some more flexibility from the power of bash. I choose bash for this task, since it is mostly just stringing together commands I would perform on the command line anyways. It is also installed on most any linux machine, and on Mac OSX. (Sorry windows users, (unless you use cygwin)).

I have several different scripts, depending on what I am doing.

Traditional LaTeX

#!/bin/bash
# this script processes a latex file.
DVIPS=dvips
PDF=ps2pdf
PROG=latex
SEED=`echo $1 | cut -f1 -d"."`
$PROG --shell-escape -interaction=batchmode $SEED &&
(if [ -e ${SEED}.idx ]; then
  makeindex $SEED
fi) &&
(if [ $(grep bibdata ${SEED}.aux) ]; then
  bibtex $SEED &&
  $PROG --shell-escape -interaction=batchmode $SEED &&
  $PROG --shell-escape -interaction=batchmode $SEED
fi) &&
$PROG --shell-escape -interaction=batchmode $SEED &&
$DVIPS $SEED.dvi -t letter -Ppdf -o $SEED.ps &&
$PDF $SEED.ps &&
echo "*****************************
  SUCCESSFULLY PROCESSED $SEED
*****************************"
||
echo "*****************************
  PARSING PROBLEM with $SEED. run $PROG manually to see errors
*****************************"

For pdflatex

#!/bin/bash
PROG=pdflatex
SEED=`echo $1 | cut -f1 -d"."`
$PROG --shell-escape -interaction=batchmode $SEED &&
(if [ -e ${SEED}.idx ]; then
  makeindex $SEED
fi) &&
(if [ $(grep bibdata ${SEED}.aux) ]; then
  bibtex $SEED &&
  $PROG --shell-escape -interaction=batchmode $SEED &&
  $PROG --shell-escape -interaction=batchmode $SEED
fi) &&
$PROG --shell-escape -interaction=batchmode $SEED &&
echo "*****************************
  SUCCESSFULLY PROCESSED $SEED
*****************************"
||
echo "*****************************
  PARSING PROBLEM with $SEED. run $PROG manually to see errors
*****************************"

You can run the scripts like so:

pdftexit myfile.tex

The .tex is optional. In fact you could use .pdf, or nothing. The extension gets stripped off. Note that as it is currently written, if you have a file like 2008.04.11.tex, it will break, since it splits by period, and only takes the first part. A way around this would be to use basename instead, but that would not work for files named anything other than .tex.

Also note that I suppress most of latex’s output by using the -interaction=batchmode option. By default LaTeX prints out quite a bit of information, and printing to the screen can really slow things down. If something goes wrong, then you can always run it once manually. The script will detect if something goes wrong and tell you.

I hope you find the scripts useful. For convenience, here is zip file with both bash scripts.

Thursday, December 4th, 2008

wordpress, mediarss, and friendfeed

thanksgiving collage
thanksgiving collage

This is mostly a test feed to see if this works. Daniel Pritchett modified the media rss wordpress plugin to get it to work with friendfeed. You can get the code here. It seems like it just adds a thumbnail attribute to a media tag. By “working with friendfeed”, I mean that friendfeed will automatically include pictures in your feed from your blog. I’ll try my thanksgiving collage picture one more time, since I like it so much.

Thursday, December 4th, 2008

Picasa 3 collages

thanksgiving collage
thanksgiving collage

I upgraded to Picasa 3 a couple weeks ago. I didn’t upgrade right away, because it took awhile for the linux version to come out. I can happily say that Picasa 3 works great under linux from my experience. It was easy to install (they had an rpm available), and it runs very nicely. It seems like it even runs a bit faster than Picasa 2.6. But best of all, it has some really cool new features. One such feature is the ability to make collages. There was some rudimentary collage-making features in Picasa 2, but Picasa 3 adds lots of functionality. I decided to try it out recently with some pictures I took at Thanksgiving. I would say that my only complaint so far is that captions only seem to show up when you format the pictures as “polaroids”. It seems to be that if you include a white border, the caption should show up there. This was particularly frustrating because I had “show captions” box checked, but no captions were showing up.

I’ll also admit that part of the reason I wanted to write this post was because I just learned about mediarss, which is a way to include images, sound clips, and video clips in rss feeds. A quick google search for a wordpress plugin resulted in the media rss wordpress plugin, which seems to be working. Now the only other question is whether or not it correctly shows up in my friendfeed.

Wednesday, December 3rd, 2008

potato pancakes

potato pancakes
leftover mashed potatoes make for tasty potato pancakes

Last Thursday we had Thanksgiving dinner at my house, which was a lot of fun (pictures are on the fedibblety blog. Afterwards, I was left with a lot of leftovers, including lots of mashed potatoes. We had made 10 pounds worth, which was probably too much. I was also left with some milk and 10 out of 12 eggs. I had bought milk and eggs just for thanksgiving. I don’t normally eat them, but I figured other people would. Clare, the big egg eater, is currently taking a hiatus, so I ended up with a bunch of eggs leftover. Instead of wasting the eggs and milk by throwing them away, I decided to try to make potato pancakes. I simply mixed together one egg, about a half cup of milk, 3 cups of mashed potatoes, and about a 1/4 cup of flour and fried it up. It is very quick and easy.

potato pancakes up close
potato pancakes up close

I have to admit that I made one attempt with just the mashed potatoes, and that didn’t work out very well. They wouldn’t stick together. So if you have leftover mashed potatoes, give it a try.