PaulBarry.com's Image

PaulBarry.com

http://paulbarry.com/
More about this blog
Latest Post
24 Feb 2010
Total Posts
18
Readers
275
Liked
0
Disliked
0
Views-Per-Post
15.28
vote up
0
vote down

How to spy on a Hash in Ruby

Let's say you're dealing with a large Rails codebase and you've got a Hash stored in a global variable or a constant and you want to know who is changing that Hash. Here's a contrived example: IMPORTANT_STUFF = { :password => "too many secrets" } def
Feb 24 2010 11:09 PM
vote up
0
vote down

Node.js Presentation

Last week I presented on node.js at the Baltimore/DC JavaScript Users Group. Here's the video: Paul Barry on Node.js at February Baltimore JavaScript Meetup from Shea Frederick on Vimeo. To make it easier to follow along, here are the slides and the code.
Feb 08 2010 10:51 PM
vote up
0
vote down

Sharing a git repo on the network

If you find yourself on a network with other developers you'd like to share a git repo with, here's a simple way to do that. First, on your machine, the one with the git repo, you run this: $ git daemon --base-path=/path/to/dir/with/repo --export-all So
Feb 07 2010 02:55 AM
vote up
0
vote down

Installing DBSlayer on Mac OS X Snow Leopard

DBSlayer is a tool that will wrap your MySQL database with an HTTP REST/JSON API. Here's how to get it installed on Snow Leopard using Macports. First, make sure you have all the dependencies install via Macports: $ sudo port install db46 $ sudo port
Feb 03 2010 03:19 AM
vote up
0
vote down

Node.js talk at Baltimore/JavaScript Users Group

Just a quick heads up that I'll be talking about Node.js at this Wednesday's Baltimore/JavaScript Users Group meeting. This will be an introductory talk but will quickly dive into some code examples with Q & A. The talk, just as node.js itself,
Feb 02 2010 05:46 AM
vote up
0
vote down

Customizing Generators in Rails 3

As you probably already know, Rails 3 is just around the corner. There are some pretty nice features being added and one of them is the ability to customize the way the generators work. I personally prefer Haml over ERB, RSpec over Test::Unit and Factory
Jan 13 2010 11:51 AM
vote up
0
vote down

OH in #RubyOnRails

k1t: ugh after using rails for 3 days learning it i want to shoot myself going back to clients php site Remear: k1t: then you're dumb k1t: no k1t: I mean going back to php k1t: makes me want to shoot myself, lol k1t: didn't quite come out right the first
Jan 09 2010 10:56 PM
vote up
0
vote down

Guarding Logger Statements In Ruby

Whether you are a Java or a Ruby programmer, I'm sure you are familiar with this idiom: require 'logger' log = Logger.new(STDOUT) log.level = Logger::INFO log.debug("hello") log.info("Done") That's a simple logger where the log level is set to info, so
Dec 09 2009 08:45 AM
vote up
0
vote down

Performance Testing with Httperf

If you need to do some performance testing of your web app, one tool that is pretty easy to use is httperf. I recommend watching the Peepcode screencast on httperf to get some good tips on how to doing performance testing. There is also some reading
Dec 01 2009 09:59 AM
vote up
0
vote down

How To Write A Spelling Corrector In Ruby

If you haven't seen it before, Peter Norvig has a spelling corrector that is written in just 21 lines of Python code (not counting blank lines and the import). He also lists a few other implementations in other languages, include one in Ruby. The Ruby
Nov 05 2009 06:36 AM
vote up
0
vote down

Ain't Nothing But A G Thang

You've probably seen more than a few articles on the web showing how to build a Rack app. If not, here's a good one to start with. You'll quickly see that building a Rack app is really simple, which is why Rack is awesome, because it's simple. But what
Oct 09 2009 06:10 AM
vote up
0
vote down

ExtJS On Rails

If you are looking to give ExtJS a spin, I've created a Rails Application Template to setup a Rails app with ExtJS installed. To use it, just do: rails -m http://tinyurl.com/extjs-rb my-extjs-app To see a sample of this in use, take a look at this Rails
Sep 24 2009 04:33 AM
vote up
0
vote down

Why Rails 3 Will Require Ruby 1.8.7

This past weekend I attended the Windy City Rails conference. It was in a great location in the heart of downtown Chicago and seemed to have a pretty good turn out. There were many great talks but this blog post will be focusing on a specific talk, and
Sep 15 2009 01:19 AM
vote up
0
vote down

Infinite Recursion

A few days ago I posted an article on Tail Call Optimization. One really quick way to determine if any language/VM/interpreter performs Tail Call Optimization (TCO) is to write a function that calls itself, in other words, creating an infinitely
Sep 02 2009 06:44 AM
vote up
0
vote down

Active Record Random

Are you looking for a way to select a random record that plays nice with named scope in your Rails app? Throw this into config/initializers/active_record_random.rb: class ActiveRecord::Base def self.random if (c = count) > 0 first(:offset =>
Aug 31 2009 03:57 AM
vote up
0
vote down

Tail Call Optimization

Tail-Call Optimization (a.k.a Tail Recursion) is a technique often used in functional programming languages that promotes the use of recursion rather than imperative loops to perform iterative calculations. When I say imperative loops, I mean using a
Aug 30 2009 09:50 PM
vote up
0
vote down

Currying and Partial Function Application

Two related but different concepts that you will run into when doing functional programming are currying and partial function application. People often don't understand the different between the two, I didn't myself until recently, but I think I've got a
Aug 21 2009 02:50 PM
vote up
0
vote down

In Search Of Sharper Tools

After reading the comments in my last post, one thing I realized that I neglected to do is define what I mean by metaprogramming. Rubyists probably already know what I mean, but people coming from other programming languages might have different ideas
Jul 22 2009 04:53 AM