Archive for the ‘Technology and Computers’ Category

I recently got a new computer and decided to set up Mutt locally on it. Here’s how to get to reading mail with Mutt in a way that supports HTML and multi-byte character sets. This is not a perfect HOWTO (especially in the mutt ./configure section), but should get you most of the way there.


Use Darwin Ports

  • sudo port install rxvt-unicode
  • sudo port install tokyocabinet (if you’re going to talk to an IMAP host and want to cache the data, you need a db to cache into)
  • sudo port install w3m (for displaying HTML mail)

Set up your shell to help mutt with multibyte

export LC_CTYPE="en_US.ISO-8859-1"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib  

Build the source, don’t use port here

  • Download mutt source (developer branch to get SMTP support, header caching, i.e. the good stuff)
  • *
./configure --prefix=/opt/local 
--enable-imap --enable-smtp --enable-hcache 
--with-tokyocabinet=/opt/local/ 
--with-curses=/opt/local/include/ncursesw/ --with-regex
  • That means: target to install in /opt/local/bin, enable IMAP and SMTP support, enable IMAP header caching using the tokyocabinet libraries, use the wide Ncurses library so that we can show fancy characters in the terminal, and add regex support
  • make && sudo make install

Make mutt take advantage of your configuration

set folder= {mailserver}INBOX # where i keep my mailboxes
set spoolfile={mailserver}INBOX # where my new mail is located
set imap_user=me # your user id
header_cache=$HOME/.muttconfig/.cache
set smtp_url="smtp://smtp.server"
auto_view text/html

Configure your .mailcap so that you automatically view HTML mail properly

# HTML
text/html;      w3m -I %{charset} -dump %s; nametemplate=%s.html; copiousoutput

## Images
image/jpeg;     open %s; nametemplate=%s.jpg; copiousoutput
image/png;      open %s; nametemplate=%s.png; copiousoutput
image/gif;      open %s; nametemplate=%s.gif; copiousoutput
image/bmp;      open %s; nametemplate=%s.bmp; copiousoutput

# PDF
application/pdf; open %s pdf

HTML email rendered sensibly

Speaking of Grand Yak Shaves

Monday, February 9th, 2009

Donald Knuth started writing The Art of Computer Programming and along the way decided that technical publishers didn’t know what they were doing. Knuth’s yak-shave?

Writing TeX: A 10 year yak shave that has produced the most elegant typesetting language ever.

A fabulous link between the science of this book, art, and symbolic systems: http://www.npr.org/templates/story/story.php?storyId=4532247

Unlikely Phrases in the Recording:

  • Bar Coding
  • Arabic Language
  • Algebra
  • Samuel Johnson
  • Betsy Ross
  • God
  • Wastebasket

As many of you may know I’ve been writing a lot. I mean a lot lately. One of the great things about being a humanities guy who knows high tech is that you know better ways than “email my gmail account a backup copy of this document that’s leeching my soul” to handle version control.

I used subversion.

A few weeks into my first project I became really aware of git, Linus Torvalds’ distributed version control system. My friends, the times that “getting interested in a new technology” has turned my KISS project into a monumental yak-shave is beyond count, so I resisted git. I even complained of people hassling me to shave that Yak.

Like Stimpy, people kept taunting me with the red, jolly, candy-like button of git.


History Eraser Button (Ren and Stimpy) - Free videos are just a click away

In the middle of this, I found the PDF version of Travis Swicegood’s Pragmatic Version Control Using Git. I decided that instead of a massive yak-shave, trying to piece together bits of web wisdom and screencasts, I would go a chapter a day on Travis’ book.

So, each day I scribbled notes from a chapter in my Moleskine:

Git Moleskine

Until I finished. Well, I’ll be humdingered if Travis’ book didn’t teach me git. I have to admit I was really scared by commands named “rebase” and flags like “—hard” (sounds permanent, you know?). Travis really focuses on the important parts of git:

  1. Git is a distributed version control. This means you have the entire history versus the latest instance, like in Subversion
  2. Git loves branches. Branches are great because they let you try things, foo-up fast, and then move on
  3. When a branch becomes más macho, you may want to move it into the base. Instead of merging all those changes in, move in the finished product, that’s rebase.
  4. Merging, by the way is like a staggered rebase
  5. Remotes are like virtual branches, you can merge them into your local stuff.

There’s some subtleties around this, but walking out with these understandings, the basics of branch, commit, and clone really got me plenty far. I even set up a github project for Latin + LaTeX + Textmate utilities.

Travis also uses github to give you your “work at home” directories. That means if a chapter feels familiar to you, you can skim it until you feel like you want to work along. When you wish to do that, simply check out the code for that chapter and follow along. I like that the book is flexible and allows you to map your level of expertise in.

Personally, I didn’t miss the paper version (mostly because i make notes anyway) so having the PDF was sufficient. It’s definitely a good book at a reasonable price.

So, while I will certainly concede that Travis’ book is a yak shave opportunity, it’s a pretty tiny yak. Take it a chapter (< 1 hour to read each one) at a time and you’ll have a really great, new tool under your fingers in no time.

Behind on coder chic

Friday, January 16th, 2009

It took me forever to get into SCM and I’m really loving Subversion.

…but now there’s git by non other than The Finnish Father of Linux himself. And boy, the world is crazy for it. And github, a place for sharing ideas is certainly in the running to get all sorts of kudos as the greatest addition to the programming world since sliced bread.

But here I am, writing essays for grad school ( and putting the revisions in SCM ), and writing code to impress review boards ( and putting the revisions in SCM )….so, until March, I think that I’ll be out on git’s pseudo-profane “fork yourself” jokes and stuck in that horrid, horrid land of “svn ci -m ‘this, that the other’”

Inbox Zero

Tuesday, November 11th, 2008

I’m very happy to report that I have put my inboxes ( Personal1, Personal2, GMail, etc. to 0 messages). I believe that an empty inbox is a key to sanity, especially for those who live and die by the e-mail sword.

For anything that comes in any inbox I either:

  • Reply / take an action
  • Delete it
  • Archive it for reference

With just these simple three techniques and a few extra folders on my hard disk, I was able to empty all the existing mail in my inbox.

Now, I will certainly get more mail in the future, so how am I going to handle it? I will apply those three simple rules above.

I have added one more technology to help with a certain class of mail that I call “Moderate interest, low involvement” (MILI)1 mail. MILI mail examples are, updates from facebook, reminders from my credit card companies, notifications from the service department for my car, etc.

Traditionally, being a bit of mail guru, I have handled this by using filters, Procmail, senmail, perl, etc. Instead of managing the filtration ruleset, I’ve now “offloaded” that work to OtherInbox. It’s a utility whose handiness scales, at the very least, linearly the more addresses you have.

Here’s a video explanation of Otherinbox.

With my MILI mail gone, all I have to do is handle the thin remainder with my three techniques ( adapted from David Allen’s GTD methodolgy).

If you follow @otherinbox on Twitter, you may get a beta invite. Alternatively, mail me at otherinboxinvite@sgharms.otherinbox.com for the next 30 days and I’ll try to siphon your name to the beta board and get you an invite.

Footnotes

1 No, there is no VANILLI mail.

LaTeX I always forget

Sunday, September 21st, 2008
renewcommand{labelenumi}{Alph{enumi}.}
renewcommand{labelenumii}{alph{enumii}.}

This is used to define the classes of glyphs you want to use in an outline. In this case, the top-level points will be majuscule, Latin ( no for once I don’t mean the language, but the letter-forms ). The first level sub-set of that will be Latin minuscule. There are a number of classes that are available.

LaTeX recognizes 4 levels of sub-idententation ( thus no labelnumxix ), but 4 is usually sufficient ( yes, I strained to type that, but if it’s not sufficient, odds are you’re not as clear in your thinking as you ought be ).

The renewcommand operator is used to re-define standard operators. newcommand is sufficient for a non-extant operator.

I’m typing this here because I’m tired of visiting Jeff Krimmel’s excellent resource on the matter :)

You can also use

Roman,  alph,  arabic, roman, and Alph as formats

Here’s the one I tend to use, which I would call “traditional.”

\renewcommand{\labelenumi}{\Roman{enumi}.}
\renewcommand{\labelenumii}{\Alph{enumii}.}
\renewcommand{\labelenumiii}{\arabic{enumiii}.}
\renewcommand{\labelenumiv}{\alph{enumiv}.}

Define new commands that take arguments

Sometimes you want to create a new command, here’s how to do it. Here was a command i wrote that produced small-caps-ified large text:

\newcommand{\verbatimTask}[1]{begin{sc}begin{large}{{#1}}end{large}end{sc}}

I modeled this off of devdaily.com

Adding new styles

If you need to add a new style, on my system, you do it in:

/usr/local/texlive/texmf-local/tex/latex

You add your style there. Subsequently, you need to execute “texhash” to rebuild the database so that you can use it.

Thereafter, by using

\usepackage{packagename}

Will allow you access to your commands.

Inter-linear spacing

To doublespace a LaTeX document, you should include the line

    \usepackage{setspace}

after your \documentclass line.

Before your \begin{document} command,

\doublespacing

will make the text of the whole document doublespaced. Footnotes, figures, and tables will still be singlespaced, however. For one-and-a-half spacing, instead use the command

\onehalfspacing

In order to make a part of the text of your document singlespaced, you can put:

\begin{singlespace}

at the beginning of the text you want singlespaced, and

\end{singlespace}

at the end.

You can also set the spacing to be something other than doublespaced; for example, if you wanted to have one-and-a-quarter spacing between lines, use the line

\setstretch{1.25}

before your \begin{document} command, and after the \usepackage{setspace} line.

(NOTE: there is another package, called “doublespace” which will usually work exactly the same way as setspace. However, it interacts poorly with some graphics packages.)

From MIT

Yes, I’m still a DVORAK user

Thursday, August 28th, 2008

Yet again research shows that typing comme moi nets benefits.

Discover Magazine on Dvorak keyboards

Tw00t

Friday, August 22nd, 2008

Against much better judgment Lauren has explained that she does not any longer want to be my API for interfacing with Twitter:

Steven: Hey did you know Lambie is in the panel picker for SXSW
Lauren: Yes. He sent a twitter note about it….etc.

Today I join, under a great curmudgeonly cloud. Upside, I’ll be much more in the know about parties during SXSW, so, yay.

http://twitter.com/sgharms

Information Shadows

Thursday, August 21st, 2008

I found this presentation on information shadows by Mike Kuniavsky via Daniel’s site. Given my interest in Symbolic Systems, it really hit a sweet spot. Here’s a short abstract:

My presentation, called Information Shadows: How ubiquitous computing serializes everyday things (1.2MB PDF) is my attempt at showing how ubiquitous computing technology is, in essence, turning whole classes of everyday objects into serials, or services, by creating pervasive digital access to the objects’ metainformation, their information shadows. In the process, I talk about blenders, timeshares, Cuddle Chimps, City Carshare, and Exactitudes. I think it’s a fun talk, and I’m really happy to have had the opportunity to articulate these ideas in this forum.

Source

Around the 3rd section I lost the flow of the argument, so I wrote out this précis to try to help me keep the ideas straight. If, after seeing the original, you want to see an attempt at condensing the material read on.

(more…)

In an earlier post I provided code demonstrating my “functional” Perl idiom. The purpose of that code was to take a very simply formatted text file and to turn it into LaTeX Beamer formatting.

Well, recently I found the application iFlipr. In addition to being a site where you can upload flash cards, it also has an iTouch / iPhone version so that you can review when you’re in the bus, in a waiting room, etc.

So, I needed some code to transform my generic data set into–not LaTex–but iFlipr format. With but the most trivial of changes, I was able to accomplish this. The high readability of “functional” Perl made this, literally, a 3 minute affair.

Here’s the diff:

56c56
<               &produce_beamer_body(
—-
>               &produce_iflipr_body(

81c81
< sub produce_beamer_body
—-
> sub produce_iflipr_body

83c83
<       (my $latex_output_file = $_[0]->{file} ) =~ s/..*$// ;
—-
>       (my $iflipr_output_file = $_[0]->{file} ) =~ s/..*$// ;

85,93c85,86
<       open (LATEX, ">$latex_output_file.tex");
<      
<       # A technique to tell Perl not to paginate
<       # ( i.e. re-print LATEX_TOP format ) again
<      
<       my $ltx = select LATEX;
<       $= = 9990;
<       select $ltx;
<      
—-
>       open (IFLIPR, ">$iflipr_output_file.iflipr.txt");

>              
96,97c89
<       my @order = sort { $a  <=> $b } ( keys ( %$ds ) );
<       for ( @order )
—-
>       for ( keys %$ds )

100,103c92,93
<               $part    = $ds->{$_}[1];
<               $meaning = $ds->{$_}[2];
<               chomp($word, $part, $meaning);
<               write (LATEX);
—-
>               $meaning = $ds->{$_}[2];       

>               print IFLIPR "$word\t$meaning\n";
105,107c95,96
<
<       print LATEX $end_of_document;
<       close LATEX;
—-
>       

>       close IFLIPR;

If you’ve not thought about writing code in this fashion, I hope this entices you! Either that or we should all take up Haskell or Lisp “Lisp (programming language) - Wikipedia, the free encyclopedia”)