<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4608182549480930549</id><updated>2012-02-16T03:45:27.505-08:00</updated><category term='linux'/><category term='ruby'/><category term='firefox'/><category term='rssh'/><category term='mail'/><category term='web'/><category term='rails'/><category term='wrt54g'/><category term='network'/><category term='wine'/><category term='chroot'/><category term='ipod touch'/><category term='fios'/><category term='cars'/><category term='money'/><title type='text'>blog.layer2.org</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.layer2.org/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default?start-index=26&amp;max-results=25'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-6610402509560816484</id><published>2010-05-22T13:06:00.000-07:00</published><updated>2011-02-09T18:14:31.317-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='rssh'/><category scheme='http://www.blogger.com/atom/ns#' term='chroot'/><title type='text'>Running an rssh chroot on Ubuntu Lucid 10.04</title><content type='html'>I had some trouble getting a chroot running for rssh on Ubuntu Lucid 10.04. I ran the script below:&lt;br/&gt;&lt;br/&gt;/usr/share/doc/rssh/examples/mkchroot.sh /var/chroot&lt;br/&gt;&lt;br/&gt;It created most of the files, but didn't include the right libraries. Here's the minimum file listing I've been able to use:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2010/05/rssh.png"&gt;&lt;img class="alignnone size-full wp-image-91" title="rssh" src="http://blog.layer2.org/wp-content/uploads/2010/05/rssh.png" alt="" width="347" height="450" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;libnsl was the tricky one that I found by trial and error. I installed bash inside the chroot and tested running each binary. Everything runs without libnsl, but its required if you want it to work with rssh.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-6610402509560816484?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/6610402509560816484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2010/05/running-rssh-chroot-on-ubuntu-lucid.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6610402509560816484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6610402509560816484'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2010/05/running-rssh-chroot-on-ubuntu-lucid.html' title='Running an rssh chroot on Ubuntu Lucid 10.04'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3888231004218307594</id><published>2009-05-30T17:21:00.000-07:00</published><updated>2011-02-09T18:14:31.173-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ipod touch'/><title type='text'>How to replace your iPod Touch 2nd gen digitizer / outer glass and
bezel frame</title><content type='html'>If you're like me, you recently had a small accident with your iPod touch... you broke the screen! In our case, the iPod had slipped from a pants pocket into the recliner. It got caught between a few internal recliner arms and pinched to the point where the upper portion of the glass was broken.&lt;br/&gt;&lt;br/&gt;[gallery link="file"]&lt;br/&gt;&lt;br/&gt;In the case where your outer glass (called the digitizer) is broken but the LCD underneath is still perfect, you can replace the glass for $50-$75 in parts and tools. If you just want someone to fix it for you, it'll run $100+ for a 2nd gen from a &lt;a href="http://www.ipodjuice.com/apple-ipod-touch-repair.htm"&gt;parts&lt;/a&gt; &lt;a href="http://www.rapidrepair.com/shop/screen-ipod-repair.html"&gt;store&lt;/a&gt;. Much better than the $200+ I've heard about from the Apple store.&lt;br/&gt;&lt;br/&gt;I found a few video tutorials and other articles about replacing parts on the iPod Touch 2nd gen, but nobody described a few issues that I ran into. First, a few good resources:&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;Video that shows how to take apart the touch - &lt;a href="http://www.youtube.com/watch?v=iPyN9yLEH9o"&gt;http://www.youtube.com/watch?v=iPyN9yLEH9o&lt;/a&gt;&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Article with pictures that shows the entire iPod Touch breakdown - &lt;a href="http://www.rapidrepair.com/guides/ipodtouch2g/ipodtouch2grepairguide.html"&gt;http://www.rapidrepair.com/guides/ipodtouch2g/ipodtouch2grepairguide.html&lt;/a&gt;&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;&lt;h1&gt;Things you'll need&lt;/h1&gt;&lt;br/&gt;&lt;ol&gt;&lt;br/&gt;	&lt;li&gt;Plastic opening tools (these often accompany digitizer replacements on ebay)&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;A new digitizer. Available from eBay or a parts shop like http://www.pdaparts.com&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Most likely you'll also need a new front bezel or frame. For best results, get one with rubber gasket around the edge and double-sided tape on the inside&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;A thin knife with a strong blade (mostly optional)&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;A small pair of wire cutters (optional)&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Intermediate skill if you buy a new front bezel / frame, and advanced skill if you salvage the old one . I took the easier route and bought a new front bezel. Either way, you still need the button seat from the old bezel.&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;&lt;br/&gt;&lt;strong&gt;Unfortunately most of the part stores and eBay sellers that advertise replacement digitizers for 2nd generation iPod touches don't mention that the front bezel is extremely difficult to remove without damage.&lt;/strong&gt; The front bezel and digitizer are attached through buttons around the digitizer edges. My broken digitizer was also glued down to the front bezel. Additionally, there is a thin rubber gasket that runs around the length of the digitizer. Even with careful prying with my fingers and plastic tools I tore the gasket in several places.&lt;br/&gt;&lt;h1&gt;Take it apart&lt;/h1&gt;&lt;br/&gt;The youtube video linked above gives very good information about the location of the clips and how to pull the digitizer off without damaging it. Be careful that you press the plastic tool on the outside of the rubber gasket (closest to the metal backing) rather than the inside of the rubber gasket (closest to the actual glass). This is especially important if you don't want to damage the bezel. I found that I accidentally separated the bezel from the digitizer because I didn't realize the distinction.&lt;br/&gt;&lt;br/&gt;Once you have the digitizer off, you can put the rest of the iPod aside and focus on separating the glass from the bezel. It is a pain, and assuming your digitizer is cracked, is likely to drop pieces of glass. You only need to separate the glass from the lower portion of the bezel (near the home button).&lt;br/&gt;&lt;br/&gt;The goal is the grab the home button and its seat. I haven't seen any parts stores that sell the seat, so don't mess it up! The button just fails out.&lt;br/&gt;&lt;br/&gt;The edges around the button seat are raised. After bending the plastic various ways, I found the easiest way to retrieve it is to use a small wire cutter and snip off the edges to the right and left, removing the raised edges. This will allow you to take a small, thin knife and slide it under the tiny plastic buttons that hold it on. Keep the knife away from the center of the button seat because that might sever the electrical connection.&lt;br/&gt;&lt;h1&gt;Attach the new digitizer and bezel&lt;/h1&gt;&lt;br/&gt;Since I didn't know that I needed a bezel to do the replacement, I just ordered it tonight. I will post more information and pictures when the part arrives.&lt;br/&gt;&lt;h1&gt;Slide in the new assembly&lt;/h1&gt;&lt;br/&gt;After you have the new digitizer and bezel together, complete with home button, you can put it back together! Don't forget to attach the digitizer ribbon to the rest of the iPod.&lt;br/&gt;&lt;br/&gt;Thats it! Post a comment about how your replacement goes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3888231004218307594?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3888231004218307594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2009/05/how-to-replace-your-ipod-touch-2nd-gen.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3888231004218307594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3888231004218307594'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2009/05/how-to-replace-your-ipod-touch-2nd-gen.html' title='How to replace your iPod Touch 2nd gen digitizer / outer glass and&#xA;bezel frame'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-6828309424832426420</id><published>2008-02-09T09:26:00.000-08:00</published><updated>2011-02-09T18:14:31.146-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>Remember Basic Authentication passwords in Firefox without Roboform</title><content type='html'>If you like to save your passwords, you probably know that its a pain to save Basic Authentication passwords in Firefox. Basic Authentication comes up in a new window saying "Enter username and password for ..." and looks like this:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2008/02/prompt.png" title="Prompt"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2008/02/prompt.png" alt="Prompt" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;There is no 'save this password' button. If you access this site every day, and close Firefox between sessions, you'd have to type your username/password every time. No longer!&lt;br/&gt;&lt;br/&gt;It is possible, though seemingly undocumented, to save the username/password inside the HTTP URL (this long has been done with FTP). For example:&lt;br/&gt;&lt;br/&gt;http://user:password@layer2.org&lt;br/&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2008/02/bookmark.png" title="bookmark"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2008/02/bookmark.png" alt="bookmark" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Just put this into a bookmark, and you have an easy way to access your password-protected site. Of course, if the password is actually sensitive, you might think twice about saving it in plain text as a bookmark!&lt;br/&gt;&lt;br/&gt;The only annoying thing that happens using this method is that you'll see this prompt the &lt;em&gt;first&lt;/em&gt; time you try to log in (for any given Firefox session):&lt;br/&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2008/02/log_in.png" title="Log in"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2008/02/log_in.png" alt="Log in" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Just press OK. While not perfect, this is a heck of a lot easier to deal with than entering the password each and every time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-6828309424832426420?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/6828309424832426420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2008/02/remember-basic-authentication-passwords.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6828309424832426420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6828309424832426420'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2008/02/remember-basic-authentication-passwords.html' title='Remember Basic Authentication passwords in Firefox without Roboform'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-2901279449175597819</id><published>2008-01-12T13:58:00.000-08:00</published><updated>2011-02-09T18:14:31.023-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Rails migration with a list of all United States</title><content type='html'>How many times have you created web applications that use addresses? Since I felt like I wasted the entire 10 minutes it took me to type out this state list, I figured I'd share it with everyone so that their time wasn't equally wasted. Enjoy.&lt;br/&gt;&lt;br/&gt;Run this command:&lt;br/&gt;&lt;pre&gt;ruby script/generate model State&lt;/pre&gt;&lt;br/&gt;And put this in db/migrate/XXX_create_states.rb:&lt;br/&gt;&lt;pre lang="ruby"&gt;class CreateStates &lt; ActiveRecord::Migration&lt;br/&gt;  def self.up&lt;br/&gt;    create_table :states do |t|&lt;br/&gt;      t.column :name, :string&lt;br/&gt;      t.column :abbreviation, :string&lt;br/&gt;    end&lt;br/&gt;&lt;br/&gt;    State.create :name =&gt; 'Alabama', :abbreviation =&gt; 'AL'&lt;br/&gt;    State.create :name =&gt; 'Alaska', :abbreviation =&gt; 'AK'&lt;br/&gt;    State.create :name =&gt; 'Arizona', :abbreviation =&gt; 'AZ'&lt;br/&gt;    State.create :name =&gt; 'Arkansas', :abbreviation =&gt; 'AR'&lt;br/&gt;    State.create :name =&gt; 'California', :abbreviation =&gt; 'CA'&lt;br/&gt;    State.create :name =&gt; 'Colorado', :abbreviation =&gt; 'CO'&lt;br/&gt;    State.create :name =&gt; 'Connecticut', :abbreviation =&gt; 'CT'&lt;br/&gt;    State.create :name =&gt; 'Delaware', :abbreviation =&gt; 'DE'&lt;br/&gt;    State.create :name =&gt; 'District of Columbia', :abbreviation =&gt; 'DC'&lt;br/&gt;    State.create :name =&gt; 'Florida', :abbreviation =&gt; 'FL'&lt;br/&gt;    State.create :name =&gt; 'Georgia', :abbreviation =&gt; 'GA'&lt;br/&gt;    State.create :name =&gt; 'Hawaii', :abbreviation =&gt; 'HI'&lt;br/&gt;    State.create :name =&gt; 'Idaho', :abbreviation =&gt; 'ID'&lt;br/&gt;    State.create :name =&gt; 'Illinois', :abbreviation =&gt; 'IL'&lt;br/&gt;    State.create :name =&gt; 'Indiana', :abbreviation =&gt; 'IN'&lt;br/&gt;    State.create :name =&gt; 'Iowa', :abbreviation =&gt; 'IA'&lt;br/&gt;    State.create :name =&gt; 'Kansas', :abbreviation =&gt; 'KS'&lt;br/&gt;    State.create :name =&gt; 'Kentucky', :abbreviation =&gt; 'KY'&lt;br/&gt;    State.create :name =&gt; 'Louisiana', :abbreviation =&gt; 'LA'&lt;br/&gt;    State.create :name =&gt; 'Maine', :abbreviation =&gt; 'ME'&lt;br/&gt;    State.create :name =&gt; 'Maryland', :abbreviation =&gt; 'MD'&lt;br/&gt;    State.create :name =&gt; 'Massachutsetts', :abbreviation =&gt; 'MA'&lt;br/&gt;    State.create :name =&gt; 'Michigan', :abbreviation =&gt; 'MI'&lt;br/&gt;    State.create :name =&gt; 'Minnesota', :abbreviation =&gt; 'MN'&lt;br/&gt;    State.create :name =&gt; 'Mississippi', :abbreviation =&gt; 'MS'&lt;br/&gt;    State.create :name =&gt; 'Missouri', :abbreviation =&gt; 'MO'&lt;br/&gt;    State.create :name =&gt; 'Montana', :abbreviation =&gt; 'MT'&lt;br/&gt;    State.create :name =&gt; 'Nebraska', :abbreviation =&gt; 'NE'&lt;br/&gt;    State.create :name =&gt; 'Nevada', :abbreviation =&gt; 'NV'&lt;br/&gt;    State.create :name =&gt; 'New Hampshire', :abbreviation =&gt; 'NH'&lt;br/&gt;    State.create :name =&gt; 'New Jersey', :abbreviation =&gt; 'NJ'&lt;br/&gt;    State.create :name =&gt; 'New Mexico', :abbreviation =&gt; 'NM'&lt;br/&gt;    State.create :name =&gt; 'New York', :abbreviation =&gt; 'NY'&lt;br/&gt;    State.create :name =&gt; 'North Carolina', :abbreviation =&gt; 'NC'&lt;br/&gt;    State.create :name =&gt; 'North Dakota', :abbreviation =&gt; 'ND'&lt;br/&gt;    State.create :name =&gt; 'Ohio', :abbreviation =&gt; 'OH'&lt;br/&gt;    State.create :name =&gt; 'Oklahoma', :abbreviation =&gt; 'OK'&lt;br/&gt;    State.create :name =&gt; 'Oregon', :abbreviation =&gt; 'OR'&lt;br/&gt;    State.create :name =&gt; 'Pennsylvania', :abbreviation =&gt; 'PA'&lt;br/&gt;    State.create :name =&gt; 'Rhode Island', :abbreviation =&gt; 'RI'&lt;br/&gt;    State.create :name =&gt; 'South Carolina', :abbreviation =&gt; 'SC'&lt;br/&gt;    State.create :name =&gt; 'South Dakota', :abbreviation =&gt; 'SD'&lt;br/&gt;    State.create :name =&gt; 'Tennessee', :abbreviation =&gt; 'TN'&lt;br/&gt;    State.create :name =&gt; 'Texas', :abbreviation =&gt; 'TX'&lt;br/&gt;    State.create :name =&gt; 'Utah', :abbreviation =&gt; 'UT'&lt;br/&gt;    State.create :name =&gt; 'Vermont', :abbreviation =&gt; 'VT'&lt;br/&gt;    State.create :name =&gt; 'Virginia', :abbreviation =&gt; 'VA'&lt;br/&gt;    State.create :name =&gt; 'Washington', :abbreviation =&gt; 'WA'&lt;br/&gt;    State.create :name =&gt; 'West Virginia', :abbreviation =&gt; 'WV'&lt;br/&gt;    State.create :name =&gt; 'Wisconsin', :abbreviation =&gt; 'WI'&lt;br/&gt;    State.create :name =&gt; 'Wyoming', :abbreviation =&gt; 'WY'&lt;br/&gt;&lt;br/&gt;  end&lt;br/&gt;&lt;br/&gt;  def self.down&lt;br/&gt;    drop_table :states&lt;br/&gt;  end&lt;br/&gt;end&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-2901279449175597819?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/2901279449175597819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2008/01/rails-migration-with-list-of-all-united.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/2901279449175597819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/2901279449175597819'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2008/01/rails-migration-with-list-of-all-united.html' title='Rails migration with a list of all United States'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3413898120492031771</id><published>2007-12-02T17:10:00.000-08:00</published><updated>2011-02-09T18:14:31.010-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Use ffmpeg to extract first image out of FLV</title><content type='html'>I found at least &lt;a href="http://www.db75.com/blog/archives/000176.html"&gt;one other person&lt;/a&gt; trying to find a way to &lt;a href="http://www.5etdemi.com/blog/archives/2005/12/extracting-a-jpeg-snapshot-from-an-flv-file/"&gt;extract a JPG snapshot out of a flash video using ffmpeg&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;The above article suggests using ffmpeg to extract a PNG, and then convert that to a JPG (since the JPG will be much smaller). Instead, just use the correct arguments to ffmpeg:&lt;br/&gt;&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;ffmpeg -i movie.flv-vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 movie.jpg&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;&lt;br/&gt;With &lt;strong&gt;-vcodec mjpeg&lt;/strong&gt; the important argument.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3413898120492031771?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3413898120492031771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/12/use-ffmpeg-to-extract-first-image-out.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3413898120492031771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3413898120492031771'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/12/use-ffmpeg-to-extract-first-image-out.html' title='Use ffmpeg to extract first image out of FLV'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3044369752035697312</id><published>2007-11-19T13:56:00.000-08:00</published><updated>2011-02-09T18:14:30.896-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Rails' attachment_fu, :thumbnail_class and you</title><content type='html'>I was having a bit of trouble with attachment_fu that took a while to figure out, so I thought I'd post my solution for the next person.&lt;br/&gt;&lt;br/&gt;I have a Photo model that I'm using to store pictures. Since attachment_fu will automatically resize, create thumbnails, and store pictures on the file system, it was an easy choice to use it. The things I found I didn't like about it:&lt;br/&gt;&lt;ol&gt;&lt;br/&gt;	&lt;li&gt;It stores thumbnails as separate records inside the photos table. This means you have to check if thumbnail.nil? each time you display the pictures, and you'll have to check parent_id.nil? to count your photos.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;You can't use your own model validations. For example, I wanted to use&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;validates_presence_of :name&lt;br/&gt;validates_presence_of :description&lt;/pre&gt;&lt;br/&gt;But I'd always get validation errors because attachment_fu tries to save the thumbnail attributes when it creates or resizes a thumbnail. As you can imagine, this is a major problem.&lt;br/&gt;&lt;h2&gt;:thumbnail_class to the rescue&lt;/h2&gt;&lt;br/&gt;Mike Clark's &lt;a href="http://clarkware.com/cgi/blosxom/2007/02/24"&gt;attachment_fu blog post&lt;/a&gt; mentions that you can use the :thumbnail_class argument to separate your model validations and attachment_fu's validations. Here's how to do it:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;class Photo &lt; ActiveRecord::Base&lt;br/&gt;  has_many :thumbnails, :foreign_key =&gt; 'parent_id'&lt;br/&gt;&lt;br/&gt;  has_attachment  :storage =&gt; :file_system,&lt;br/&gt;                          :content_type =&gt; :image,&lt;br/&gt;                          :max_size =&gt; 10.megabytes,&lt;br/&gt;                          :resize_to =&gt; '640x480',&lt;br/&gt;                          :thumbnails =&gt; { :thumb =&gt; '100x100' },&lt;br/&gt;                          :thumbnail_class =&gt; Thumbnail&lt;br/&gt;&lt;br/&gt;  # Validations&lt;br/&gt;  validates_presence_of :name&lt;br/&gt;  validates_presence_of :description&lt;br/&gt;end&lt;br/&gt;&lt;br/&gt;class Thumbnail &lt; ActiveRecord::Base&lt;br/&gt;  belongs_to :photo, :foreign_key =&gt; 'parent_id'&lt;br/&gt;&lt;br/&gt;  has_attachment  :storage =&gt; :file_system,&lt;br/&gt;                  :content_type =&gt; :image&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;The killer for me initially was that I wasn't specifying has_attachment in the Thumbnail model. I always got this error:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;undefined method `temp_path=' for #thumbnail:0xb69a9514&lt;/pre&gt;&lt;br/&gt;So save yourself by putting has_attachment in both models. Make sure to define any attachment_fu arguments in your Photo model, and leave the Thumbnail model bare. You'll also want to make sure you have the normal attachment_fu schema in &lt;strong&gt;both&lt;/strong&gt; models:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;      t.column :parent_id,  :integer&lt;br/&gt;      t.column :content_type, :string&lt;br/&gt;      t.column :filename, :string&lt;br/&gt;      t.column :thumbnail, :string&lt;br/&gt;      t.column :size, :integer&lt;br/&gt;      t.column :width, :integer&lt;br/&gt;      t.column :height, :integer&lt;/pre&gt;&lt;br/&gt;I've found that everything seems to be working as normal going this route. My model validations work and the thumbnails are not polluting the photos table. If you want to find the Photo for a particular Thumbnail, keep in mind that parent_id now refers to the id in the Photo model:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;t = Thumbnail.find ....  # find your thumbnail&lt;br/&gt;p = Photo.find(t.parent_id)&lt;/pre&gt;&lt;br/&gt;And for the ultimate ease-of-use relationship, just use:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;t = Thumbnail.find ....  # find your thumbnail&lt;br/&gt;p = t.photo               # get a photo&lt;br/&gt;p.thumbnails              # get all thumbnails&lt;/pre&gt;&lt;br/&gt;This works since we defined the has_many relationship in the model.&lt;br/&gt;&lt;br/&gt;Let me know if you have any problems with this method or if it helped you!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3044369752035697312?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3044369752035697312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/11/rails-attachmentfu-thumbnailclass-and.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3044369752035697312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3044369752035697312'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/11/rails-attachmentfu-thumbnailclass-and.html' title='Rails&amp;#39; attachment_fu, :thumbnail_class and you'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3332668621038973911</id><published>2007-11-04T13:47:00.000-08:00</published><updated>2011-02-09T18:14:30.881-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Serve home directories to internal IPs only with lighttpd</title><content type='html'>Recently, I decided I wanted to share home directories via HTTP to everyone on my home network. This is an easy way to share files with Windows machines where you don't have any type of sshfs-like support. The problem was that this file/web server also faces the Internet. Obviously I don't want to share our personal files to anybody who cares to look. After a bit of playing, I came up with this configuration:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;$HTTP["remoteip"] != "192.168.1.0/24" {&lt;br/&gt;  $HTTP["url"] =~ "^/~" {&lt;br/&gt;    url.access-deny = ( "" )&lt;br/&gt;    dir-listing.activate = "disable"&lt;br/&gt;  }&lt;br/&gt;}&lt;/pre&gt;&lt;br/&gt;This allows any host with an IP in the 192.168.1.1-254 range view any URL that begins with /~username. It denies everyone else with a &lt;em&gt;403 - Forbidden&lt;/em&gt; message. Note that for some reason, listing the conditions in the opposite order (url first, remoteip second) did not produce the correct results.&lt;br/&gt;&lt;br/&gt;Finally, make sure that you have both the appropriate modules enabled:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;server.modules += ( "mod_access", "mod_userdir" )&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3332668621038973911?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3332668621038973911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/11/serve-home-directories-to-internal-ips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3332668621038973911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3332668621038973911'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/11/serve-home-directories-to-internal-ips.html' title='Serve home directories to internal IPs only with lighttpd'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-6945408029075169567</id><published>2007-10-24T15:45:00.000-07:00</published><updated>2011-02-09T18:14:30.868-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mail'/><title type='text'>Google IMAP will be a Yahoo mail killer!</title><content type='html'>If you haven't heard already, Google with be and is &lt;a href="http://blog.wired.com/monkeybites/2007/10/google-adds-ima.html"&gt;offering IMAP&lt;/a&gt; for their Gmail service! You might not have it available on your account immediately, but it should be within a few days or a week.&lt;br/&gt;&lt;br/&gt;I'm one of the lucky ones that already has IMAP set up. I tried it out in Thunderbird and the setup was quite smooth. The only problem I ran into is that some of my old chats came up with a timestamp of 2:33am this morning. So, they were out of order and weird, but it wasn't that big of an issue.&lt;br/&gt;&lt;br/&gt;The real point I wanted to make in this post is that this will be a killer (imo) for Yahoo mail. Back in the day when I signed up for Yahoo mail, they were on the leading edge for features and interface. I remember when they moved to the interface they have which they now call their 'classic' interface, and I have saved HTML pages that show what their REAL classic interface looks like.&lt;br/&gt;&lt;br/&gt;But until now I have not had a reason to move to Gmail. While I do have a Gmail account, I don't use it as my primary account because there was no real advantage to switch to it. Some of the features might be nicer and sexier, but webmail is still webmail. Now that Gmail offers IMAP along with a host of other features that set it apart from other webmail clients, there is a huge reason to move to Gmail. For this reason, Yahoo will lose many 'techie' customers it hasn't already lost unless it offers the same feature.&lt;br/&gt;&lt;br/&gt;In case you're curious, here are the settings:&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Incoming&lt;/strong&gt;: imap.gmail.com&lt;br/&gt;&lt;strong&gt; Outgoing&lt;/strong&gt;: smtp.gmail.com&lt;br/&gt;&lt;strong&gt; Username&lt;/strong&gt;: username@gmail.com&lt;br/&gt;&lt;strong&gt; SSL&lt;/strong&gt;: yes&lt;br/&gt;&lt;br/&gt;Have fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-6945408029075169567?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/6945408029075169567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/google-imap-will-be-yahoo-mail-killer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6945408029075169567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6945408029075169567'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/google-imap-will-be-yahoo-mail-killer.html' title='Google IMAP will be a Yahoo mail killer!'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-8285660027711827348</id><published>2007-10-20T16:30:00.000-07:00</published><updated>2011-02-09T18:14:30.722-08:00</updated><title type='text'>LDS General Conference Podcast RSS feed</title><content type='html'>LDS General Conference audio and video is available via podcast!&lt;br/&gt;&lt;br/&gt;After watching conference the LDS General Conference at the beginning of October, I really wanted to download all the talks via an RSS feed. I didn't see one available right away, so I considered making my own. Fortunately, I found that an official podcast does exist. Its just not publicized well by the Church.&lt;br/&gt;&lt;br/&gt;MP3 audio: &lt;a href="http://feeds.lds.org/ldsgccomplete_eng"&gt;http://feeds.lds.org/ldsgccomplete_eng&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Video: &lt;a href="http://feeds.lds.org/ldsgccomplete_eng_mp4"&gt;http://feeds.lds.org/ldsgccomplete_eng_mp4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This should get you the most recent General Conference. If you haven't used RSS before, you just need to give either (or both) of the above feed URLs to a podcast downloader (such as &lt;a href="http://www.apple.com/itunes/store/podcasts.html"&gt;iTunes&lt;/a&gt;). The downloader will download all the current talks, and theoretically, will download the new talks next conference.&lt;br/&gt;&lt;br/&gt;As an unrelated side note, feeds.lds.org is actually hosted by &lt;a href="http://feedburner.com"&gt;feedburner&lt;/a&gt;. Thanks to &lt;a href="http://www.ldswebguy.com/2007/10/17/podcasts-and-rss-feeds-of-general-conference/"&gt;ldswebguy&lt;/a&gt; for originally posting these podcast feeds.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-8285660027711827348?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/8285660027711827348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/lds-general-conference-podcast-rss-feed.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/8285660027711827348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/8285660027711827348'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/lds-general-conference-podcast-rss-feed.html' title='LDS General Conference Podcast RSS feed'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-7769751905173883200</id><published>2007-10-19T01:34:00.000-07:00</published><updated>2011-02-09T18:14:30.602-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='fios'/><title type='text'>Verizon FIOS and running a Linux operating system</title><content type='html'>Despite the well known fact that &lt;a href="http://science.slashdot.org/article.pl?sid=06/12/09/0625245&amp;amp;from=rss"&gt;Verizon Can't Do Math&lt;/a&gt;, I have to say that I am surprised to find that their FIOS service is pretty good. I've had it for over a month, and haven't noticed it go down or have any speed problems.&lt;br/&gt;&lt;br/&gt;More interestingly, I've actually found that they are pretty Linux-friendly. Actually, Linux-friendly might be too strong - lets just say that they have not locked me into using Windows for their service. I did have to use activatemyfios.verizon.net, which has a Windows/OS X only Firefox extension. But other than that, I haven't felt the vendor lock-in blues.&lt;br/&gt;Here are some good points:&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;As far as I can tell, Verizon only blocks port 80. I run both SSH and HTTPS from my home box.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Once I spoofed the &lt;a href="http://blog.layer2.org/2007/10/01/silly-verizon-and-their-creepy-new-router/"&gt;correct MAC address&lt;/a&gt;, I was able to use my own non-Verizon router&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;There is no PPPoE authentication or the like&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;My IP address has not changed since I started the service&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Latency is very low (about 12ms to Google)&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Service has not gone down&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;I don't use their phone or TV services, so I can't comment on those. My guess would be that services like Vonage or Skype would work pretty well on my FIOS connection.&lt;br/&gt;&lt;br/&gt;Bad points:&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;The backup battery is supposedly pretty weak. It only provides voice service during a power outage, not Internet. For that, you'd have to use a UPS. Fortunately, I haven't had the power go out.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;It took forever to get the service installed. Even though the previous house owner already had FIOS installed, they couldn't come out for 2.5 weeks.&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;Verizon does pretty well here. So if you're thinking about switching - I would recommend it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-7769751905173883200?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/7769751905173883200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/verizon-fios-and-running-linux.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/7769751905173883200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/7769751905173883200'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/verizon-fios-and-running-linux.html' title='Verizon FIOS and running a Linux operating system'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-2822378277751876998</id><published>2007-10-18T14:02:00.000-07:00</published><updated>2011-02-09T18:14:30.512-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>How to create a lookup table in Ruby on Rails</title><content type='html'>I'm a big fan of &lt;em&gt;the Rails way&lt;/em&gt;, but sometimes the simple things get you. I like to set up "lookup tables" in Rails, ie. tables in the database that hold commonly used, (often) fixed values. For example, if I have a Car model, I might want to define a Car type model. This would have two purposes:&lt;br/&gt;&lt;ol&gt;&lt;br/&gt;	&lt;li&gt;Give me the ability to associate a type with the Car model (ie. Car.type =&gt; 'sport')&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Pre-load common values into the database (ie. sport, coupe, sedan, etc)&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;&lt;br/&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I can accomplish this through a few steps. First, lets generate the lookup table model:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;$ ruby script/generate model CarType&lt;/pre&gt;&lt;br/&gt;We'll need to edit the migration under db/migrate/XXX_create_car_types.rb&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;class CreateCarTypes &lt; ActiveRecord::Migration&lt;br/&gt;  def self.up&lt;br/&gt;    create_table :car_types do |t|&lt;br/&gt;      t.column :name, :string&lt;br/&gt;    end&lt;br/&gt;&lt;br/&gt;    CarType.create(:name =&gt; 'sedan')&lt;br/&gt;    CarType.create(:name =&gt; 'sport')&lt;br/&gt;    CarType.create(:name =&gt; 'coupe')&lt;br/&gt;    CarType.create(:name =&gt; 'truck')&lt;br/&gt;    CarType.create(:name =&gt; 'van')&lt;br/&gt;&lt;br/&gt;  end&lt;br/&gt;&lt;br/&gt;  def self.down&lt;br/&gt;    drop_table :car_types&lt;br/&gt;  end&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;You'll note that I created the &lt;em&gt;name&lt;/em&gt; field, and then I just used the create method to produce sample values in the database. This can be an immensely useful technique, especially when deploying a production website - just run your migrations and those lookup tables are already populated.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Note: &lt;/strong&gt;The other technique for populating the database automatically is fixtures. While I think they are great for creating test development data, fixtures fall behind in a production environment. Typically, fixtures will define data like "Test car 1" and "Test car 2". This is very useful to during development, but if you have a lot of test data you can crowd your production database pretty quickly. Since there is no mechanism to conditionally load fixture data based on the environment, fixtures lose their appeal. If you must load fixture data into your production database, you may use&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;$ rake RAILS_ENV=production db:fixtures:load&lt;/pre&gt;&lt;br/&gt;Second, create the Car model and associate it with a CarType:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;$ ruby script/generate model Car&lt;/pre&gt;&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;Car &lt; ActiveRecord::Base&lt;br/&gt;  belongs_to :car_type&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;Your Car migration must hold the appropriate car_type_id:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;class CreateCars &lt; ActiveRecord::Migration&lt;br/&gt;  def self.up&lt;br/&gt;    create_table :cars do |t|&lt;br/&gt;      t.column :name, :string&lt;br/&gt;      t.column :car_type_id, :int&lt;br/&gt;    end&lt;br/&gt;  end&lt;br/&gt;&lt;br/&gt;  def self.down&lt;br/&gt;    drop_table :cars&lt;br/&gt;  end&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;Then, you can write code like this:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;c = Car.find(1)&lt;br/&gt;c.car_type&lt;br/&gt;=&gt; #&lt;CarType:0xb70f05c0 @attributes={"name"=&gt;"sedan", "id"=&gt;"1"}&gt;&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;I like to simply even more, so I generally add a method like this to the Car model:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;def type&lt;br/&gt;  car_type.name&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;Resulting in the following:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;c.type&lt;br/&gt;=&gt; "sedan"&lt;/pre&gt;&lt;br/&gt;And thats it!&lt;br/&gt;&lt;br/&gt;You might be interested to know that you &lt;em&gt;can&lt;/em&gt; add a corresponding has_many to the CarType model to easily find all Cars of a particular type:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;CarType &lt; ActiveRecord::Base&lt;br/&gt;  has_many :cars&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;And then call something like:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;CarType.find(1).cars&lt;br/&gt;=&gt; [#&lt;Car:0xb70f4c88 @attributes={"name"=&gt;"Test car 1", "id"=&gt;"1", "car_type_id"=&gt;"1"}&gt;]&lt;br/&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-2822378277751876998?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/2822378277751876998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/how-to-create-lookup-table-in-ruby-on.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/2822378277751876998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/2822378277751876998'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/how-to-create-lookup-table-in-ruby-on.html' title='How to create a lookup table in Ruby on Rails'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-500579539060228466</id><published>2007-10-18T12:49:00.000-07:00</published><updated>2011-02-09T18:14:30.501-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>New version of Rails available</title><content type='html'>If you didn't know already, there is a new version of &lt;a href="http://weblog.rubyonrails.org/2007/10/12/rails-1-2-5-maintenance-release"&gt;Rails out there&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;And I'm not referring to the &lt;a href="http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release"&gt;Rails 2.0 preview&lt;/a&gt;. This is Rails 1.2.5, which contains fixes for a JSON XSS (cross-site scripting) vulnerability. I'm not horribly familiar with the details, but the site does say that you don't have to worry about it if you're not using JSON. Probably a good idea to &lt;a href="http://www.rubyonrails.org/down"&gt;upgrade&lt;/a&gt; anyway.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-500579539060228466?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/500579539060228466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/new-version-of-rails-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/500579539060228466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/500579539060228466'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/new-version-of-rails-available.html' title='New version of Rails available'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-4821163872039405487</id><published>2007-10-15T16:05:00.000-07:00</published><updated>2011-02-09T18:14:30.354-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Who the heck is 142.166.3.122 and 142.166.3.123 (radianrss-1.0)?</title><content type='html'>I've been perusing through my logs lately and found the user agent "radianrss-1.0" numerous times. I'd never heard of this program (maybe an RSS reader?), so I did a &lt;a href="http://www.google.com/search?q=radianrss"&gt;google search&lt;/a&gt;. The only commentary I found was &lt;a href="http://c0nsumer.livejournal.com/1061555.html"&gt;this post&lt;/a&gt; speculating that 142.166.3.123 was possibly involved in the compromise of katester.net.&lt;br/&gt;&lt;br/&gt;Interestingly enough, the rest of the search results are the traffic statistics pages of various Wordpress blogs around the Internet. There doesn't seem to be a clear answer for what "radianrss" is, or why 142.166.3.122-123 is constantly indexing all of my blog posts.&lt;br/&gt;&lt;br/&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;[evian]$ grep "142.166.3.123" access.log&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:01:02:23 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14022 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:01:52:14 -0700] "GET /feed/atom/ HTTP/1.1" 200 36826 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:03:36:42 -0700] "GET /feed/atom/ HTTP/1.1" 200 36826 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:04:02:18 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14023 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:06:23:53 -0700] "GET /2007/10/06/the-new-ubuntu-is-coming-already/ HTTP/1.1" 200 10915 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:07:00:07 -0700] "GET /2007/10/07/apt-get-does-have-an-option-for-automatic-security-updates/ HTTP/1.1" 200 12223 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:07:01:49 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14023 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:07:57:22 -0700] "GET /2007/10/08/use-mozilla-firefox-under-wine-to-reach-those-windows-only-sites/ HTTP/1.1" 200 13046 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:09:06:34 -0700] "GET /2007/10/12/rails-ruby-scriptconsole-has-tab-completion/ HTTP/1.1" 200 16010 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:09:17:26 -0700] "GET /feed/atom/ HTTP/1.1" 200 13032 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:09:27:21 -0700] "GET /feed/atom/ HTTP/1.1" 200 36826 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:10:02:07 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14022 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:10:17:18 -0700] "GET /2007/10/14/slow-ssh-logins-in-ubuntu-feisty-704/ HTTP/1.1" 200 12895 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:12:46:43 -0700] "GET /2007/10/13/use-ps2pdf-to-create-pdfs-from-any-linux-application/ HTTP/1.1" 200 11739 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:13:01:23 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14022 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:13:03:56 -0700] "GET /2007/10/14/slow-ssh-logins-in-ubuntu-feisty-704/ HTTP/1.1" 200 12882 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:14:32:48 -0700] "GET /feed/atom/ HTTP/1.1" 200 36826 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:15:08:14 -0700] "GET /feed/atom/ HTTP/1.1" 200 36825 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:15:08:21 -0700] "GET /2007/10/14/slow-ssh-logins-in-ubuntu-feisty-704/ HTTP/1.1" 200 12894 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:15:08:26 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14014 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:16:01:29 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14023 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:16:03:03 -0700] "GET /2007/10/14/slow-ssh-logins-in-ubuntu-feisty-704/ HTTP/1.1" 200 12882 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:18:29:20 -0700] "GET /2007/10/14/slow-ssh-logins-in-ubuntu-feisty-704/ HTTP/1.1" 200 12901 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:18:29:21 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14008 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:18:47:46 -0700] "GET /feed/atom/ HTTP/1.1" 200 36826 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:19:01:27 -0700] "GET /2007/10/14/if-youre-not-already-start-using-dd-wrt/ HTTP/1.1" 200 14028 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:19:02:41 -0700] "GET /2007/10/14/slow-ssh-logins-in-ubuntu-feisty-704/ HTTP/1.1" 200 12896 "-" "radianrss-1.0"&lt;br/&gt;142.166.3.123 - - [15/Oct/2007:19:49:08 -0700] "GET /feed/atom/ HTTP/1.1" 200 36818 "-" "radianrss-1.0"&lt;/pre&gt;&lt;br/&gt;This is traffic just from today - less than 24 hours! Looking back a little further I also found&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;142.166.3.123 - - [14/Oct/2007:17:35:13 -0700] "GET /2007/10/14/slow-ssh-logins-in-ubuntu-feisty-704 HTTP/1.1" 200 450 "-" "Java/1.5.0_11"&lt;/pre&gt;&lt;br/&gt;which has decided to use Java 1.5 as its user agent string.&lt;br/&gt;&lt;br/&gt;I'm curious to know why this IP address is retrieving all of my (and others') Wordpress blog(s), and why so frequently. Its not like the page has changed between each retrieval. Have you found this IP address in your logs, the "radianrss-1.0" user agent string, or anything else of interest?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-4821163872039405487?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/4821163872039405487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/who-heck-is-1421663122-and-1421663123.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/4821163872039405487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/4821163872039405487'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/who-heck-is-1421663122-and-1421663123.html' title='Who the heck is 142.166.3.122 and 142.166.3.123 (radianrss-1.0)?'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-8887475321107627097</id><published>2007-10-14T15:02:00.000-07:00</published><updated>2011-02-09T18:14:30.318-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wrt54g'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>If you're not already, START USING DD-WRT!</title><content type='html'>&lt;pre&gt;&lt;br/&gt;==========================================================&lt;br/&gt;&lt;br/&gt; ____  ___    __        ______ _____         ____  _____&lt;br/&gt; | _ \| _ \   \ \      / /  _ \_   _| __   _|___ \|___ /&lt;br/&gt; || | || ||____\ \ /\ / /| |_) || |   \ \ / / __) | |_ \&lt;br/&gt; ||_| ||_||_____\ V  V / |  _ &amp;lt; | |    \ V / / __/ ___) |&lt;br/&gt; |___/|___/      \_/\_/  |_| \_\|_|     \_/ |_____|____/ &lt;br/&gt;&lt;br/&gt;                       DD-WRT v23 SP2&lt;br/&gt;                   http://www.dd-wrt.com&lt;br/&gt;&lt;br/&gt;==========================================================&lt;/pre&gt;&lt;br/&gt;I installed &lt;a href="http://www.dd-wrt.com"&gt;dd-wrt&lt;/a&gt; on my Linksys WRT54g because I was having problems with the &lt;a href="http://sveasoft.com"&gt;Sveasoft&lt;/a&gt; Alchemy firmware. The wireless was dropping constantly, which can be real annoying when you're trying to do a video call on Skype. My suspicion was that the firmware image was too large and too many services were trying to be run at once, and the unit was running out of memory.&lt;br/&gt;&lt;br/&gt;Once long ago I had problems with the Alchemy firmware getting an IP address from my DSL connection. I managed to get syslog working  (shouldn't have been hard, but it didn't work well with Alchemy) and the errors seemed to point to the fact that the unit was running out of memory. It would eventually work, it just took 20 minutes to get an IP address after it booted. Then it would stay up for months.&lt;br/&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2007/10/dd-wrt-status.png" title="dd-wrt status page"&gt;&lt;/a&gt;&lt;br/&gt;&lt;p style="text-align: center"&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2007/10/dd-wrt-status.png" title="dd-wrt status page"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2007/10/dd-wrt-status.png" alt="dd-wrt status page" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;I guess I've just been out of the loop with regard to the newer firmwares. dd-wrt has much of the same basic functionality in their 'mini' version as the Sveasoft Alchemy fully featured version did. And to think that at point I paid for Alchemy because I wanted a more featureful, stable firmware  :|&lt;br/&gt;&lt;br/&gt;The wireless issues have gone away, and the web interface has a much more polished feel to it. I like logging into the router just to look at the interface and see the random stats. It also gives you status on the signal strength of the wireless clients, which can be very useful!&lt;br/&gt;&lt;br/&gt;The dd-wrt firmware is famous for being able to do client mode bridging, i.e. act as a transparent wired-to-wireless bridge. I'm looking forward to trying that out some day.&lt;br/&gt;&lt;br/&gt;By the way, although my unit will broadcast at a power of 251mW, I read on the &lt;a href="http://www.dd-wrt.com/wiki/index.php/Index:FAQ#How_can_I_increase_my_wireless_range.3F"&gt;dd-wrt wiki&lt;/a&gt; that 84mW is ideal for most hardware in terms of getting the best signal-to-noise ratio. At 84mW, I get a SNR of somewhere between 30-40, so I feel like that is probably pretty accurate information, considering I probably only need a SNR of 10-15 to get a very good wireless signal.&lt;br/&gt;&lt;br/&gt;Try out dd-wrt today!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-8887475321107627097?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/8887475321107627097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/if-you-not-already-start-using-dd-wrt.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/8887475321107627097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/8887475321107627097'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/if-you-not-already-start-using-dd-wrt.html' title='If you&amp;#39;re not already, START USING DD-WRT!'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-281446682072903284</id><published>2007-10-14T13:10:00.000-07:00</published><updated>2011-02-09T18:14:30.274-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Slow SSH logins in Ubuntu Feisty (7.04)</title><content type='html'>There are two major reasons (I know of) that can cause extremely slow SSH logins - anywhere in the range of 15-30 seconds. It doesn't seem like a long time, but it takes forever to wait that out sitting at the terminal.&lt;br/&gt;&lt;h2&gt;&lt;strong&gt;Say no to GSSAPIAuthentication&lt;/strong&gt;&lt;/h2&gt;&lt;br/&gt;For some reason,  GSSAPIAuthentication is turned on by default in Ubuntu Feisty (7.04). If you ssh -v somewhere.com, you'll see this in the output:&lt;br/&gt;&lt;pre&gt;...&lt;br/&gt;debug1: Local version string SSH-2.0-OpenSSH_4.3p2 Debian-8ubuntu1&lt;br/&gt;debug1: An invalid name was supplied&lt;br/&gt;Cannot determine realm for numeric host address&lt;br/&gt;&lt;br/&gt;debug1: An invalid name was supplied&lt;br/&gt;A parameter was malformed&lt;br/&gt;Validation error&lt;br/&gt;&lt;br/&gt;debug1: An invalid name was supplied&lt;br/&gt;Cannot determine realm for numeric host address&lt;br/&gt;&lt;br/&gt;debug1: An invalid name was supplied&lt;br/&gt;A parameter was malformed&lt;br/&gt;Validation error&lt;br/&gt;&lt;br/&gt;debug1: SSH2_MSG_KEXINIT sent&lt;br/&gt;...&lt;/pre&gt;&lt;br/&gt;There are two ways to fix it. You can edit either &lt;strong&gt;/etc/ssh/ssh_config&lt;/strong&gt; to include&lt;br/&gt;&lt;pre&gt;GSSAPIAuthentication no&lt;/pre&gt;&lt;br/&gt;Or, you can edit &lt;strong&gt;~/.ssh/config&lt;/strong&gt; and add the same line. The only difference is that &lt;strong&gt;/etc/ssh/ssh_config&lt;/strong&gt; will affect all systems users - probably a good thing.&lt;br/&gt;&lt;h2&gt;&lt;strong&gt;Slow/broken DNS lookups&lt;/strong&gt;&lt;/h2&gt;&lt;br/&gt;Each time you log into an OpenSSH server, it will typically perform a reverse-lookup on your IP address and store it in wtmp (try running the command "last"). If that DNS lookup times out, you'll be in for a big delay. Whats worse, OpenSSH has a habit of performing the lookup 3 or 4 times, further extending the delay to 30 seconds or more.&lt;br/&gt;&lt;br/&gt;Its generally best to fix the source of the problem by fixing whatever problem exists in your DNS infrastructure. This could be as simple as pointing /etc/resolv.conf to the correct nameserver.&lt;br/&gt;&lt;br/&gt;If you're really in a bind, you can pass the &lt;strong&gt;-u0&lt;/strong&gt; flag to sshd. Unfortunately, the sshd man page does not reveal any config file options to accomplish the same thing. But, the -u0 flag will stop sshd from performing any lookups that are not absolutely necessary as part of the authentication mechanism.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-281446682072903284?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/281446682072903284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/slow-ssh-logins-in-ubuntu-feisty-704.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/281446682072903284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/281446682072903284'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/slow-ssh-logins-in-ubuntu-feisty-704.html' title='Slow SSH logins in Ubuntu Feisty (7.04)'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-1833700216504151060</id><published>2007-10-13T03:47:00.000-07:00</published><updated>2011-02-09T18:14:30.262-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Use ps2pdf to create PDFs from any Linux application</title><content type='html'>If you want to share a PDF of a web page or any other document with another person, PDF is usually the way to go. There are &lt;a href="http://pdf995.com/"&gt;free PDF printers&lt;/a&gt; out there for Windows, but fortunately the necessary software is probably already installed on your Linux distribution. Just use &lt;strong&gt;ps2pdf&lt;/strong&gt;.&lt;br/&gt;&lt;br/&gt;First, print from your application (ie. Firefox) and make sure to check "Print to file":&lt;br/&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2007/10/screenshot-print.png" title="Print to file"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2007/10/screenshot-print.png" alt="Print to file" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Press Print, save the file as filename.ps , and then run the following command:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;$ ps2pdf filename.ps&lt;/pre&gt;&lt;br/&gt;The resulting file will be filename.pdf.&lt;br/&gt;&lt;br/&gt;This is also a good way to convert old PS files (which can get pretty large) to the smaller PDF format. And, if for some reason you want to go the other direction, you can always use the &lt;strong&gt;pdf2ps&lt;/strong&gt; utility.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-1833700216504151060?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/1833700216504151060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/use-ps2pdf-to-create-pdfs-from-any.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/1833700216504151060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/1833700216504151060'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/use-ps2pdf-to-create-pdfs-from-any.html' title='Use ps2pdf to create PDFs from any Linux application'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3183937043482120644</id><published>2007-10-12T11:48:00.000-07:00</published><updated>2011-02-09T18:14:30.248-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Rails' ruby script/console has tab completion!</title><content type='html'>While I recently found out about Ruby's 'methods' method, I also found that Rails' "ruby script/console" will do tab completion:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;&amp;gt;&amp;gt; a = Array.new&lt;br/&gt;=&amp;gt; []&lt;br/&gt;&amp;gt;&amp;gt; a.&lt;br/&gt;Display all 157 possibilities? (y or n)&lt;br/&gt;a.fetch                              a.method                             a.slice&lt;br/&gt;a.__id__                             a.fill                               a.methods                            a.slice!&lt;br/&gt;a.__send__                           a.find                               a.min                                a.sort&lt;br/&gt;a.all?                               a.find_all                           a.nil?                               a.sort!&lt;br/&gt;a.any?                               a.first                              a.nitems                             a.sort_by&lt;br/&gt;a.assoc                              a.flatten                            a.object_id                          a.split&lt;br/&gt;a.at                                 a.flatten!                           a.pack                               a.subclasses_of&lt;br/&gt;a.b64encode                          a.freeze                             a.partition                          a.sum&lt;br/&gt;a.blank?                             a.frozen?                            a.pop                                a.suppress&lt;br/&gt;a.class                              a.gem                                a.pretty_inspect                     a.taguri&lt;br/&gt;a.clear                              a.grep                               a.pretty_print                       a.taguri=&lt;br/&gt;a.clone                              a.group_by                           a.pretty_print_cycle                 a.taint&lt;br/&gt;a.collect                            a.hash                               a.pretty_print_inspect               a.tainted?&lt;br/&gt;a.collect!                           a.id                                 a.pretty_print_instance_variables    a.to_a&lt;br/&gt;a.compact                            a.in_groups_of                       a.private_methods                    a.to_ary&lt;br/&gt;a.compact!                           a.include?                           a.protected_methods                  a.to_default_s&lt;br/&gt;a.concat                             a.index                              a.public_methods                     a.to_formatted_s&lt;br/&gt;a.copy_instance_variables_from       a.index_by                           a.push                               a.to_json&lt;br/&gt;a.daemonize                          a.indexes                            a.rassoc                             a.to_param&lt;br/&gt;a.dclone                             a.indices                            a.reject                             a.to_s&lt;br/&gt;a.decode64                           a.inject                             a.reject!                            a.to_sentence&lt;br/&gt;a.decode_b                           a.insert                             a.remove_subclasses_of               a.to_set&lt;br/&gt;a.delete                             a.inspect                            a.replace                            a.to_xml&lt;br/&gt;a.delete_at                          a.instance_eval                      a.require                            a.to_yaml&lt;br/&gt;a.delete_if                          a.instance_exec                      a.require_gem                        a.to_yaml_properties&lt;br/&gt;a.detect                             a.instance_of?                       a.require_library_or_gem             a.to_yaml_style&lt;br/&gt;a.display                            a.instance_values                    a.respond_to?                        a.transpose&lt;br/&gt;a.dup                                a.instance_variable_get              a.returning                          a.type&lt;br/&gt;a.each                               a.instance_variable_set              a.reverse                            a.uniq&lt;br/&gt;a.each_index                         a.instance_variables                 a.reverse!                           a.uniq!&lt;br/&gt;a.each_with_index                    a.is_a?                              a.reverse_each                       a.unloadable&lt;br/&gt;a.empty?                             a.join                               a.rindex                             a.unshift&lt;br/&gt;a.enable_warnings                    a.kind_of?                           a.select                             a.untaint&lt;br/&gt;a.encode64                           a.last                               a.send                               a.values_at&lt;br/&gt;a.entries                            a.length                             a.shift                              a.with_options&lt;br/&gt;a.eql?                               a.load                               a.silence_stderr                     a.yaml_initialize&lt;br/&gt;a.equal?                             a.map                                a.silence_stream                     a.zip&lt;br/&gt;a.extend                             a.map!                               a.silence_warnings&lt;br/&gt;a.extend_with_included_modules_from  a.max                                a.singleton_methods&lt;br/&gt;a.extended_by                        a.member?                            a.size&lt;/pre&gt;&lt;br/&gt;Unfortunately the same thing doesn't work for the irb. Of course you can always&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;a.methods.sort&lt;/pre&gt;&lt;br/&gt;to see the same information.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3183937043482120644?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3183937043482120644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/rails-ruby-scriptconsole-has-tab.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3183937043482120644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3183937043482120644'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/rails-ruby-scriptconsole-has-tab.html' title='Rails&amp;#39; ruby script/console has tab completion!'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-5632550799617023751</id><published>2007-10-10T16:23:00.000-07:00</published><updated>2011-02-09T18:14:30.149-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Convert has_and_belongs_to_many to a has_many :through association</title><content type='html'>So there are plenty of resources out there to &lt;a href="http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off"&gt;learn&lt;/a&gt; &lt;a href="http://matthewman.net/2006/01/06/rails-activerecord-goes-through/"&gt;how&lt;/a&gt; to use has_many :through associations.&lt;br/&gt;&lt;br/&gt;I followed them over and over again but couldn't get my code to work. I knew I had the basic structure setup correctly, since the examples are pretty straightforward, and the concept is not difficult. My has_and_belongs_to_many code originally looked like this:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;class Soda &lt; ActiveRecord::Base&lt;br/&gt;  has_and_belongs_to_many :distributors&lt;br/&gt;end&lt;br/&gt;&lt;br/&gt;class Distributor &lt; ActiveRecord::Base&lt;br/&gt;  has_and_belongs_to_many :sodas&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;Of course there was also a many-to-many join table migration:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;class DistributorsSodasJoinTable &lt; ActiveRecord::Migration&lt;br/&gt;  def self.up&lt;br/&gt;    create_table :distributors_sodas, :id =&gt; false do |t|&lt;br/&gt;      t.column :soda_id, :int&lt;br/&gt;      t.column :distributor_id, :int&lt;br/&gt;    end&lt;br/&gt;  end  &lt;br/&gt;&lt;br/&gt;  def self.down&lt;br/&gt;    drop_table :distributors_sodas&lt;br/&gt;  end&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;This works quite nicely:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;&gt;&gt; Soda.find(1).distributors&lt;br/&gt;=&gt; []&lt;/pre&gt;&lt;br/&gt;Later found that I needed to add attributes in the join table to associate extra fields on the Distributors &lt;-&gt; Sodas relationship. has_and_belongs_to_many does not have a Rails way to access those extra fields in the join table. I've successfully done it through SQL, but much guilt and remorse lead me to finally learn has_many :through.&lt;br/&gt;&lt;br/&gt;This was my best initial attempt:&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;class Soda &lt; ActiveRecord::Base&lt;br/&gt;  has_many :distributors_sodas&lt;br/&gt;  has_many :distributors, :through =&gt;; :distributors_sodas&lt;br/&gt;end&lt;br/&gt;&lt;br/&gt;class Distributor &lt; ActiveRecord::Base&lt;br/&gt;  has_many :distributors_sodas&lt;br/&gt;  has_many :distributors, :through =&gt; :distributors_sodas&lt;br/&gt;end&lt;br/&gt;&lt;br/&gt;class DistributorsSodas &lt; ActiveRecord::Base&lt;br/&gt;  belongs_to :soda&lt;br/&gt;  belongs_to :distributor&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;All goes well until I try to do a quick test:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;&gt;&gt; Soda.find(1).distributors&lt;br/&gt;NameError: uninitialized constant Soda::DistributorsSoda&lt;br/&gt;...&lt;br/&gt;        from (irb):4&lt;/pre&gt;&lt;br/&gt;Umm... what? I never tried to instantiate an object of the type Soda::DistributorsSoda. Instead, I was simply trying to use the DistributorsSodas ActiveRecord object, right?&lt;br/&gt;&lt;br/&gt;It turns out that has_many :through (apparently) can't handle using the join tables created by has_and_belongs_to_many. Its just a naming issue - has_many :through will work fine using a one-to-many join table like distributor_sodas (note the missing 's' on distributor). If you need a many-to-many join, you have to rename the table to fix the (pluralization?) problem. I deleted the DistributorsSodas model and created the Store model.&lt;br/&gt;&lt;pre lang="ruby"&gt;&lt;br/&gt;class Soda &lt; ActiveRecord::Base&lt;br/&gt;  has_many :stores&lt;br/&gt;  has_many :distributors, :through =&gt; :stores&lt;br/&gt;end&lt;br/&gt;&lt;br/&gt;class Distributor &lt; ActiveRecord::Base&lt;br/&gt;  has_many :stores&lt;br/&gt;  has_many :sodas, :through =&gt; :stores&lt;br/&gt;end&lt;br/&gt;&lt;br/&gt;class Store &lt; ActiveRecord::Base&lt;br/&gt;  belongs_to :soda&lt;br/&gt;  belongs_to :distributor&lt;br/&gt;end&lt;/pre&gt;&lt;br/&gt;This proved a much better result:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;&gt;&gt; Soda.find(1).distributors&lt;br/&gt;=&gt; []&lt;/pre&gt;&lt;br/&gt;In the end, the association naming convention actually make more sense. I was bummed to have to change the table/model names though.&lt;br/&gt;&lt;br/&gt;Please comment if you know how to create the association without changing the model name.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-5632550799617023751?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/5632550799617023751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/convert-hasandbelongstomany-to-hasmany.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/5632550799617023751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/5632550799617023751'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/convert-hasandbelongstomany-to-hasmany.html' title='Convert has_and_belongs_to_many to a has_many :through association'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-8113815377212846336</id><published>2007-10-08T11:42:00.000-07:00</published><updated>2011-02-09T18:14:30.122-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='wine'/><title type='text'>Use Mozilla Firefox under WINE to reach those Windows-only sites</title><content type='html'>&lt;a href="http://blog.layer2.org/wp-content/uploads/2007/10/denied.png" title="Being denied based on operating system"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2007/10/denied.png" alt="Being denied based on operating system" align="right" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Its long been known that you can use something like the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/59"&gt;User Agent Switcher&lt;/a&gt; to make it appear like you're using a different operating system than you really are. This can be useful on some websites that insist you need to run Windows - when in fact Linux or practically any other operating system will work fine.&lt;br/&gt;&lt;br/&gt;But for those sites that are actually telling the truth, you can often run Firefox under WINE with very good results. Just head over to &lt;a href="http://www.getfirefox.com"&gt;www.getfirefox.com&lt;/a&gt; and download the Windows binary. The site actually does its own OS detection, so you'll probably want to choose "Other Systems and Languages." Once you have it, make sure you have WINE installed. I also installed the MS truetype fonts because it looks terrible otherwise.&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;# apt-get install wine msttcorefonts&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;And then start the installer&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;$ wine Firefox\ Setup\ 2.0.0.7.exe&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;You'll go through the normal install process, and when you're finished you'll see a new Firefox icon on your Linux desktop:&lt;br/&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2007/10/firefox-icon.png" title="Windows Firefox on my Linux desktop"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2007/10/firefox-icon.png" alt="Windows Firefox on my Linux desktop" border="0" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Double-click it and you should be good to go! If you want to visit a site with audio, you'll want to run &lt;strong&gt;winecfg&lt;/strong&gt;, visit the Audio tab, choose your settings (I just left the defaults) and click Apply. Otherwise you might run into some issues with Firefox crashing. If its any consolation, Firefox will crash on &lt;a href="http://byu.tv"&gt;certain sites&lt;/a&gt; powered by &lt;a href="http://www.movenetworks.com/"&gt;Move Networks&lt;/a&gt; in Windows, too, if there is no audio driver installed. This is probably related to the Firefox extension you must install to view the site.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-8113815377212846336?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/8113815377212846336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/use-mozilla-firefox-under-wine-to-reach.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/8113815377212846336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/8113815377212846336'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/use-mozilla-firefox-under-wine-to-reach.html' title='Use Mozilla Firefox under WINE to reach those Windows-only sites'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3286875266100511753</id><published>2007-10-07T08:02:00.000-07:00</published><updated>2011-02-09T18:14:30.093-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Apt-get DOES have an option for automatic security updates</title><content type='html'>I recently wrote about the cron job that I run to keep my &lt;a href="http://blog.layer2.org/2007/09/25/automatic-updates-in-debian-linux-etch/"&gt;Debian and Debian-like servers up to date automatically&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;It turns out that apt-get (or libapt, more specifically) has a mechanism to automatically download and install security updates. This will work across package management applications (apt-get, synaptic, aptitude, etc) and is very simple to setup. Edit &lt;strong&gt;/etc/apt/apt.conf.d/10periodic&lt;/strong&gt; to include the following:&lt;br/&gt;&lt;br/&gt;&lt;code&gt;APT::Periodic::Update-Package-Lists "1";&lt;br/&gt;APT::Periodic::Download-Upgradeable-Packages "1";&lt;br/&gt;APT::Periodic::AutocleanInterval "0";&lt;br/&gt;APT::Periodic::Unattended-Upgrade "1";&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Your distribution should already have a cron job (usually in /etc/cron.daily/apt) that runs every day and updates as per these configuration options. To see the entire config, run&lt;br/&gt;&lt;br/&gt;&lt;code&gt;$ apt-config dump&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;For those interested, this configuration setting is what Synaptic sets when using its "Install security updates without confirmation" option.&lt;br/&gt;&lt;br/&gt;&lt;a href="http://thingsiforget.blogspot.com/2007/08/apt-update-notifier-automatic-package.html"&gt;Thanks to g for pointing this out&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3286875266100511753?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3286875266100511753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/apt-get-does-have-option-for-automatic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3286875266100511753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3286875266100511753'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/apt-get-does-have-option-for-automatic.html' title='Apt-get DOES have an option for automatic security updates'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-1537246371211155504</id><published>2007-10-06T16:43:00.000-07:00</published><updated>2011-02-09T18:14:30.083-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>The new Ubuntu is coming already</title><content type='html'>If you didn't already know, Ubuntu 7.10 Gutsy Gibbon will be coming soon!&lt;br/&gt;&lt;br/&gt;&lt;script src="http://www.ubuntu.com/files/countdown/dist/display.js" type="text/javascript"&gt;&lt;/script&gt;&lt;br/&gt;&lt;br/&gt;Maybe I'll finally get suspend support for my dual core Dell XPS desktop?&lt;br/&gt;&lt;br/&gt;Any guesses if the Ruby and Rails packaging will be any better?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-1537246371211155504?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/1537246371211155504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/new-ubuntu-is-coming-already.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/1537246371211155504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/1537246371211155504'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/new-ubuntu-is-coming-already.html' title='The new Ubuntu is coming already'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3706476700468280929</id><published>2007-10-04T16:29:00.000-07:00</published><updated>2011-02-09T18:14:30.070-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Using syntax enable and other vim commands in Ubuntu and Debian</title><content type='html'>So I ran into the strangest thing today. Vim complains because I tried to use 'syntax enable' in my .vimrc.&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;$ vim myfile.rb&lt;br/&gt;Error detected while processing /home/solipsistic/.vimrc:&lt;br/&gt;line    1:&lt;br/&gt;E319: Sorry, the command is not available in this version: syntax enable&lt;br/&gt;Press ENTER or type command to continue&lt;/pre&gt;&lt;br/&gt;Apparently Debian-like distributions don't package the full version of vim by default. They pack a 'lite' version.&lt;br/&gt;&lt;pre&gt;# apt-get install vim&lt;/pre&gt;&lt;br/&gt;And you'll be rolling again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3706476700468280929?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3706476700468280929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/using-syntax-enable-and-other-vim.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3706476700468280929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3706476700468280929'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/using-syntax-enable-and-other-vim.html' title='Using syntax enable and other vim commands in Ubuntu and Debian'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-6647292246013883372</id><published>2007-10-02T17:00:00.000-07:00</published><updated>2011-02-09T18:14:30.046-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Installing Mongrel on Ubuntu Feisty with rubygems</title><content type='html'>When I recently re-installed Ubuntu 7.04 (Feisty), I found that I couldn't build the native fastthread gem (a required dependency). If you get this error:&lt;br/&gt;&lt;code&gt;&lt;br/&gt;Building native extensions.  This could take a while...&lt;br/&gt;extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)&lt;br/&gt;from extconf.rb:1&lt;/code&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;ERROR:  While executing gem ... (RuntimeError)&lt;br/&gt;ERROR: Failed to build gem native extension.&lt;br/&gt;Gem files will remain installed in /var/lib/gems/1.8/gems/fastthread-1.0 for inspection.&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;then you need the ruby development libraries and the build-essential package. I've found that these commands will make sure mongrel (and rails) is installed correctly:&lt;br/&gt;&lt;code&gt;&lt;br/&gt;$ sudo apt-get install ruby1.8-dev rubygems build-essential rails&lt;br/&gt;$ sudo gem install mongrel --include-dependencies&lt;br/&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-6647292246013883372?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/6647292246013883372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/installing-mongrel-on-ubuntu-feisty.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6647292246013883372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/6647292246013883372'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/installing-mongrel-on-ubuntu-feisty.html' title='Installing Mongrel on Ubuntu Feisty with rubygems'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3402307395200836191</id><published>2007-10-01T16:51:00.000-07:00</published><updated>2011-02-09T18:14:30.012-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Using the Ubuntu Feisty Live CD as your primary OS</title><content type='html'>I had one of the most dreaded computer woes happen last week - my hard drive crashed.&lt;br/&gt;&lt;br/&gt;Well, it didn't crash completely. I have about a 70% boot rate. It makes a load noise like the bearings aren't well lubricated when the drive won't boot. I figured it was better (and less frustrating) to stop using the drive and just wait until the &lt;a href="http://www.newegg.com/Product/Product.asp?Item=N82E16822149040"&gt;new hard drive&lt;/a&gt; arrived.&lt;br/&gt;&lt;br/&gt;Luckily, I use &lt;a href="http://www.cis.upenn.edu/~bcpierce/unison/"&gt;unison&lt;/a&gt; over SSH to backup my files, so everything was already mirrored on my Debian file server at home, even though I was across the country when the failure occured. I've reminded myself that I needed to have my data backed up if something catastrophic ever happened to my laptop. In my mind the scenario was that my laptop was going to be run over by a truck (gotta think big), but I knew the hard drive crash was probably inevitable. Unison is a good tool to sync two file systems, however it does work best if you manually sync. If you want something to automatically back up files, set up &lt;a href="http://samba.anu.edu.au/rsync/"&gt;rsync&lt;/a&gt; as a cron job on your system.&lt;br/&gt;&lt;h2&gt;&lt;strong&gt;Coping with the problem&lt;/strong&gt;&lt;/h2&gt;&lt;br/&gt;At first, I thought I should just go without my laptop for a few days (oh the horror!). Newegg ships fast, right? I should have known myself better than that. I immediately started thinking of how to run my system with a broken hard drive. Naturally, the idea of using a Linux Live CD came to mind.&lt;br/&gt;&lt;br/&gt;To preserve the old hard drive, I physically removed it from the laptop. After that, I remembered I had ordered some Ubuntu 7.04 pressed CDs a while back so I popped one in.&lt;br/&gt;&lt;br/&gt;To my surprise, Ubuntu 7.04 (Feisty) as a Live CD rivals my normal hard drive install in terms of performance! The bootup time is quite slow, but once it has started, it runs nicely. Since I spend a lot of time using Firefox, I don't experience the spin-up-spin-down as often as I remember in previous Live CD usage. I think Feisty must also do a good job of caching programs in RAM when you first access them because I hardly ever hear the CD drive spin up unless I'm starting a new program.&lt;br/&gt;&lt;br/&gt;The other nice thing is that the laptop fan almost never turns on. The old hard drive ran somewhat noisy and warm, causing the fan system to kick on about 75% of the time. I've really enjoyed the cool, quiet performance of running on a Live CD. The laptop is absolutely silent.&lt;br/&gt;&lt;br/&gt;The only real obstacle I've faced is that I can't shutdown my laptop unless I want to spend time re-setting up my Thunderbird profile and re-installing Firefox extensions. I guess you can't have everything.&lt;br/&gt;&lt;h2&gt;&lt;strong&gt;Why not switch completely?&lt;/strong&gt;&lt;/h2&gt;&lt;br/&gt;If this setup works so well, I thought to myself, why not just switch to always using a Live CD and save $60 on a new hard drive? After thinking about it, I've decided that I would be willing to switch if a few conditions were met:&lt;br/&gt;&lt;ol&gt;&lt;br/&gt;	&lt;li&gt;A decent amount of persistent storage were possible&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;I could install updates and new software without losing them each time I reboot&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Most or all of the OS could be loaded in RAM at boot&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;&lt;br/&gt;I could probably accomplish #1 with a USB drive and a persistent home directory. I think #2 would be harder with the USB drive - like what happens when you move between systems with the same flash drive - but still possible. In the end, I think I would be happiest by buying a &lt;a href="http://cgi.ebay.com/Compact-Flash-CF-to-44Pin-laptop-IDE-Hard-Drive-Adaptor_W0QQitemZ180163529837QQihZ008QQcategoryZ41993QQssPageNameZWDVWQQrdZ1QQcmdZViewItem"&gt;Compact Flash to IDE adapter&lt;/a&gt; and a large (16GB or more) Compact Flash card. These are nice because you get the cool, quiet operation and persistent operation. I considered doing this instead of getting a new hard drive, but in the end I figured I would get much more storage but the price (80GB @ $60 or 16GB @ $150 or more). In the future I think many laptop hard drives will be completely flash based memory.&lt;br/&gt;&lt;br/&gt;As for #3, I wish that Ubuntu Feisty had the ability to use the "toram" kernel boot option and load the OS into RAM during boot. I've done this with Knoppix CDs in the past. The speed increase is amazing. Granted, less RAM is available for program execution, but RAM is cheap enough these days that the productivity gain is worth the extra couple of dollars.&lt;br/&gt;&lt;br/&gt;All in all, I give the Ubuntu Feisty Linux Live CD a surprisingly high thumbs up for everyday use.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3402307395200836191?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3402307395200836191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/using-ubuntu-feisty-live-cd-as-your.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3402307395200836191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3402307395200836191'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/using-ubuntu-feisty-live-cd-as-your.html' title='Using the Ubuntu Feisty Live CD as your primary OS'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4608182549480930549.post-3785940593211742286</id><published>2007-10-01T14:58:00.000-07:00</published><updated>2011-02-09T18:14:29.974-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='fios'/><title type='text'>Silly Verizon and their creepy new router</title><content type='html'>I recently signed up for the Verizon FIOS service. Its nice, but probably not in the way you'd think. I only have 5 mbps down / 2 mbps up, which is the basic plan, and in my opinion, the only plan that makes financial sense. I just can't see myself paying &lt;a href="http://www22.verizon.com/content/consumerfios/packages+and+prices/packages+and+prices.htm"&gt;$180 per month&lt;/a&gt; for home internet service.&lt;br/&gt;&lt;br/&gt;The nice part about the service is the latency. I have a 12ms ping to Google. I doubt most people get that at home on their cable or DSL lines. The best I've ever had at home was 40ms. At any rate, the low latency helps web pages load that extra bit faster (and it &lt;em&gt;is&lt;/em&gt; noticeable).&lt;br/&gt;&lt;br/&gt;The one thing about their service is their router. Apparently, I'm not the first one that &lt;a href="http://www.mydd.com/story/2006/6/30/113944/311"&gt;thinks it is a little creepy&lt;/a&gt;. Verizon has customized it to provide their IPTV (cable) service as well as perform the normal router functions. I decided to use my &lt;a href="http://en.wikipedia.org/wiki/WRT54G"&gt;Linksys WRT54G&lt;/a&gt; instead.&lt;br/&gt;&lt;br/&gt;If you want to use their IPTV services, I'm willing to bet that you can chain their router behind yours. Just make sure to either change your router's DHCP subnet to something other than 192.168.1.0/24, or change the Verizon router to use a different subnet (ie. 192.168.2.0/24). Most consumer routers will puke if you try to give them a non-routable IP address on their WAN interface in the same subnet as the one they are supposed to give to their own clients. Rightly so, I guess. Please comment about your experience with chaining the Verizon router below your own.&lt;br/&gt;&lt;br/&gt;While setting up my own router, I noticed a few things:&lt;br/&gt;&lt;ol&gt;&lt;br/&gt;	&lt;li&gt;Verizon sets up your router with a random ESSID (network name) and WEP encryption. My tech wrote down the WEP key when she installed the service.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Even if you do stick with the Verizon router, please switch to WPA. WEP is easy enough to crack and won't keep your data secure from a moderately skilled attacker.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;The default login credentials for the router are &lt;strong&gt;admin/password&lt;/strong&gt;. I've also heard some people having success with using "password1" as the password. Please change this the first time you log in.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Verizon uses MAC filtering, so you must spoof/clone the MAC on your router to match the Verizon router.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;There is a MAC address printed on the outside of the router. Unfortunately, this is NOT the MAC address used by the WAN interface on the router. Instead, you must log into the router and choose the "System Monitoring" section (upper-right corner). This will give you what they call a "Broadband MAC Address."&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;&lt;br/&gt;&lt;a href="http://blog.layer2.org/wp-content/uploads/2007/10/verizon-router.png" title="Verizon Router Broadband MAC"&gt;&lt;img src="http://blog.layer2.org/wp-content/uploads/2007/10/verizon-router.thumbnail.png" alt="Verizon Router Broadband MAC" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Once I used the correct MAC address, I was able to get onto the FIOS network using my own router with no problems. They say your own router may not perform as well as theirs, but I didn't notice any difference.&lt;br/&gt;&lt;br/&gt;One last thing: You might notice that each time you type a character in the password field, several characters will appear. A brief look at the code suggests that they are hashing the data as you type. While it is incredibly annoying to have those characters randomly appear, at least they are using BSD-licensed code from a &lt;a href="http://pajhome.org.uk/crypt/md5"&gt;reputable source&lt;/a&gt;. Thank you Paul Johnston!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4608182549480930549-3785940593211742286?l=blog.layer2.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.layer2.org/feeds/3785940593211742286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.layer2.org/2007/10/silly-verizon-and-their-creepy-new.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3785940593211742286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4608182549480930549/posts/default/3785940593211742286'/><link rel='alternate' type='text/html' href='http://blog.layer2.org/2007/10/silly-verizon-and-their-creepy-new.html' title='Silly Verizon and their creepy new router'/><author><name>solipsistic</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
