BrunoJ

Entries from July 2007

Troll View

July 31, 2007 · Leave a Comment

Troll View, originally uploaded by brunoj.

A shot from underneath the Twyckenham bridge in South Bend.

Categories: photography

To Read

July 23, 2007 · Leave a Comment

  1. Spook Country, William Gibson. Ashamedly, I only realized that Gibson had written a new book when I was looking to buy Warren Ellis’ book below on Amazon and the wily amazon computer suggested I buy THIS and THIS to get a discount. Stupid computers.. making me look bad.
  2. Crooked Little Vein, Warren Ellis. I love Nextwave, among other Warren Ellis projects. I also like mysteries, just like most old ladies I know.

Categories: books

Beach Running

July 22, 2007 · Leave a Comment

I just got back from a week in South Western Michigan. My favorite run of the week is the beach to beach run depicted below:

beach run

Here is the Gmaps-pedometer [link].

It starts with a 1.5 mile leg along the beach ending at the North pier in South Haven. It then meanders along the marina, over the drawbridge, through town, and out to South Beach. I highly recommend it, although the beach running part is hard on the ankles because of the lake-ward incline.

Note that Google Maps (and hence Gmaps-pedometer now have USGS topographical maps available).

Categories: running

Producing high quality EPS and PDF diagrams for mathematics

July 12, 2007 · 6 Comments

I’ve been thinking over the course of the last 6 months or so about the best way to produce EPS and PDF diagrams for inclusion in mathematical documents typeset using LaTeX or pdfLaTeX.

There are many options and many pieces of software, both free and non-free, for doing this. I want to explain the method I settled on as the “best” after trying many different approaches.

I have some requirements: The method must

  1. produce high quality vector based EPS or PDF diagrams (not raster images),
  2. produce output suitable for inclusion in LaTeX documents which are typeset using pdfLaTeX (so they should be PDF files or EPS files if you include the right package \usepackage{epstopdf} ?). Also this means that the ‘psfrag’ method is ruled out since this doesn’t work under pdfLaTeX,
  3. allow for complex diagrams to be produced using a GUI (as opposed to ‘pstricks’ or ‘xy’),
  4. allow LaTeX fonts, symbols, macros to be used for labels in the diagram,
  5. be cross platform (running under linux and Mac OS X at least).

Here is a partial list of software that I tried at some point in the last 6 months while engaged in a project that required many diagrams to be produced.

  1. xfig / jfig
  2. Inkscape
  3. pstricks package and the graphical editor for it: latexDraw
  4. xy package
  5. Adobe Illustrator
  6. psfrag
  7. fragmaster‘ script for getting psfrag functionality in standalone diagrams (see also ‘pdfrack‘)

To cut to the chase, here is the procedure I settled on. It uses GUI drawing program in combination with the ‘fragmaster’ script listed above to get PSFRAG-like functionality in a standalone diagram which can then be converted to PDF and included in a LaTeX document.

  1. Using Inkscape or xfig/jfig, produce the diagram. Insert key-letters or keywords where you want LaTeX typeset labels to appear. For instance you could put an ‘a’ where you want \alpha^5 to appear. For example:

    inkscape.png

  2. Save the diagram as an EPS file using the following pattern for the filename: filename_fm.eps . The ‘_fm.eps’ ending is for the fragmaster script. Make sure not to convert text to paths when saving. This is the default in Inkscape for example when saving as EPS and there is a dialog which asks about this after you hit ’save’.
  3. Next we’re going to use the ‘fragmaster’ script, which you can download here: [link]. You need perl installed to run the script, test by running
    perl -v in a terminal. This script runs with no arguments. It expects two files:

    • filename_fm.eps
    • filename_fm

    and leaves as output the file ‘filename.eps’. The ‘filename_fm’ file contains a dictionary which translates the key-letter/keywords from step 1 into LaTeX code. For the example in step 1 I have the following content in ‘filename_fm’:

    % Just an ordinary comment
    %
    % A special comment:
    % fmopt: width=10cm
    %
    % Another special comment:
    % head:
    % \usepackage{amsmath}
    % \usepackage{amsfonts}
    % end head
    \psfrag{beta}[Bc]{$\beta(3)$}
    \psfrag{cdb}[Bc]{$\mathbb{D}_{10 \times 8}(\widetilde{\beta(3)})$}

    The commented lines following ’special comment’ are important. They set parameters which LaTeX uses to type set the labels which appear in the ‘\psfrag’ commands. There are three arguments passed to the ‘\psfrag’ command: 1st is the keyword that appears in your EPS diagram that you want to replace with some typeset labels, 2nd is a positioning setting (see the psfrag documentation for more details), and 3rd is the LaTeX code for the label.
    All that remains is to run the script: (assuming the two files above and the fragmaster.pl script are in the same directory)

    ./fragmaster.pl

    Note: You probably need to make fragmaster.pl executable before hand: chmod a+x fragmaster.pl or else run it through perl: perl fragmaster.pl .

  4. Now you’ve produced an EPS file called ‘filename.eps’. There is one more (sometimes necessary, sometimes not) step before we have a finished EPS diagram. If your labels occur on the outskirts of the diagram (for instance at the bottom of the diagram in the example of step 1) it can happen that they are partially cut-off by the bounding box of the EPS file. WHen you save your EPS file in the drawing program, the bounding box is set to be just large enough to contain all visible elements. However, when the keyword labels are replaced with LaTeX typeset labels, they may be larger than the keywords and fall outside the original bounding box. One solution to this is the following: enlarge the bounding box by hand. Here’s what I do:
    • edit ‘filename.eps’ using ‘vi’ or whatever text editor you like.
    • at the begining of the file you see lines such as the following:


      %!PS-Adobe-2.0 EPSF-2.0
      %%Creator: dvips(k) 5.96 Copyright 2005 Radical Eye Software
      %%Title: fm.dvi
      %%CreationDate: Thu Jul 12 09:15:33 2007
      %%BoundingBox: 0 642 284 792
      %%DocumentFonts: CMR12 CMMI12 MSBM10 CMR8 CMSY8 CMEX10
      %%EndComments

      The important line is the one starting with %%BoundingBox: . The 4 numbers which follow this define the bounding box for the contents of the EPS file. The first two numbers are (x,y) coordinates for the lower-left corner of the diagram and the second two numbers are coordinates for the upper-right corner. To enlarge the bounding box slightly lets subtract 10 from each of the 1st two numbers and add 10 to each of the last two numbers:

      %%BoundingBox: -10 632 294 802

      Negative values are perfectly fine.

  5. Now you should have a beautiful EPS diagram with LaTeX typeset labels:

    after fragmaster

    Now, to produce a PDF file for inclusion in a document which is typeset using pdfLaTeX you can simply run the ‘epstopdf’ command: epstopdf filename.eps

  6. Sometimes the labels don’t appear in quite the right position after running fragmaster. One option is to go back to the drawing program and adjust the position of the keywords slightly to compensate, save as EPS to ‘filename_fm.eps’, re-run fragmaster, and re-enlarge the bounding box. Another option is to change the positioning arguments to the ‘\psfrag’ commands in the ‘filename_fm’ control file and re-run fragmaster, etc. It usually takes me a couple of runs to get everything perfectly aligned and looking good.

Update 9-22-09: Changed the link to Fragmaster since Vogel’s old homepage no longer exists. The new link points to ctan.org

Categories: computers · latex · math

Recovering a hacked server

July 11, 2007 · Leave a Comment

The computer I keep in my office for use as a web / subversion / backup server was compromised recently. I don’t know when for sure or how. Here is the procedure I followed recovering the machine. It is mainly for future reference.

Machine:

  • calamity.domain.suppressed.edu
  • Ubuntu 7.04 (Feisty Fawn) w/ updates current to 7/2/07

Details of Intrusion:

  • Complaints of (guestbook / comment) spam pointing to calamity:8082/d_special/xanax.html
  • None of the files, directories, filenames that appear in any of them spam appear in the filesystem so these must be kept in memory by whatever process is serving them.
  • Several other computers on the internet can be found using google which appear to have been compromised in the same way (i.e. they are serving the same exact pages from the same ports, etc).

Resources:

Steps:

  1. Removed from network and powered off. I know this isn’t what you are supposed to do since there may be processes running which would identify the method of break-in and type of attack. However, I was pressured to re-build the machine by the IT people who happened to drop by my office and I didn’t have time right then. Plus I’ve got important data on the machine that I didn’t want tampered with or destroyed. Powering the machine off seemed like the best idea at the time.
  2. (few days later) Powered on the machine (still detached from the network).
  3. Checked /var/log for anything I could find. Came up blank, except for alot of (apparently) unsuccessful break-in attempts through ssh.
  4. Ran rootkit detectors rkhunter and chkrootkit. Neither one found anything useful. I think setting up something like tripwire will be a good idea after the machine is rebuilt.
  5. Booted a Live CD version of Ubuntu 6.10, made backups of all important data to an external hard drive:
    • user directories
    • webserver files
    • subversion server files
    • mysql databases
    • Misc. config files and logs: /etc, /boot/grub, /var/log,
    • Mail in /var/mail
  6. Installed Ubuntu 7.04 from disk after formatting the main disk
  7. Ran the updates
  8. Installed extra software:
    • emacs
    • openssh-server
    • inkscape
    • apache2
    • subversion
    • tripwire (to verify system integrity)
    • snort (basic intrusion detection)
    • firestarter (firewall configurator)
  9. Thought about installing the ‘grsecurity‘ package, but it requires patching and compiling a kernel. I’ll save this for later.
  10. TODO:

Categories: computers · howto · linux · technical

Schwinn, 1967

July 1, 2007 · 2 Comments

Sketch of Schwinn, 1967 and Cart

When my road bike is in the shop, like this week, I ride my beater bike. Its a 1967 Schwinn (Delux Racer, I think). I love this bike. It can take a real beating and looks none the worse.
(more…)

Categories: bikes · photography