With a little side of applesauce...

Friday, November 30, 2007

SHELL - messaging local users

About once a year, I have a need to message local users on the command line. This page has all the information you need to do it:

Sunday, November 25, 2007

emacs/w3m - resources

Here is a list of resources that I have found to be useful in moving
towards an all text-based browser experience, (emacs and w3m, in particular):



Friday, November 23, 2007

bash - variables in aliases

When trying to setup an alias to tar up folders with long names, I
simply wanted something like this:

tar -cf this-is-a-really-long-foldername.tar

I figured that an alias would be the easiest thing to do:

alias taritup="tar -cf ${1}.tar ${1}"

If you add this to your .bashrc and source it, then test it, it
appears to be working, but the tarball never appears... Strange.

The Bash Reference manual says that variables aren't expanded in

There is no mechanism for using arguments in the replacement text, as
in csh. If arguments are needed, a shell function should be used (see
section 3.3 Shell Functions).


But, interestingly enough, I can get positional parameters to
expand... once :P Let's change our example alias above:

alias taritup="tar -cf ${1}.tar ${2}"

Hmmm... Ok, the same thing happens. It appears to be doing
something, but the tarball is not created. Next, try this:

alias taritup="tar -cf x.tar ${1}"

That works... But then:

alias taritup="tar -cf x.tar ${2}"

Fails with the following:

me@mylaptop:~/tmp$ taritup x emacs_autosaves/
tar: x: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors

I haven't followed this through, but obviously we are able to use a
single argument in an alias. My final fix was to use a function, (as

function xtest() { tar -c --exclude CVS -f ${1}.tar ${1}; }

gmail/gnus - how I got it working

I have never gotten anything to work in gnus, so I was pretty excited
when I get my gmail account setup using IMAP. The first step was the
configuration, which I stole from:

That configuration connected me to gmail, and allowed me to read my
email, but then I ran into an issue with sending email. I was using
emacs 21.4.1 on Debian Etch, and found that the version of smtpmail.el
included in emacs21 doesn't handle TLS. After trying to use the
newest version from trunk without any luck, I decided on downloading a
backported version of emacs22 from:

You can get the key by following the instructions here:

emacs22 had the newer version of smptmail.el, and I was able to send
email through smtp.gmail.com. Pretty cool!

Thursday, November 22, 2007

emacs/g-client - need to have curl installed

Though it is found in the instructions page that is downloaded with
the g-client code from trunk:

I didn't realize this until I found it in a post to the g-client
google group:

You need to have curl installed. It is now installed, and this is my
first post to Blogger through EMACS :)

Friday, November 16, 2007

PHP/Smarty - checking if a file exists

I have never worked with smarty templates before, but found this cool tip to allow me to check file_exists("file") within the template itself. I wanted to check to see if a specialmsg.tpl file existed, and display the contents of that file if it existed:

{assign var="specialmsg" value="/location/to/specialmsg.tpl"}
{ if file_exists($specialmsg) }
<td align="right" class="HeadText">&nbsp;</td>
<td valign="top" align="right" class="HeadText">
{include file="specialmsg.tpl"}</td>
<td align="right" class="HeadText">&nbsp;</td>

EDIT: added missing quote as mentioned by CJ.