<?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-4996788660395881900</id><updated>2011-04-21T19:09:42.194-07:00</updated><title type='text'>Bill on Rails</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://billonrails.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://billonrails.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Bill on Rails</name><uri>http://www.blogger.com/profile/03358987378253970176</uri><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>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4996788660395881900.post-5824124987176628258</id><published>2008-02-15T14:52:00.000-08:00</published><updated>2008-02-15T15:06:55.021-08:00</updated><title type='text'>Tip of the day</title><content type='html'>I recently was working some OPC, that is, Other People's Code. It's always entertaining, frequently frustrating and usually enlightening. This other persons code wasn't bad; just a tad ugly. With some many people coming to Ruby, it's amazing how they tend to pervert this nice terse language into something that looks like Java. So the code snippet I worked with looked like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;if gender == 'male'&lt;br /&gt;  return '1'&lt;br /&gt;elsif gender == 'female'&lt;br /&gt;  return '2'&lt;br /&gt;elsif gender.nil?&lt;br /&gt;  return ' '&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So, what we have here is your basic condition block. First of all, the returns are kind of ugly. Any Ruby developer knows that you should hardly ever have to write returns. Okay, I can get rid of the returns; and, maybe I could use a case statement instead of the same. But it's about the same amount of code.&lt;br/&gt;&lt;br /&gt;So I came up with an interesting alternative ... it uses a hash to perform the value translation, and relies on the fact that calling to_s on nil returns an empty string. Here's my one-line solution:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;{'male' =&gt; '1', 'female' =&gt; '2', '' =&gt; ' '}[gender.to_s]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Got a comment about this? Let me know ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4996788660395881900-5824124987176628258?l=billonrails.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billonrails.blogspot.com/feeds/5824124987176628258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4996788660395881900&amp;postID=5824124987176628258' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/5824124987176628258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/5824124987176628258'/><link rel='alternate' type='text/html' href='http://billonrails.blogspot.com/2008/02/tip-of-day.html' title='Tip of the day'/><author><name>Bill on Rails</name><uri>http://www.blogger.com/profile/03358987378253970176</uri><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-4996788660395881900.post-2038879926736011863</id><published>2007-10-03T18:55:00.001-07:00</published><updated>2008-12-09T17:05:11.481-08:00</updated><title type='text'>My Favorite TextMate Ruby Hotkeys</title><content type='html'>I love &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt;. Though some folks may claim that any self-respecting geek should be using Emacs, I find that TextMate often surprises me in ways that make my editing experience  more enjoyable and productive. Here's a review of my current (that is, till I find more)  favorite hot-keys when writing Ruby (and the first two are good in any language). They are easy to remember -- they all start with &lt;span style="font-family:courier new;"&gt;Ctrl-Shift&lt;/span&gt; ...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Ctrl-Shift-&lt;span style="font-weight: bold;"&gt;V&lt;/span&gt; (Validate Syntax)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;This key combination will let you know if your code  is syntactically valid. You can check the syntax for most non-compiled languages that TextMate supports including Ruby, Perl, Python, PHP, HTML, and CSS.&lt;/span&gt;&lt;span style="font-size:100%;"&gt; For developers used to IDEs like Eclipse that constantly provide&lt;/span&gt;&lt;span style="font-size:100%;"&gt; feedback when you make a mistake, this tool is a godsend. Before I run my unit tests, I run Validate Syntax and save myself more time by catching problems, like missing &lt;span style="font-family:courier new;"&gt;end&lt;/span&gt; statements , earlier. When your syntax is valid it tells you everything is Okay -- when something is wrong it takes you right to the source of the error (as best as it can determine).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Ctrl-Shift-&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;T&lt;/span&gt; (TODO List)&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;This key combination generates a &lt;span style="font-style: italic;"&gt;todo&lt;/span&gt; list based on comments&lt;/span&gt;&lt;span style="font-size:100%;"&gt; in your code. &lt;/span&gt;&lt;span style="font-size:100%;"&gt;When you click this key combo, TextMate scans all the files in your current project for comments indicating things to be done&lt;/span&gt;&lt;span style="font-size:100%;"&gt; (TODO), to be fixed (FIXME), or to be changed (CHANGE). All you have to do is preface your comment with TODO, FIXME, or CHANGE and the TODO list can find it. It works for comments in Ruby, HTML, JavaScript and a host of other languages as well. Here's a  sample using an apropos holiday theme ...&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Ziqzqb2vdAc/RwZWFv-eG0I/AAAAAAAAABA/xI0EUmM4ogY/s1600-h/textmate_todo_list.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_Ziqzqb2vdAc/RwZWFv-eG0I/AAAAAAAAABA/xI0EUmM4ogY/s320/textmate_todo_list.png" alt="" id="BLOGGER_PHOTO_ID_5117872683330968386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can even customize what comment tokens are searched. Use the TODO bundle preferences  if you want deviate from the defaults.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;I discovered my final favorite key combo quite by accident. I was reaching for &lt;span style="font-family:courier new;"&gt;Command-Shift-R&lt;/span&gt;, which of course as any self-respecting Rubyist knows will run the current Ruby class  in the  Ruby interpreter (extremely useful for unit tests), when I accidentally hit ...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Ctrl-Shift-&lt;span style="font-weight: bold;"&gt;R&lt;/span&gt;  (RakeMate)&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Ziqzqb2vdAc/RwRZd_-eGzI/AAAAAAAAAAs/yRqU4fiC6_w/s1600-h/rakemate_select.png"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://4.bp.blogspot.com/_Ziqzqb2vdAc/RwRZd_-eGzI/AAAAAAAAAAs/yRqU4fiC6_w/s320/rakemate_select.png" alt="" id="BLOGGER_PHOTO_ID_5117313448524258098" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;This key combo searches for a Rakefile within the current project and let's you choose a Rake task to run. In  this case, I ran the stats task to check on my LOCs PDQ.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The results of the task are then displayed in a separate window.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;All in all, TextMate is a very capable, and lightweight IDE (yes, I said the "I" word) for Ruby.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;**** WARNING: OBLIGATORY FANBOY COMMENT ****&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Take a look at the Ruby and other bundles included with TextMate and you are sure to find shortcuts, and key combos that will make coding Ruby even more &lt;span style="font-style: italic;"&gt;fun&lt;/span&gt; than it already is.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4996788660395881900-2038879926736011863?l=billonrails.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billonrails.blogspot.com/feeds/2038879926736011863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4996788660395881900&amp;postID=2038879926736011863' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/2038879926736011863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/2038879926736011863'/><link rel='alternate' type='text/html' href='http://billonrails.blogspot.com/2007/10/my-favorite-textmate-ruby-hotkeys.html' title='My Favorite TextMate Ruby Hotkeys'/><author><name>Bill on Rails</name><uri>http://www.blogger.com/profile/03358987378253970176</uri><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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Ziqzqb2vdAc/RwZWFv-eG0I/AAAAAAAAABA/xI0EUmM4ogY/s72-c/textmate_todo_list.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4996788660395881900.post-799100559869163092</id><published>2007-10-01T06:26:00.001-07:00</published><updated>2007-10-01T06:27:14.113-07:00</updated><title type='text'>Where is Leopard?</title><content type='html'>It's October 1st ... Do you know where your Leopard is?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4996788660395881900-799100559869163092?l=billonrails.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billonrails.blogspot.com/feeds/799100559869163092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4996788660395881900&amp;postID=799100559869163092' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/799100559869163092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/799100559869163092'/><link rel='alternate' type='text/html' href='http://billonrails.blogspot.com/2007/10/where-is-leopard.html' title='Where is Leopard?'/><author><name>Bill on Rails</name><uri>http://www.blogger.com/profile/03358987378253970176</uri><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-4996788660395881900.post-9151028429189384497</id><published>2007-09-29T22:57:00.000-07:00</published><updated>2007-09-29T22:59:43.097-07:00</updated><title type='text'>Late nights with HTTPerf</title><content type='html'>I have just been trying out HTTPerf against my Rails app, and, for some reason the reply rate I am getting is way low -- only around 10 replies/second.&lt;br /&gt;I also wonder if there is a way to test pages that require the user to login first. My whole application centers around an authenticated user ... well, 2 am and time to go to bed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4996788660395881900-9151028429189384497?l=billonrails.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billonrails.blogspot.com/feeds/9151028429189384497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4996788660395881900&amp;postID=9151028429189384497' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/9151028429189384497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4996788660395881900/posts/default/9151028429189384497'/><link rel='alternate' type='text/html' href='http://billonrails.blogspot.com/2007/09/late-nights-with-httperf.html' title='Late nights with HTTPerf'/><author><name>Bill on Rails</name><uri>http://www.blogger.com/profile/03358987378253970176</uri><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></feed>
