Soy-maple Glazed Salmon, with Sauted Green Beans, Recipe


  • 2 boneless salmon fillet, serving size (could be a good bit more)
  • Salt + pepper


  • 2 tablespoons maple syrup
  • 1 tablespoons soy sauce + extra for beans
  • 1 tablespoons melted butter
  • 1 tablespoons fresh lime juice
  • 1/2 teaspoon lime zest
  • chopped fresh chives
  • lemon wedges


  • Green beans, enough to serve the number of people eating.
  • 1 tablespoon sesame oil
  • 1 tablespoon vegetable oil
  • 1 tablespoon soy sauce


Remove the tips and stems.  Cut into 3 in. sections.  Blanch them (1 minute or less in boiling water).  This probably takes long enough that you might as well do it before preheating anything.

Preheat the grill for medium-high heat and lightly oil grate (I used the upper rack, but if you don’t have an upper rack, then lower the temperature).  Also preheat your bean pan (cast iron is great, heavy stainless steal is also good, a non-stick pan is bad because they break down at high heat) on high.  This works nicely if you have a cook side burner next to your grill.

Whisk together the maple syrup, soy sauce, butter, lime juice, and lime zest.

Season the salmon fillet with salt and pepper, and put a spoon full of sauce over it to marinate for a few minutes.

Dry beans, then oil lightly with equal parts sesame oil and vegetable oil.  Drizzle with soy sauce.

Place skin-side down on either the upper shelf, or reduce the grill temperature.  Close the lid on the grill for 5 minutes.  Baste the salmon and close again.  While waiting on the salmon, reduce the glaze lightly, until it coats the back of a spoon.  Continue cooking until the salmon flakes easily with a fork and is 140 deg.   Just before removing, add a bit more glaze.

In the very hot preheated pan , toss the beans in, and shake frequently to prevent sticking.  Beans will cook very quickly.  However, they can be warmed if you want to complete them before the salmon is completed.
Serve  the salmon, lightly drizzled with thickened glaze. Place beans next to salmon.  Garnish with chopped fresh chives and lemon wedges.

If you are wondering about the non-stick pans, DuPont (according to Google) says their maximum recommended use is only about 500 degrees Fahrenheit.  They also say they will suffer significant decomposition above 660.  Cooks Illustrated (sometime in 2005, but I didn’t dig up the issue to quote), the Environmental Working Group, and I believe Alton Brown, independently say that a pan can overheat (700 deg according to the EWG) in as little as 5 minutes when used on high heat, and that toxic and carcinogenic gasses can be detected at those temperatures.

Posted in Cooking | Tagged , , | Comments Off on Soy-maple Glazed Salmon, with Sauted Green Beans, Recipe

Hex in elisp

?\x48fc is a 16bit hex value in emacs.  So, for example:

(- ?\x4ffb ?\x48fc)

Posted in Emacs | Comments Off on Hex in elisp

Mail Configuration with Postfix and Dovecot

(NOTE in 2011: This one post attracts enormous amounts of spam comments, so I’m closing comments on it, while still leaving comments on elsewhere.)

Notes on configuring a SMTP/IMAP server with TLS, SSL, and SMTP AUTH, the least pain possible.

The platform used was Solaris 10 with SunStudio 11. The notes should apply to any reasonably recent unix-like operating system, although Linux users in particular may find it easier to just install the setup from their prefered package management system. I will note any place that is likely to contain Solaris specific stuff.

The main pieces used are Postfix and Dovecot.

A quick note: TLS is basically SSL

About SASL

Postfix requires an external SASL library to use for SMTP AUTH. The normal choice is Cyrus SASL, which has been around for some time. Cyrus SASL is difficult to build on Solaris with SunStudio, and is generally a much hated library.

Starting with Dovecot 1.0, Dovecot now has it’s own SASL library. This is much easier to use. The only downside is that when doing Postfix to Postfix SMTP AUTH connections, the client copy of Postfix can’t use Dovecot SASL. If your installation of Postfix is always going to be a SMTP AUTH server and never a client, then please use Dovecot SASL.


Compile with:

./configure --prefix=/opt/dovecot --with-pgsql --with-gssapi \
          --with-ssl=openssl --with-gc

gssapi still doesn’t seem to work for me, and I’m not actually using pgsql, so I could have left it off as well.


At this point, all you have to do is edit the dovecot.conf file. I don’t have anything but plain authentication working correctly. I can get CRAM-MD5 working, but then plain won’t work, at least with mutt. I make up for this by requiring the non-localhost imap connections use SSL, and by later setting postfix to only allow SMTP AUTH over TLS. I accomplish the imap/SSL requirement with a firewall rule.

Find the commented protocols line and uncomment, set to “protocols = imap imaps”. This disables POP usage. Add pop and pops if you wish.

Set the ssl_cert_file and ssl_key_file lines in your dovecot.conf file. Search elsewhere for a guide on creating the key. I reused the same key that I created for apache/ssl usage.

Set the mail_location line to “mail_location = maildir:~/Maildir”.

Adjust the first_valid_uid line, if needed. I set mine to: “first_valid_uid = 100”.

Find the “auth default” section. Change the mechanisms line to: “mechanisms = plain login”. In the passwd pam { second, find the commented out args line, and change it to “args = /etc/pam.conf”.

Still in the auth default section, find the commented out “socket listen” section. Uncomment the first line to: “socket listen {“. Then scroll down to the client section, and uncomment the non-descriptive lines and change to:

    client {
      # The client socket is generally safe to export to everyone. Typical use
      # is to export it to your SMTP server so it can do SMTP AUTH lookups     
      # using it.                                                              
      path = /var/spool/postfix/private/auth
      user = postfix
      group = postfix
      mode = 0660


Start up dovecot. Under Solaris 9 or linux, I added it to the rc.local file (on some systems I had to create a rc.local system to do so). On Solaris 10, find a manifest and method here and here.. To install these files, copy the manifest to /var/svc/manifest/site and the method to /lib/svc/method and install them into SMF with the command:

svccfg import /var/svc/manifest/site/imap-dovecot.xml



Very simple. In the expanded source directory, “./configure && make && sudo make install”.


To build:

   -I/usr/local/ssl/include' \
   AUXLIBS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib -lssl -lcrypto" \

Non-solaris users can omit the -R option, and the CC option.


The primary options that need set are to append to the end:

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/your.crt
smtpd_tls_key_file = /etc/ssl/your.key
smtpd_tls_loglevel  = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may


Additionally, find the mailbox_command section and set:

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/your.crt
smtpd_tls_key_file = /etc/ssl/your.key
smtpd_tls_loglevel  = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may

smtpd_recipient_restrictions =


Additionally, find the mailbox_command section, and set:

mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/ MAILDIR=$HOME/Maildir


Also set: myhostname, mydomain, mydestination.

Follow other guides for setting up things like spam checking, or mailman.

Posted in System Administration | Comments Off on Mail Configuration with Postfix and Dovecot

PostgreSQL Notes

I don’t use Postgres quite heavily enough to remeber how to do certain administrative tasks. Having gotten sick of flipping back and forth between various sections in the manual, I’m making a page of notes here.

Anything here is probably permenantly burned in the brains of heavier users, but perhaps this will be useful to other light users.


Postgres generally runs as a dedicated user, and that dedicated user probably has complete control over adding roles and dbs.

To use postgres as a specific user, “psql -U username” is easier than su’ing to that user (and the postgres user you want may not be a system user anyway.

Creating a DB

createdb -U postgresuser newdbname

Adding a User

Users are just roles that can login.

createuser -P newusername

The -P flag is to tell it to set a password. It is possible to have accounts without passwords.

To see the users, from inside psql, do \du.

Assigning the DB to a user

This is night the same as granting rights to users (see the GRANT command), although the DB owner does have full rights in the DB.

alter database dbname owner to username;

Posted in System Administration | Comments Off on PostgreSQL Notes


I often want to calculate something quickly then stick it into the buffer I am currently editing. Previously, I would do something like type (+ 3 5) into the buffer, Type C-x C-e, see the result in the minibuffer at the bottom of the screen (are re-evaluate repeatedly if I didn’t quite catch it, say for a long result), type the result into the buffer, then delete the expression (although sometimes in C code, I might leave the expression in a comment).

Eventually, I realized that Esc-: brought up an eval prompt in the minibuffer and that I could use it instead of the above. But I still had to be fast at reading the result before it was taken of the screen, and now I had to retype the expression to re-evaluate it. Sometimes this was an improvement, but not always.

Alternatively, sometimes I would type (insert (format “%s” (+ 3 5))), and evaluate it, but that was quite a lot of typing, and so I’d only use that when I wanted a long result to be pasted into my buffer. And then I still had to delete that long expression.

That led me to do the following in my .emacs files:

(defun eval-exp-insert (EVAL-EXPRESSION-ARG)
  "Evaluate EVAL-EXPRESSION-ARG and insert the result into the current buffer."
  (interactive "xEval: \n")
  (insert (format "%s" (eval EVAL-EXPRESSION-ARG))))

(global-set-key "\M-:" 'eval-exp-insert)

With that, when I type Esc-:, and then enter (+ 3 5), 8 is inserted into the buffer at the current cursor position.

Posted in Emacs | Comments Off on eval-exp-insert

Lamb Chops

This is a recipe where ingredient precision does not matter.  Just use enough to cover the meat.
  • 1/2 Tsp mustard
  • 1.5 Tsp dried sage
  • 1/4 Tsp cayanne
  • 1 Tsp dried chopped onion, or fresh finely minced
  • 2 Tbs oil
  • 2 Tbs balsamic vinegar
  • 4 small lamb chops, about 3/4 pound total.
Mix the above together and marinate lamb chops in it for 30 minutes.  Then grill to 145 degrees.  Rest covered 5-10 minutes.
Posted in Cooking | Comments Off on Lamb Chops

My BBQ Sauce

  • 8oz tomato sauce
  • 2TB molasses
  • 1TB honey
  • 1TB vinager (apple)
  • 1/4 cup jackie D.a
  • 2 teasp. worchester sauce
  • 1 teasp. liquid smoke (optional)
  • 1 TB minced garlic.
  • 1/4 large onion
  • dash of pepper


Boil 30 minutes.

The rest is commentary.

This is a record of what I last did (except I didn’t use liquid smoke.  I left it above for proportion info). 

I think another vineager might be more appropriate, but certainly not the other two I have on hand (balsamic and rice).  Further I’m thinking of scaling back the honey and molasses.  I used some honey to take the edge off the mollasses, but then the sum was sweeter than I wanted.

It didn’t taste right without the worchester sauce, but I don’t know what to put in it’s place.  A lot of people do use it.

I think liquid smoke is OK when I’m cooking inside.  The first time I made it (the last recipe you likely have), I was broiling stuff in the oven, not cooking outside.

More or less onion and garlic might be appropriate based on taste.

Also, you might consider straining it out, or doing any number of other things to them for either flavor or consistency.  Most recent I mincedthem, and then just let the sauce be kinda chunky.

The sauce is better when it is a day+ old.  However, it was also acceptable fresh.  I made sauce on saturday and invited people for thenext day.  The next day I invited more people, and realized I had an inadequate amount of sauce, and so made some fresh, and combined themtogether.  It ended up being two parts day old, 1 part fresh.

Posted in Cooking | Comments Off on My BBQ Sauce

FreeType2 Usage Notes

The motivation of this page is that the FreeType2 tutorial doesn’t
give you complete working code. Lots of people complain about the lack
of very short simple working example. I too felt that was lacking, so I
posted up my first simple program.

See: text2text

This program should compile on linux, Irix, or solaris. Minor Makefile
adjustments may be needed if files don’t appear in the same locations
for you as the do me. Last tested on Irix w/ MIPSpro, RHEL3, Ubuntu
Warty Warthog, and Solaris9 w/ SunStudio. Solaris with GCC will require
you adjusting your system so cc invokes gcc.

Anyway, the program demonstrates simple usage of freetype2.

Below is the main piece. It opens the library, loads the font file,
sets the text size, then renders out the characters. As written, it
just assumes the canvas will be large enough for the text.

If you extrapolate as it is written, you would have to render the
text twice if you want to create a canvas that is sure to hold the
string (say because you want to render to a picture). Also, the code
below offers no method for dealing with ligatures.

error = FT_Init_FreeType( &library );
if ( error )
  printf("an error occured\n");

error = FT_New_Face( library, fileName, 0, &face );
if ( error == FT_Err_Unknown_File_Format )
  //... the font file could be opened and read, but it appears
  //... that its font format is unsupported
  printf("Face error\n");
else if ( error )
  //... another error code means that the font file could not
  //... be opened or read, or simply that it is broken...
  printf("other Face error\n"); 

error = FT_Set_Char_Size( face, /* handle to face object */
0, /* char_width in 1/64th of points */
48*64, /* char_height in 1/64th of points */
40, /* horizontal device resolution */
18 ); /* vertical device resolution */

slot = face->glyph; /* a small shortcut */

pen_x = 0;
pen_y = 0;
for ( n = 0; n < num_chars; n++ )
  unsigned char * buf;

  /* load glyph image into the slot (erase previous one) */
  error = FT_Load_Char( face, text[n], FT_LOAD_DEFAULT );
  if ( error ) continue; /* ignore errors */

  /* convert to an anti-aliased bitmap */
  error = FT_Render_Glyph( face->glyph,  FT_RENDER_MODE_NORMAL );
  if ( error ) continue; /* now, draw to our target surface */

  buf = slot->bitmap.buffer;

  for(j=0; jbitmap.rows; j++)
    for(i=0; ibitmap.width ; i++)
      int index = (j*slot->bitmap.width)+(i);
      unsigned char c;
      //printf("index: %d offset %d\n", index/8, index%8);

      pen_y = height -3-slot->bitmap_top;

       if (c>0 && c<128) output[(j+pen_y)*width+(i+pen_x)] = '.';
       if (c>127) output[(j+pen_y)*width+(i+pen_x)] = 'x';

  /* increment pen position */
  pen_x += slot->bitmap.width+2;

The big change I’m working on is making it use an array FT_Glyph
structures to be able to hold the string of glyphs. In
psuedo code, that would look something like this:

FT_Glyph * glyphs;
int width=0;
//setup array.

for (/*each char in char string*/)
  error = FT_Load_Char( face, string[i], FT_LOAD_NORMAL );
  error = FT_Get_Glyph( face->glyph, &(glyph[i]));
  error = FT_Render_Glyph( &(glyph[i]),  FT_RENDER_MODE_NORMAL );
  width += glyph[i]->bitmap.width + SPACE_BETWEEN_CHARS;

//create canvase

for (/*each char in char string*/)
  //do something with each render'd glyphs bitmap to copy to destination



Keep in mind that is incomplete code. It hasn’t really been written
up and tested yet.

And I still don’t know how to deal with ligatures, kerning, and all
sorts of other features. However, if I implement the pseudo code above,
I expect I’ll have everything I need for now.


Posted in Programming | Tagged | Comments Off on FreeType2 Usage Notes

C/C++ Message Passing

Note: For C++ users, find an update at

My favorite approach to threaded programming is message passing, holding the shared memory for things that need it for performance reasons.

eCos has a handy general purpose message passing system, but C/C++ do not. Posix does have some methods that can be used for this. There are pipes or System V message queues. My problem with these is that they are meant for interprocess work, and thus have un-needed overhead for talking between threads. Also, those two methods are byte stream oriented.

What eCos has and what I wanted was the ability to pass pointers to a messages struct. Basically, a thread safe queue that pushes void* in and pops void* out, without invoking syscalls, which sap performance. I typically use this with a struct. Either all of the structs in the queue are the same type, or else in every struct used, the first item in the struct is an int indicating what struct to coerce the pointer to.

Anyway, here are the files:

Tested on Linux with GCC 3.2 and Solaris with Sun C++ 5.5. On Solaris, the test program for the queue returns two warnings, but functions fine. The test program is C++ for reasons that aren’t really relevant. This should be fixed at some point.

This is meant to be written to be acceptable for use in realtime systems. Obviously, if those systems don’t support posix threads, one will need to substitute the OS’s form of Mutex’s and Conds.

Posted in Programming | Tagged , , , | Comments Off on C/C++ Message Passing