All posts by Devin

How-To SSH without a password

Sometimes you need to create an SSH connection without entering in your password. For instance, you are syncing files using a Version Control System (such as Git or Mercurial) over SSH, and your software isn’t set up to ask for a password every time.

The solution is simple: Store a file on the target computer identifying the source computer.

Here’s how you do it:

1. Generate an SSH key on the source computer (the one you will be making the connection from). When prompted, don’t enter a passphrase.

ssh-keygen -t rsa

2. Create an .ssh directory on the target computer. Enter the ssh password when prompted.

ssh user@Target mkdir -p .ssh

3. Add the source computer’s ssh key to the list of allowed keys on the target computer

cat .ssh/id_rsa.pub | ssh user@Target 'cat >> .ssh/authorized_keys'

You should now be able to make a connection without entering a password.

Install Grails on Mac OS X 10.7 Lion

  1. Download and Install the Java Software Development Kit (SDK).
    1. log on to http://developer.apple.com
    2. Search for “Java for Mac OS X 10.7 Developer ” on the downloads page
    3. Download and Install the latest. This will be a .pkg type install (not click and drag)
  2. Install Grails
    1. Go to http://grails.org/Download
    2. Download the “Binary Zip” under the current release.
    3. Unzip the downloaded file, and move to /Applications/Dev (or wherever you like), take note of the directory name.
  3. Add Environment Variables
    1. Open/Create /etc/launchd.conf
      sudo nano /etc/launchd.conf
    2. Add the following lines: (make sure to reference the proper directory names)
      setenv JAVA_HOME /Library/Java/JavaVirtualMachines/[VERSION].jdk/Contents/Home
      setenv GRAILS_HOME /Applications/Dev/[GRAILS VERSION]
    3. Save and Exit
    4. Add execute permissions
      sudo chmod +x /etc/launchd.conf
  4. Append reference to the grails /bin directory to the path
    1. Create a new path file
      sudo nano /etc/paths.d/grails
    2. Insert the following lines
      /Applications/Dev/[GRAILS VERSION]/bin
    3. Save and Exit
  5. Restart the computer
You should be able to type ‘grails’ at the command prompt and get a response.

Goodbye, Old Friend.

“Old Friends” would be more accurate, I guess.  Robin Dunbar suggested that a person can only maintain about 150 social relationships at one time.  These shoes account for two of my best friends.

These past few weeks have been pretty difficult for me. I mean, my shoes and I have been together for about six years. They were with me when I met my wife. We experienced Disney World for the first time together. And Disney Land. And Disney World again. They were with me when my daughter was born, and then my son. I can’t count how many steps we’ve taken or stairs we’ve climbed. These shoes have been with me more hours than any other possession I have owned. Ever. It really feels like two of my best friends are leaving me.

Then I found these:

They say that the best way to get over one love is to find another. I think I’ll be just fine.

Here’s to the next six years.

Perfect color bouncing flash indoors

Photography is, simply, capturing light.  Really good photographers understand how to capture light in difficult lighting situations.  Taking photos of a bright landscape is pretty simple because your camera does most of the work. Sunrises and sunsets take some exposure compensation. Indoor photography is even more challenging.

The best indoor photographs are taken in a studio with expensive studio lights.  Studio lights do three things: They move the light source away from the camera to provide depth, they diffuse (or spread out) the light to reduce harsh shadows, and they provide consistent light for color accuracy. Built-in flashes will lighten up the subject, but the image typically has less depth and harsh shadows.

This is why most hot shoe-mount flashes have swivel and tilt.  This makes it possible to bounce the flash off of a surface to get somewhat of a studio light feel in photographs. It diffuses the light across that surface, and it moves the light source away from the camera, which provides depth.

Bouncing poses a challenge.  Simply put, you are changing color temperature of the light source.  Photos bounced off a white or off-white surface will probably be “warm,” or have an orange tint.  The solution is to change your white balance settings.

ISO 400, 1/200, f/5.6, +2/3 flash, Sun WBThis photo was taken with the flash bounced off of a white ceiling (flash head was pointing strait up), with the following settings:

ISO: 400
Shutter: 1/200
Aperture: f/5.6
Flash exposure compensation: +2/3
White Balance: Sun

I have not touched up this photo.  It has depth, soft shadows, and the color quality is fantastic.

If you don’t have a hot shoe mount flash and would like better results indoors, try stepping back a few feet from the subject and zooming in a bit to compensate.

How to disable cache in IIS

I have been developing a PHP application running on IIS, and recently came across some caching issues. Lots of them. Normally, caching doesn’t bother me. In fact, it can help performance significantly. However, when I am developing, I don’t want anything to cache. Ever. It throws off the development.

Here’s how to do it in IIS:

  1. From IIS, select the website.
  2. Open “Output Caching” under the IIS section.
  3. Click “Add…” from the Actions panel.
  4. Specify an extension, Check “User-mode caching” and “Kernel-mode caching” and select the “Prevent all caching” options under each section.
  5. Click OK
  6. Restart the website.

Randy Pausch Last Lecture: Achieving Your Childhood Dreams

Randy Pausch (Oct. 23, 1960 – July 25, 2008), who was a professor at Carnegie Mellon, gave this lecture on Sept. 18, 2007, 10 months before he passed away of cancer.

This lecture really helps put things into perspective. It’s a bit long, but I think you’ll enjoy it.

“You’ve got to get the fundamentals, otherwise the other stuff isn’t going to work.”
“When you’re screwing up, and nobody’s saying anything to you anymore, that means they gave up. Your critics are the ones telling you they love you and they still care.”
“Experience is what you get when you didn’t get what you wanted.”
“Brick walls are there for a reason. The brick walls are not there to keep us out. The brick walls are there to give us a chance to show how badly we want something. Because the brick walls are there to stop the people who don’t want it badly enough.”
“Wait long enough and people will surprise and impress you. When you’re [mad] at someone, you just haven’t given them enough time.” Jon Snoddy
“They’re both ways of saying ‘no’, but one’s a good way and one’s a bad way.”
“Until you’ve got ice cream spilled on you, you’re not doing real field work.”

On Target 2010

On Target was one of the most memorable Scouting experiences of my life.  108 teams from Utah and Salt Lake County climbed numerous peaks around the area, listened to a short message from the General Young Men’s President, and contacted each other. We made about 15 contacts using a signaling mirror, 11 of which were reciprocated, from the top of Bismark Peak.

Jake is aligning the hole in the mirror with the bright spot in the shadow.

Signaling mirrors are double-sided mirrors with a small hole to see through them.  In order to signal another person, the operator will locate the target through the small hole, locate the light spot in the shadow cast by the mirrors, and align the hole with the light spot in the shadow.  Once the spot and hole are aligned, you are “On Target.”

Before we began, we saw a military airplane flying through the valley below.

We also saw some wildlife.  If anyone knows what kind of birds these are, please comment.

If you would like more information about On Target, please visit the official Utah National Parks Council On Target site.

Adding or Removing www. with RewriteEngine

Most websites have two hosts: the www host (ie. www.google.com) and the non-www host (ie. google.com). Since search engines don’t like duplicate content, it is good practice to either make sure your site always has the www, or always remove it.  Since you don’t have any control over how the Internet user types in your site, here’s a simple way of either adding or removing the www.

In order for this to work, your site needs to be running on an Apache server, and mod_rewrite should be enabled. Make sure this is at the top of the .htaccess file: (if you don’t have an .htaccess file, create one in the web directory and put this at the top)

RewriteEngine on
Options Indexes FollowSymLinks

Insert this snipped to add the www to all requests:

# add www
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} !^www\\. [NC]
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^/?(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L,NE]

RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} !^www\\. [NC]
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^/?(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,NE]

Or insert this snipped to remove the www from all requests:

# remove www
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www\\. [NC]
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/$1 [R=301,L,NE]

RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^www\\. [NC]
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^/?(.*)$ http://%{HTTP_HOST}/$1 [R=301,L,NE]

Resources:
Apache’s mod_rewrite Documentation
Apache’s URL Rewriting Guide