It’s often helpful to auto-focus form elements for users of your site so they don’t have to manually select them with the mouse. I’d been using the following code on a few sites:
It will focus the first input element on the page that is visible, enabled, doesn’t contain any text, and doesn’t have the class ‘nofocus’ (so you can avoid search fields or other secondary inputs). One of the cool things about jQuery is that you can write some really short code to do very powerful things. Here’s my jQuery implementation of the above code:
The only functionality that is lost is focusing of text and password fields only. jQuery’s selectors make it easy to select all input elements, just text, or just password, but not “text OR password” as far as I can tell. If you can make it any shorter please let me know!
Comcast just started blocking port 25 at my house which caused sendmail to be unable to connect to external mail servers to deliver mail. Some people have been able to convince Comcast to open up the port for them but we weren’t so lucky. Instead, I changed sendmail to use Gmail’s SMTP server as its relay server.
Before making these changes I’d see lots of errors in /var/log/mail.log ending in stat=Deferred: Connection timed out with aspmx2.googlemail.com. or something similar. Trying to
telnet aspmx2.googlemail.com 25 would result in a timeout.
I found all the information on how to do this in these two articles; Yan Li’s Words: Gmail, Fetchmail and Sendmail on UNIX/Linux and Linux, Sendmail and Gmail.com.
All of this was done on a server running Ubuntu 8.04.2 and sendmail 8.14.2.
Edit your /etc/mail/sendmail.mc and add the following above the MAILER_DEFINITIONS block at the bottom. I tried putting these lines at the very bottom of the file the first time and it didn’t work. I suggest copy/pasting because the quotes are very strange.
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
Create the /etc/mail/auth/client-info file by running:
$ mkdir -p /etc/mail/auth
$ chmod 700 /etc/mail/auth
$ touch /etc/mail/auth/client-info
$ chmod 600 /etc/mail/auth/client-info
Edit /etc/mail/auth/client-info and fill it with the lines below. Replace user_id with your Gmail user id (email@example.com) and password with your password. Make sure there is a blank line at the end of the file.
AuthInfo:smtp.gmail.com "U:smmsp" "I:user_id" "P:password" "M:PLAIN"
AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:user_id" "P:**password" "M:PLAIN"
Compile the client-info.db file.
$ cd /etc/mail/auth
$ makemap -r hash client-info.db < client-info
Compile update sendmail.cf with our sendmail.mc changes.
Reload the sendmail configuration.
Now if you check your /var/log/mail.log you should see any queued messages being sent properly. You should see relay=smtp.gmail.com and stat=Sent. If not, make sure you didn’t miss a step above.
I was trying to do this and found these two links very helpful:
Link: RRD Tools
I made this small tool to help calculate values needed when creating RRAs for RRD files and put it on Google App Engine. Will probably add more utilities later as I find myself wanting them.
Link: Daring Fireball: Markdown
I’ve started using Markdown for README files on GitHub and descriptions here on Tumblr, and I love it. Such a great alternative to those nasty rich text editors used by most blogs.