Category Archives: Uncategorized

Keep command-line Subversion client (svn) from saving credentials

If you share a server with multiple users, you may find yourself committing as root.  In that case, it’s helpful if you can keep svn from saving credentials.  All you have to do is edit:


Set the following:

store-passwords = no
store-auth-creds = no

Then remove any credentials file that exists in:


Web browser text search

So I am working on a project where I have to search some HTML documents for a possible text string. This lead me to an interesting find in how browsers do searching on text.


Let’s look at the following HTML.

<div style="background-color: #00ff00;">Hello ther</div>
<div style="background-color: #ff0000;">e,
<span style="background-color: #f0ff00;">bob</span> how are</div>
<div style="background-color: #00ff00;">you?</div>

The text displays as the following: Text displayed in a browser

The yellow represents the inner span. The divs are different colors to show their distinction.

If you search for the text “Hello there” no results will be found as the browser does not search across div elements.

If you search for the text “e, bob how are” the text will be found as the browser will search across span elements.

It’s interesting to note that the browser’s search works only across defaulted inline elements but not elements set inline by the html.

Using nullmailer as a simple MTA

nullmailer is a very simple MTA I like to use on Linux servers when I don’t want to have a lot of hassle with mail server configuration.

It will automatically send all local mail to one of my email addresses by simply installing it and configuring two files.  The /etc/nullmailer/remotes I put in my smtp server.  Here is an example: smtp --pass=examplepassword

For /etc/nullmailer/adminaddr I put the following:

All mail delivered to, say, the local root account automatically gets sent to the email address put in the adminaddr file.  Simple and convenient.

Troubleshooting is also simple.  When the email is still in queue, you can see it with command mailq.  It will also show where it’s going to be delivered.  Logs can be found in /var/log/mail.log and /var/log/mail.err

One thing I’ve noticed is you’ve got to get your hostnames right.  Make sure /etc/mailname has the fully qualified domain name in it.  I had an issue when the hostname on the machine (/etc/hostname) was the same as the /etc/mailname.

Better jquery each loop for coffeescript

When writing object-oriented code in coffeescript, I’ve found that the jquery each method is insufficient, due to its use of “this”.  I am forced to use the following syntax:

$('.thing').each (index, thing) =>
    width: @width()

I’ve created an alternative which works better for this use case.  It passes the object as both “this” and as the first argument, and wraps them both in a jquery object automatically:

$('.thing').loop (thing) =>
    width: @width()

In cases where you don’t want access to the original “this”, it is also useful.  Here is an example with “each”:

$('.photo').each ->

With “loop”, there’s no need to wrap “this” with a jquery object:

$('.photo').loop ->

Here is the source code for $.loop:

# Better each() for use with coffeescript
# 1. Wraps child in jquery object
# 2. Sets child first argument, so that fat-binding can be used.
# 3. Sets @ as well, for normal binds
jQuery.fn.loop = (block) ->
  for i in @
    element = jQuery(i)
    res = element, element
    break if res == false