Posted about 1 year back at has_many :bugs, :through => :rails - Home
With jruby, rubinius, YARV, etc. etc. I can’t wait for my share of fun ;-)

Posted about 1 year back at has_many :bugs, :through => :rails - Home
With jruby, rubinius, YARV, etc. etc. I can’t wait for my share of fun ;-)

Posted about 1 year back at has_many :bugs, :through => :rails - Home
With jruby, rubinius, YARV, etc. etc. I can’t wait for my share of fun ;-)

Posted about 1 year back at Eigenclass (tags: blog)
A simple content-aware image resizer, quite small, readable and fast: over 6 times faster than the LiquidRescale GIMP plugin, which is written in C.
Seam carving is a recently presented method to resize images "intelligently",
by removing pixels of the image that carry little information. It can do
things like turning this image
into
this one
Go watch the video for more examples.
I first heard about
content-aware image resizing using seam carving
about one month ago, when I found this
implementation written in Python
that uses SciPy/NumPy, i.e., lots of C code.
I quickly reimplemented it in OCaml, obtaining an unexpected
two-order-of-magnitude speed increase. This was slightly surprising because the Python version uses optimized extensions written in C, and Psyco should have brought the parts written in Python to at least one tenth of the native speed. In this case, the key, it turns out, was not the implementation language but the algorithm itself.
Read more...
Posted about 1 year back at Eigenclass (tags: blog)
A simple content-aware image resizer, quite small, readable and fast: over 6 times faster than the LiquidRescale GIMP plugin, which is written in C.
Seam carving is a recently presented method to resize images "intelligently",
by removing pixels of the image that carry little information. It can do
things like turning this image
into
this one
Go watch the video for more examples.
I first heard about
content-aware image resizing using seam carving
about one month ago, when I found this
implementation written in Python
that uses SciPy/NumPy, i.e., lots of C code.
I quickly reimplemented it in OCaml, obtaining an unexpected
two-order-of-magnitude speed increase. This was slightly surprising because the Python version uses optimized extensions written in C, and Psyco should have brought the parts written in Python to at least one tenth of the native speed. In this case, the key, it turns out, was not the implementation language but the algorithm itself.
Read more...
Posted about 1 year back at tech on toolmantim.com
&tForgot to mention this one… the presentation I gave at last month’s RORO meetup:
Check out Lachie’s preso: DRYing your views.
Posted about 1 year back at Eribium
If you’re looking for an easy way to customize css depending on the browser, without relying on JavaScript, this should be some help:
ApplicationHelper
def browser_name
@browser_name ||= begin
ua = request.env['HTTP_USER_AGENT'].downcase
if ua.index('msie') && !ua.index('opera') && !ua.index('webtv')
'ie'+ua[ua.index('msie')+5].chr
elsif ua.index('gecko/')
'gecko'
elsif ua.index('opera')
'opera'
elsif ua.index('konqueror')
'konqueror'
elsif ua.index('applewebkit/')
'safari'
elsif ua.index('mozilla/')
'gecko'
end
end
end
Then, in your layout, you should add this to your html tag: class="<%= browser_name %>"
So:
<html xmlns="http://www.w3.org/1999/xhtml" class="<%= browser_name %>">
Now, in your css, you can customise it to the browser:
.gecko button {
margin-left: -4px;
}
Posted about 1 year back at Eribium
If you’re looking for an easy way to customize css depending on the browser, without relying on JavaScript, this should be some help:
ApplicationHelper
def browser_name
@browser_name ||= begin
ua = request.env['HTTP_USER_AGENT'].downcase
if ua.index('msie') && !ua.index('opera') && !ua.index('webtv')
'ie'+ua[ua.index('msie')+5].chr
elsif ua.index('gecko/')
'gecko'
elsif ua.index('opera')
'opera'
elsif ua.index('konqueror')
'konqueror'
elsif ua.index('applewebkit/')
'safari'
elsif ua.index('mozilla/')
'gecko'
end
end
end
Then, in your layout, you should add this to your html tag: class="<%= browser_name %>"
So:
<html xmlns="http://www.w3.org/1999/xhtml" class="<%= browser_name %>">
Now, in your css, you can customise it to the browser:
.gecko button {
margin-left: -4px;
}
Posted about 1 year back at Railscasts
Complex forms often lead to complex controllers, but that doesn't have to be the case. In this episode see how you can create multiple models through a single form while keeping the controller clean.
Posted about 1 year back at Shane's Brain Extension

Jookbox finds music videos of your favorite music and lets you put them on your profile.
You must have the favorite music section in your profile filled out for Jookbox to figure out what you like.
This uses a pre-release version of youtube-g, a Ruby API for the GData version of YouTube’s API.
Thanks to Walter Korman for brainstorming the idea with me and Jesus Duran for the name.
Posted about 1 year back at Shane's Brain Extension

Jookbox finds music videos of your favorite music and lets you put them on your profile.
You must have the favorite music section in your profile filled out for Jookbox to figure out what you like.
This uses a pre-release version of youtube-g, a Ruby API for the GData version of YouTube’s API.
Posted about 1 year back at RailsTips.org - Home
I have mentioned my affinity for edge rails several times. First, I showed you how I pimp my local setup. Next, I showed you how to really get edgy and lastly, I showed you that sometimes it bites back. Yeah, that still stings a bit. Anyway…this isn’t as dramatically cool as the first two or as stingy as the last one but it’s handy so here you go. Throw this in the bottom of your deploy.rb capistrano recipe and you’ll have easy peasy edge rails deployment.
set :rails_version, 7514 unless variables[:rails_version]
task :after_update_code, :roles => :app do
rails_path = "/var/www/apps/shared/rails"
export_path = "#{rails_path}/rev_#{rails_version}"
symlink_path = "#{release_path}/vendor/rails"
# if revision does not exist then create it
puts "Checking if rails revision #{rails_version} exists, exporting if not..."
sudo "test -d #{export_path} || svn export http://dev.rubyonrails.org/svn/rails/trunk/ #{export_path}/ -r #{rails_version}" unless File.exist?(export_path)
# create symlink in vendor folder to revision
puts "Symlinking #{export_path} to #{symlink_path}..."
sudo "ln -sf #{export_path} #{symlink_path}"
end
This makes a few assumptions that you might not want to assume, but I’ll leave that up to you to change. The basic gist is: make sure we have a copy of the rails version on the server and then create a symlink to it in your apps vendor directory. Now, if some great feature or bug fix comes into edge rails that you can’t live without, simply change the rails_version capistrano variable and the next time you deploy your app will automatically have a shiny new rails version symlinked into it’s vendor. This is handy if you have multiple apps on a server as they can share the same rails version which takes up less space. Yay!
Also, if you want to diss the rails_version set in your deploy file, you can pass the version you want in from the command line with something like this (off the top of my head could be different): cap -S rails_version=####.
Anyone else do something similar or have suggestions for improving this?
Posted about 1 year back at RailsTips.org - Home
I have mentioned my affinity for edge rails several times. First, I showed you how I pimp my local setup. Next, I showed you how to really get edgy and lastly, I showed you that sometimes it bites back. Yeah, that still stings a bit. Anyway…this isn’t as dramatically cool as the first two or as stingy as the last one but it’s handy so here you go. Throw this in the bottom of your deploy.rb capistrano recipe and you’ll have easy peasy edge rails deployment.
set :rails_version, 7514 unless variables[:rails_version]
task :after_update_code, :roles => :app do
rails_path = "/var/www/apps/shared/rails"
export_path = "#{rails_path}/rev_#{rails_version}"
symlink_path = "#{release_path}/vendor/rails"
# if revision does not exist then create it
puts "Checking if rails revision #{rails_version} exists, exporting if not..."
sudo "test -d #{export_path} || svn export http://dev.rubyonrails.org/svn/rails/trunk/ #{export_path}/ -r #{rails_version}" unless File.exist?(export_path)
# create symlink in vendor folder to revision
puts "Symlinking #{export_path} to #{symlink_path}..."
sudo "ln -sf #{export_path} #{symlink_path}"
end
This makes a few assumptions that you might not want to assume, but I’ll leave that up to you to change. The basic gist is: make sure we have a copy of the rails version on the server and then create a symlink to it in your apps vendor directory. Now, if some great feature or bug fix comes into edge rails that you can’t live without, simply change the rails_version capistrano variable and the next time you deploy your app will automatically have a shiny new rails version symlinked into it’s vendor. This is handy if you have multiple apps on a server as they can share the same rails version which takes up less space. Yay!
Also, if you want to diss the rails_version set in your deploy file, you can pass the version you want in from the command line with something like this (off the top of my head could be different): cap -S rails_version=####.
Anyone else do something similar or have suggestions for improving this?
Posted about 1 year back at RailsTips.org - Home
I have mentioned my affinity for edge rails several times. First, I showed you how I pimp my local setup. Next, I showed you how to really get edgy and lastly, I showed you that sometimes it bites back. Yeah, that still stings a bit. Anyway…this isn’t as dramatically cool as the first two or as stingy as the last one but it’s handy so here you go. Throw this in the bottom of your deploy.rb capistrano recipe and you’ll have easy peasy edge rails deployment.
set :rails_version, 7514 unless variables[:rails_version]
task :after_update_code, :roles => :app do
rails_path = "/var/www/apps/shared/rails"
export_path = "#{rails_path}/rev_#{rails_version}"
symlink_path = "#{release_path}/vendor/rails"
# if revision does not exist then create it
puts "Checking if rails revision #{rails_version} exists, exporting if not..."
sudo "test -d #{export_path} || svn export http://dev.rubyonrails.org/svn/rails/trunk/ #{export_path}/ -r #{rails_version}" unless File.exist?(export_path)
# create symlink in vendor folder to revision
puts "Symlinking #{export_path} to #{symlink_path}..."
sudo "ln -sf #{export_path} #{symlink_path}"
end
This makes a few assumptions that you might not want to assume, but I’ll leave that up to you to change. The basic gist is: make sure we have a copy of the rails version on the server and then create a symlink to it in your apps vendor directory. Now, if some great feature or bug fix comes into edge rails that you can’t live without, simply change the rails_version capistrano variable and the next time you deploy your app will automatically have a shiny new rails version symlinked into it’s vendor. This is handy if you have multiple apps on a server as they can share the same rails version which takes up less space. Yay!
Also, if you want to diss the rails_version set in your deploy file, you can pass the version you want in from the command line with something like this (off the top of my head could be different): cap -S rails_version=####.
Anyone else do something similar or have suggestions for improving this?
Posted about 1 year back at Riding Rails - home
Now seems like a good time to thank the community which helped make our new release a reality. Rails 2.0 includes the work of more than 160 individuals who have contributed features through trac and our mailing list. Our user mailing list has 11002 subscribers all helping each other out. The development list has 1847 people helping improve the framework for all the users.
In particular we’d like to single out the following people who top the list of accepted patches
Our community is our greatest asset, and thanks to every single one of you who’s helped out throughout our history.
1 ... 511 512 513 514 515 ... 634