Lots of Rails books coming soon
The people who market technical books pay attention to the “trends” in technology. The fall of C and C++. The rise of Ruby / Rails. The rise (and fall) of Java. If us technology people “watch the watchers”, we can get a nice warm-and-fuzzy about our current technology choices. For example, look at all the […]
Testing SNMP traps with snmptrapd
If you’ve never worked with SNMP, then you’re in for a treat. Get ready to party like it’s 1988, with nested authentication models, over-designed protocols, and lots of meaningless numbers. Luckily, if all you need to do is write some ruby code to send SNMP traps, you have the snmp gem to help make things […]
Beware rendering multiple partials with layouts
Want to render more than one partial with the same layout in your page? Beware:
‘p1′, :layout => ‘layouts/p_layout’ %>
‘p2′, :layout => ‘layouts/p_layout’ %>
layouts/p_layout.html.erb
<hr/>
_p1.html.erb
Content!
_p2.html.erb
Content!
Did you expect this?
HeaderFor1 Content! FooterFor1
HeaderFor2 Content! FooterFor2
Nope. You get this:
HeaderFor1 Content! FooterFor1
HeaderFor1HeaderFor2 Content! FooterFor1FooterFor2
The instance variables in the layout object retain their values, even between invocations of render. My workaround […]
Rails LOC vs Java LOC
At my last client, we wrote a webservice in Java, it had perhaps 30 service calls and 3 endpoints. We worked on it for about 6 months.
$ find services -name *.java -exec wc {} \; | awk ‘{a+=$1;print a}’ |tail -1
64793
At my current client, we are writing a Rails web application. It’s been a living […]
Generate mod_rails httpd.conf using cap
With all the discussions around the new mod_rails, I thought I’d post the Apache conf that I came up with. Here’s the strategy: generate httpd.conf using cap, upload it to the server, and graceful restart Apache. This way, you don’t have to get your hands dirty logging into the box to reconfigure anything.
Here’s the […]