Bambinos RSS

New Bamboo

Bamboo Blog

Archive

Nov
1st
Sun
permalink bartoszblimke

Solving the problem of non-working key forwarding with Capistrano

After I upgraded my Mac to Snow Leopard, Capistrano deployments with key forwarding stopped working. I started getting a following error:

Permission denied (publickey).

My fellow Bambinos enlightened me that key forwarding was switched off by default in Snow Leopard. The solution was to change the following two lines in /etc/ssh_config:

#Host *
#ForwardAgent no

to the following two lines:

Host *
ForwardAgent yes

Unfortunately after this change I was still getting Permission denied (publickey) error.

Today I found the root cause. My ssh key was not added to the authentication agent so the key was not forwarded. The solution was to execute the following command:

ssh-add ~/.ssh/id_dsa

(or ssh-add ~/.ssh/id_rsa if you use rsa key)

Now everything works fine.

Jul
6th
Mon
permalink paulbjensen

migration to generate paperclip attachment on your model

./script/generate paperclip MODEL_NAME ATTACHMENT_NAME

example:

./script/generate paperclip video source

GENERATES:

add_attachments_source_to_video.rb

class AddAttachmentsSourceToVideo < ActiveRecord::Migration
def self.up
add_column :video, :source_file_name, :string
add_column :video, :source_content_type, :string
add_column :video, :source_file_size, :integer
end

def self.down
remove_column :video, :source_file_name
remove_column :video, :source_content_type
remove_column :video, :source_file_size
end
end

Jun
19th
Fri
permalink maxthelion
1337 github mod for new iphone

1337 github mod for new iphone

Jun
7th
Sun
permalink bartoszblimke

Is beanstalkd really distributed?

I recently needed to understand how beanstalkd works and how does it implement the distributed behaviour, so I did some reading.

From the beanstalkd main page:

beanstalkd is a fast, distributed, in-memory workqueue service

Ok, it is a distributed service, so let’s find some more info about its distributed nature.

This is what we can find in beanstalkd FAQ:

Does beanstalk inherently support distributed servers?
Yes, although this is handled by the clients, just as with memcached. The beanstalkd server doesn’t know anything about other beanstalkd instances that are running.

Using the same argumentation I could say that FTP or any database server is also distributed if you only start more than one instance. The fact some server allows to create scalable and distributed solutions, doesn’t necessarily mean that they are distributed on their own.

May
16th
Sat
permalink paulbjensen

Run Apple's QuickTime Player from the terminal

open -a “QuickTime Player” VIDEO_FILE

May
15th
Fri
permalink dctanner
Apr
3rd
Fri
permalink ollylegg
Mar
26th
Thu
permalink paulbjensen

How to run the Haml plugin generator in Rails Templates

Here is how to run Haml’s unorthodox plugin generator method using Rails Templates:

Here is a sample Rails Template for fun:

permalink dctanner
Mar
11th
Wed
permalink maxthelion

Freudian slip during copywriting

The alternative, and traditional method of ruinning software projects is called “waterfall”

Feb
25th
Wed
permalink dctanner
Jan
23rd
Fri
permalink matthewcford

Include custom actions from a module in a Merb controller

module Foo
  def self.included(base)
    base.show_action(:custom_action)
  end
  
  def custom_action
    "foo"
  end
end


Jan
19th
Mon
permalink matthewcford
Jan
16th
Fri
permalink bartoszblimke

Delete all removed files from git

git add -u
This deletes all removed files from git.

Dec
8th
Mon
permalink ismasan

Skinny controllers with resources_controller and named_scope

resources_controller takes you a long way into simplifying your controllers. Still, whenever you need to add custom collection or member routes to your app you’re out in the wild again. This snippet of code uses a combination of ActiveRecord’s named_scopes and resources_controller to simplify those custom actions. With a bit more of abtraction it could be turned into library code that you test once and reuse as many times as you want in different codebases.

The cool thing is that we get seamless nested controllers if we need them, such as in /posts or /users/2/posts