Desktop Goodness
November 5th, 2008 | Published in Uncategorized
I’m still celebrating. Here’s a desktop for anyone who needs one more reminder of how great they feel: 
Thanks for the font!
November 5th, 2008 | Published in Uncategorized
I’m still celebrating. Here’s a desktop for anyone who needs one more reminder of how great they feel: 
Thanks for the font!
October 28th, 2008 | Published in Uncategorized
I am incredibly proud to announce the launch of the latest project from the “Visual Communications Lab”:http://www.research.ibm.com/visual/ that I am lucky to be a “part”:http://vizlab.nytimes.com/page/About.html of:
Here’s a little embedded version of one I made in the spirit of our political times:
Go play!
October 26th, 2008 | Published in Uncategorized
I have recently been incredibly interested in electronics following a completely accidental discovery of make magazine and “instructables”:http://instructables.com. A good friend of mine heard of this interesting Circuit Building workshop that was held at Gallery 119 and let by Jessica Rylan.
I figured I’ll give it a try and I really had the best time!
We built a Touch Sensitive Noise Generator (you can see some of the ones Jessica sells at “Flower Electronics”:http://www.flowerelectronics.com/ which turned out to be incredibly entertaining!
Here’s a quick pic of my little creation:
September 27th, 2008 | Published in Uncategorized
Recently to begin the process of alpha testing our application jointly with our customers we wanted to add an additional layer of security and block/allow various IP ranges. Having done most of our configuration in Apache, we saw no reason not to do so with mod_authz_host.
And so we set a couple of allows with:
Allow from address
And everything worked wonderfully on our end. Until the customer tried to access the site and complained about latency beyond our wildest imagination… a minute to load the homepage?! It looked so zippy to us….
In any case, many hours later my teammate realized that it was apache’s access control processing causing the delay! We switched to using iptables and everything is back to normal… strange eh?
August 31st, 2008 | Published in Uncategorized
We recently upgraded from ruby 1.8.6 and rails 2.0.2 to 1.8.7/2.1.0 respectively. This guide was incredibly helpful but one small caveat I ran into after the upgrade was related to postgresql.
It seemed that the new postgres_adapter.rb didn’t properly quote several of the commands: drop database and create database.
For example:
def drop_database(name) #:nodoc:
execute "DROP DATABASE IF EXISTS #{name}"
end
should be something like:
def drop_database(name)
execute "DROP DATABASE IF EXISTS \"#{name}\""
end
And same goes for create_databse.
It looks like there are fixes in edge for create_database and “drop_database.
August 30th, 2008 | Published in Uncategorized
In our application we try to use friendly URLs wherever we can. We decided to use user names instead of IDs but ran into the need to permit certain usually forbidden characters.
Initially our routes.rb had a section that looked as follows:
map.resources :users, :requirements => { :id => /[a-zA-Z0-9.@:%+;:?&=_+-]+/ } do |user|
user.resources :messages
user.resources :books
user.resources :contacts
end
However, we soon realized that the requirements portion wasn’t adhered to when the nested resources were called. For example:
However
The solution for now was to just rewrite each nested route separatly and repeat the requirements but that felt redundant and wrong…
For more gory details or to keep track of the issue I opened a ticket.
August 29th, 2008 | Published in Uncategorized
Having used gdb many ages ago for debugging some C code, I really missed being able to just pause the execution of my java programs and muck around. I was really thrilled to discover “ruby-debug”:http://rubyforge.org/projects/ruby-debug/ which is an incredibly powerful debugging tool.
* You install it like any other gem
$ sudo gem install ruby-debug
* Add require ‘ruby-debug’ to your environment configuration
* To enter the debugger mode simply add the ‘debugger’ statement anywhere you see fit.
Example:
def login
debugger
user = User.authenticate...
end
* Be sure to start your server with the –debugger flag as follows:
$ ruby script/server --debugger
When you’re in the debugger, here are some useful commands you can use:
* list – shows you where you are in context. Example:
(rdb:2) list
[54, 63] in ./script/../config/../app/controllers/user_controller.rb
54 end
55 end
56
57 def login
58 debugger
=> 59 user = User.authenticate...
* p – prints any ruby statement. So ‘p params’ will print the params (so will just params by the way) but p is_true == is_false will evaluate the expression and then output it.
* where – gives you the stack trace and your position in it
* step – takes the next single step
* next – goes to the next line
To see the rest of the commands just run help at any point.
I find that some of the most helpful things to look at are my params and request objects.
Hope this was helpful
August 28th, 2008 | Published in Uncategorized
I haven’t had a chance to play with in place editing since before Rails 2.* and so I discovered that the feature was now a plugin.
I didn’t have much luck finding very good documentation for it and so I will attempt to summarize a few of the steps I had to take to get it working.
ruby script/plugin install http://svn.rubyonrails.org/rails/plugins/in_place_editing
patch -p0 <in_place_editing_should_work_with_csrf_and_rjs
<span id="edit_profile"><%= @user.profile %></span>
<%= in_place_editor "edit_profile", {:url => url_for(:action => "update", :id => @user.id) } %>
Some additional elements you might want to set besides url can be found here
def update
if params[:editorId] && params[:editorId] "edit_profile"
if @user.id params[:id]
new_profile_text = ""
new_profile_text = params[:value] if params[:value]
@user.profile = new_profile_text
@user.save!
end
end
render :text => @user.profile
end
Some important things to note about the code above:
In my next post I’ll talk a little bit about how I modified/extended my in_place_editor to take additional arguments I felt made more sense for my configuration. Hopefully someone will find that useful =)
April 13th, 2008 | Published in Uncategorized
Welcome to the current incarnation of the web version of me!
I am a software engineer / musician / creator of things that I hope are creative and generally a very busy person. Here is where I will post something about that goodness.
I am in a wonderful Jazz band that has so far beat the record in slowness of recordings but you can find out more about us at: “Halcyon Blue”:http://halcyonbluemusic.com
More to come!