Interview: Brian Zimmer Talks About Architectural Challenges on a Large Scale Project

Posted 1 day back at InfoQ Personalized Feed for unregistered user - Register to upgrade!

In this interview made during QCon 2007, Brian Zimmer talks about the architectural challenges he has faced working on a a large web application as senior architect. By Abel Avram

Should your architecture focus on SOA or BPM?

Posted 1 day back at InfoQ Personalized Feed for unregistered user - Register to upgrade!

While SOA was the big name in the buzzword tag cloud, BPM is quickly getting bigger and bigger. As organizations are becoming more aware of the need to tame their processes in order to get the benefits of IT investments, BPM is gaining importance and mindshare inside and outside of IT. Is one more important for your architecture? By Steven Robbins

Deploying with Capistrano via a gateway - some notes

Posted 1 day back at redemption in a blog

Some notes on setting up a gateway server for deploying via Capistrano that I couldn’t find at the source.

  • You can specify the user you want to use to login to your gateway server like so: set :gateway, 'deploy@deploy.example.com'. This logs in to your gateway server as the “deploy” user.
  • You can specify an alternate SSH port for both your gateway and your deployment servers. E.g. setting ssh_options[:port] = 11111 will make Capistrano SSH to your gateway server with on port 11111. For your actual application (and web and database) servers, you can specify the SSH port like so:
    set :gateway, 'deploy@deploy.example.com'
    role :app, '192.168.1.113:22222'
    role :web, '192.168.1.113:22222'
    role :db,  '192.168.1.113:22222', :primary => true
  • If you’re using public key authentication, you should put the public keys of your users (those who be deploying your app) on the gateway server and on the actual servers. I thought Capistrano would use the key of the “deploy” user but nope.

Cubescape!

Posted 1 day back at No Strings Attached

Cubescape is a nifty little toy made by Cameron Adams using jQuery. It’s your own 3D pixel world.

I liked it so much that I’ve recreated the Rails logo inside it. Yeah, it sucks, I know :)
Make something better!

Deploying Rails Applications: The Book

Posted 2 days back at Ruby Inside

9780978739201_lrg.jpg

I usually try to get a review copy and read through a book before mentioning it here, but a book like Deploying Rails Applications (Amazon.com alternative) has been in demand for a long time now. Its provenance (coming from the keyboards of Ezra “Engine Yard” Zygmuntowicz, Bruce Tate, and Clinton Begin - and published by Pragmatic Bookshelf) encourages me to support it without direct review. That’s not to say it’s certainly a good book, but it darn well shouldn’t be a bad one.

The book covers deploying Rails applications under shared hosting, virtual machine, and dedicated server hosting environments, and looks at the variety of technologies you can use, such as Apache, Nginx and Mongrel. Monitoring, source control, and automated deployment (using Capistrano) are also discussed.

For those who’d rather squint endlessly at the screen than fondle finely pressed tree flesh, Pragmatic Bookshelf have a PDF version available for $22.

This post is sponsored by KickStart Events — RubyOnRails Training at the EMCC (East Midlands Conference Centre), UK. High-quality hands-on workshops and courses for web application developers. Taught by experienced mentors using live coding sessions, slides and participatory discussion.

Rails Deployment Roundup: Dreamhost with mod_rails, Capistrano 2.3, Book

Posted 2 days back at InfoQ Personalized Feed for unregistered user - Register to upgrade!

Roundup of Rails deployment news, including Dreamhost's announcement of Rails support using mod_rails - after the controversy earlier this year, Capistrano 2.3 release as well as the availability of the book "Deploying Rails Applications: A Step-by-Step Guide". By Werner Schuster

What You Can Learn From ido.el

Posted 2 days back at Relevance - Relevance Weblog

I have put together a 25-minute screencast on What You Can Learn From ido.el. At first glance, the screencast appears to be about TextMate and Emacs, but it's really about this.

StaticMatic 2 is coming

Posted 2 days back at steve.blog - Home

StaticMatic is currently going through a major over-haul. There are loads of great features in the works as well as changes to the way to core works.

The major change is that StaticMatic 2 will now use ActionPack. This means we get loads of great new features:

  • Any templating language you like
  • Access to all ActionView helpers

On top of this we also now have:

  • Rake tasks for commands
  • Better error handling
  • 'Modified Date' sensitive building of static files - StaticMatic now only builds files you've modified

We're also now hanging out with cool kids on github: http://github.com/stevebartholomew/staticmatic/tree/master.

Call to Arms

Now, we need your help. StaticMatic 2 is not yet feature complete. There is still a lot of work to do with getting all the current features in as well as working up the new stuff.

What we need is for you to try out the new features on your existing StaticMatic sites. The great thing is, you can run the new version without conflicting with the current one:

  1. Download the edge version into your site's root directory: ~/Sites/mygreatsite $ git clone git@github.com:stevebartholomew/staticmatic.git

  2. Create a Rakefile in your site's root containing this: require 'rake' require 'staticmatic/lib/tasks/staticmatic'

That's it. You can use the new StaticMatic commands: rake preview rake build

Or you can use your Gem version: staticmatic preview . staticmatic build .

The main thing that needs testing is integration into ActionView - try out the helpers, see what happens. There's a fair few hoops to jump through to make ActionView happy being separated from ActionController so it can play up!

New to StaticMatic?

If you're new to StaticMatic, you can try out the new version by installing the current one and creating a new site: sudo gem install staticmatic staticmatic setup mygreatsite

and following the instructions .

Be Gentle!

There's a fair way to go before we're ready for a release, but hopefully you can still have fun trying out the new features. Join us over at the Google Group for more discussion.

Duplicating Vmware Fusion Virtual Machines

Posted 2 days back at Smarticus - Home

Took me long enough to get it right, so I thought I’d share.

<object height="485" width="760"><param /><param /><embed src="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&#38;feedurl=http%3A%2F%2Fsmarticus%2Eblip%2Etv%2Frss&#38;file=http%3A%2F%2Fblip%2Etv%2Frss%2Fflash%2F912559%3Freferrer%3Dblip%2Etv%26source%3D1&#38;showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" height="485" width="760"></embed></object>

Rails Envy Podcast - Episode #031: 05/14/2008

Posted 2 days back at Rails Envy - Home

Episode 031. Steven Bristol is back this week and although the podcast is full of music, we don't actually sing. Seriously, I have no idea how all that music got in there.

The Rails Envy podcast is sponsored this week by Engine Yard, fully managed hosting for your Rails applications. Learn more at EngineYard.com Sponsored by Engine Yard - Fully-managed Rails hosting

Subscribe via iTunes - iTunes only link.
Download the podcast ~18:00 mins MP3.
Subscribe to feed via RSS by copying the link to your RSS Reader


<script language="javascript" src="http://s3.polldaddy.com/p/610111.js" type="text/javascript"></script><noscript> What Ruby conferences are you going to?
( polls)</noscript>

In this episode:


GetText, Rails, Authentication, Japanese Firefox, Setting the Language Manually

Posted 2 days back at life.i.think - Life

There occurs an interesting problem when you are using Ruby’s GetText to translate a site that requires authentication.

Most likely, you have a before_filter that calls a method that authenticates the user for certain methods. Within this filter you probably have something like:


user = (attempt_oauth or
  attempt_basic_auth or
  attempt_session_auth or
  attempt_cookie_auth or
  (@authentication_attempt = nil))

If the user has clicked “Remember Me” and stored an cookie locally, than we’re going to validate the user using attempt_cookie_auth. But what if the user has a default language set (stored most likely in the database). We’ll assume there is a method user.lang that returns the default language or nil.

Your first attempt at setting this here may be this one.

NOTE: THIS IS WRONG!


# If the user has a default lang, set it here.
if u && u.lang && (LANGUAGE_CODES.include?(u.lang))
  cookies[:lang] = u.lang unless cookies[:lang]
end

That sets the cookie for the user, but the GetText stack has already been invoked, so the language will be that sent over by the browser. Refreshing the page will cause GetText to pick up the cookie value and render the proper language.

Next, we try using set_locale (GetText.set_locale) to set the language manually, which seems like a perfectly reasonable option.

NOTE: THIS IS WRONG!


# If the user has a default lang, set it here.
if u && u.lang && (LANGUAGE_CODES.include?(u.lang))
  cookies[:lang] = u.lang unless cookies[:lang]
  set_locale u.lang
end

Why is this bad? The set_locale method persists for the life of the Ruby instance (in this case, Mongrel), not the session. This means that there will be a literal battle for contention over which language to use.


User A sets the language to JA and the page renders JA.
User B sets the language to EN and the page renders JA.
User A sets the language to JA and the page renders EN.
You see the problem! We want a clean slate at the beginning of each request so GetText has no pre-conceived notions about what the language should be. Hrm … let’s try something.

NOTE: THIS IS WRONG!


# If the user has a default lang, set it here.
if u && u.lang && (LANGUAGE_CODES.include?(u.lang))
  cookies[:lang] = u.lang unless cookies[:lang]
  set_locale u.lang
else
  set_locale nil
end

Note … to be thorough, and because the authentication stack is not called for all methods, we also add this in our application.rb


  before_init_gettext :set_default_locale
  def set_default_locale; set_locale nil; end

Here, everything seems to work! We can even write a test to verify that the contention above doesn’t occur.


def test_lang_should_be_set_on_a_per_session_basis
  bob.lang = 'ja'
  assert bob.save
  bob.reload

  assert_equal 'ja', bob.lang
  post '/sessions', {:username_or_email => bob.screen_name, :password => 'foo'}
  assert_response :redirect
  follow_redirect!
  assert_response :redirect
  follow_redirect!
  assert_response :success
  assert_equal 'ja', Locale.current.language

  phoenix.reload
  assert_equal nil, phoenix.lang
  post '/sessions', {:username_or_email => phoenix.screen_name, :password => 'foo'}
  assert_response :redirect
  follow_redirect!
  assert_response :redirect
  follow_redirect!
  assert_response :success
  assert_equal 'en', Locale.current.language
end

But alas, download the Japanese version of Firefox and visit the page.

The browser is hungry for UTF-8 data. As you can see, the part of the page in which we set the locale manually using set_locale is being pushed as SHIFT-JIS. The blue highlighted area is actually outside of the application.rb controller stack, so is sent via GetText’s default assumptions: UTF-8.

But this isn’t a problem in Safari or Internet Explorer. Why? Let’s look at the value of HTTP_ACCEPT_LANGUAGE.


Firefox :   "HTTP_ACCEPT_CHARSET" => "EUC-KR,utf-8;q=0.7,*;q=0.7" 
Safari  :   "HTTP_ACCEPT_CHARSET" =>  ???

Safari actually doesn’t pass one, while Firefox gives precedence EUC-KR (effectively SHIFT-JIS) over UTF-8.

Sigh. Things are looking grim. Back to the drawing board. Let’s look at the order of precedence for how the Rails GetText integration determines the langauge.


The language passed to GetText.bindtextdomain.
The lang query param. ( url?lang=foo )
The lang cookie.
The value of HTTP_ACCEPT_LANGUAGE passed by the browser.
The default (English).

Aha! GetText.bindtextdomain! Looking at the RDocs and source, this is not only called within the init_gettext method, but can be set on a per session basis without mucking with default language settings!

Let’s try!

NOTE: THIS IS CORRECT! CELEBRATE!


# If the user has a default lang, set it here.
if u && u.lang && (LANGUAGE_CODES.include?(u.lang))
  cookies[:lang] = u.lang unless cookies[:lang]
  GetText.bindtextdomain("Twitter", :locale => u.lang)
end

So finally, we can set the language on a request manually after the GetText stack has already been invoked. Whew!

Episode 106: Time Zones in Rails 2.1

Posted 2 days back at Railscasts

In the past, time zones have been very difficult to work with, but no longer! Rails 2.1 brings with it great time zone support as you can see in this episode.

70. Extremely Simple PDF Generation in Rails using HTMLDOC

Posted 2 days back at Free Ruby and Rails Screencasts

In this episode you will see how to use HTML doc gem to create pdf documents that is very easy to create in your Rails 2.0 apps in a RESTful way.

I will throw in a very useful tip on how to debug issues in your production environment using log files.

 The download includes instructions for compiling and installing HTMLDOC.

Note: I think if you define map.resource :product in routes.rb, you might be able to make it work without using plural map.resources declaration. 

Cool Tool

Posted 2 days back at dave astels

A friend of mine, Misko Hevery, has written a very cool opensource tool for analyzing Java projects and scoring them in terms of how testable they are. His plans are to have it point out what’s wrong, and make suggestions as to what you can do to improve the situation.

Check it out: Testability Explorer

Well worth looking at.

TorontoRB.ca

Posted 3 days back at work.rowanhick.com

A while ago I was looking at all of the events going on in Toronto, mailing lists, *camps wondering how the heck does anyone get to know what’s going on?. Particularly those who are new to the scene ? After talking to a couple of people and realising the need for one central place to collect it all, I put together this blog. With my partners in crime, Corina and Pete, TorontoRB.ca will be kept up to date with when things are happening, goings on in the scene, opportunities to help out. Our vision is to keep you, our faithful Rubyist’s up to the play on what’s going on in our fair city.

Add the feed to your readers, sit back, and soak up the centralised goodness. http://torontorb.ca

If you’re in Toronto, know of something I’ve missed. Have a blog, project, or anything that you think deserves a mention on there, send it into mail@torontorb.ca and it will get attended to in short order.


1 2 3 ... 853