No on saw this one coming. On December 23rd it was announced that Rails 3 will be the product of merging Rails and Merb frameworks.
Check out these links for more information
http://rubyonrails.org/merb
http://yehudakatz.com/2008/12/23/rails-and-merb-merge/
Tuesday, December 30, 2008
Tuesday, December 2, 2008
IE File Download - Security Warning
File Download - Security Warning
Do you want to save this file, or find a program online to open it....
Have you ever seen this error when making an ajax request in IE? In particular this seems to happen when using the remote_form_for or remote_form_tag helper and try submitting the form via javascript. The expected result would be that the form would be submitted via ajax and then a RJS file would execute some Javascript on the client's page. Instead we get a stupid IE download popup.
This one always comes back to bite me when I add a new features to a site and I've been blissfully programming away in FF neglecting the red headed stepchild IE. Then comes the head scratching followed by some screaming when Google fails to return any sort of valuable search results on this subject. I am going to post the issue and resolution for myself and hopefully it will help some other people out there.
Here is an example of the HTML generated from remote_form_for.
<form method="post" id="user_form" action="/users"
onsubmit="new Ajax.Request('/users', {
asynchronous:true,
evalScripts:true,
parameters:Form.serialize(this)});
return false;"></form>
And here is some javascript function that would submit that form.
$('user_form').submit();
First off when you submit this form in IE it seems that it sends out an ajax request because the full page does not reload. As it turns out when you call $('user_form').submit() in IE it never calls the onsubmit handler so it never has a chance to return false and prevent a full page submission. Since the form is not submitted via ajax IE thinks you want to download the response, ie the RJS file, hence the popup. What makes this even more tricky is that the RJS you wanted to execute actually gets executed so it looks like it was an actual ajax submission but it in fact was not.
The simple solution is when you are trying to submit a remote form via javascript you should explicitly call the onsubmit handler like this.
$('user_form').onsubmit();
Doing it this way ensures that you are submitting the form via ajax and behavior will be consistent across all browsers.
"Im a PC and I handle form submissions differently"
Monday, November 17, 2008
ActionMailer with Gmail. Must issue a STARTTLS command first
If you ever tried sending e-mail via ActionMailer with gmail settings you may have received the following error:
The problem is that Gmail requires TLS authentication but the standard Ruby net/smtp library doesn't support TLS.
Of course there is a helpful plugin created by Marc Chung to overcome this barrier. You can find it here and manually add it to your project or you can export it to your plugin directory.
Either way make sure you require 'smtp_tls'
Now all you need is to update your smtp_settings if you haven't done so already.
You can now enjoy the benefits of a free email server.
530 5.7.0 Must issue a STARTTLS command first. k41sm7289021rvb.4
The problem is that Gmail requires TLS authentication but the standard Ruby net/smtp library doesn't support TLS.
Of course there is a helpful plugin created by Marc Chung to overcome this barrier. You can find it here and manually add it to your project or you can export it to your plugin directory.
$ cd vendor/plugins
$ svn export http://code.openrain.com/rails/action_mailer_tls/
Either way make sure you require 'smtp_tls'
Now all you need is to update your smtp_settings if you haven't done so already.
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "domain.com",
:user_name => "user@domain.com",
:password => "password",
:authentication => :plain
}
You can now enjoy the benefits of a free email server.
Sunday, November 16, 2008
What happened to Save the Developers from IE6 movement?
WTF?
Awhile back we found a nice site called Save The Developers that was dedicated to rid the world of IE6. The site was hosting some javascript that you could use to throw down a nice "Save the developers and upgrade your IE" message to the IE6 users of your site.
Well as of sometime recently that url redirects you to a Microsoft support site? WTF? Did Mr. Softy just crush these guys? If you have info on this I would love to know.
Conspiracy Theory? :)
Update
Stop IE 6. Another campaign against IE6.
Free the Web! Good luck guys.
Awhile back we found a nice site called Save The Developers that was dedicated to rid the world of IE6. The site was hosting some javascript that you could use to throw down a nice "Save the developers and upgrade your IE" message to the IE6 users of your site.
Well as of sometime recently that url redirects you to a Microsoft support site? WTF? Did Mr. Softy just crush these guys? If you have info on this I would love to know.
Conspiracy Theory? :)
Update
Stop IE 6. Another campaign against IE6.
Free the Web! Good luck guys.
IE6 hangs when downloading compressed images from AWS S3
Like many new sites we store uploaded user images to S3. We are always trying to improve the experience of users so recently we started compressing these images using gzip.
Well, it turns out that for some reason IE6 completely freezes for about 10 minutes when trying to download one of these files. Of course no problems in any other browser.
Luckily IE6 is only 12% of our user base, so now we are forced to have zipped and unzipped images.
Argh IE6! Save the developers!
I hope this helps someone as it drove us nuts trying to figure it out.
Well, it turns out that for some reason IE6 completely freezes for about 10 minutes when trying to download one of these files. Of course no problems in any other browser.
Luckily IE6 is only 12% of our user base, so now we are forced to have zipped and unzipped images.
Argh IE6! Save the developers!
I hope this helps someone as it drove us nuts trying to figure it out.
Thursday, November 6, 2008
Hotmail in Ubuntu fix
Not too long ago there was an update to Hotmail basically rendering it unusable in Ubuntu. This is just one more item to add to the list of reasons why Microsoft sucks. Personally I prefer Gmail but I have a legacy account on Hotmail that I must check every now and then.
After searching around for awhile I came across several solutions to get Hotmail working. One required opening up the about:config settings and changing the general.useragent.vendor from Ubuntu to Firefox. This works but it is required every time you restart your browser. There was also another solution that involved creating some .js script and placing it in your profile folder?!? Finally I found a somewhat decent solution. This should work in any Linux type system.
First you need to install the User Agent Switcher add on.
Then you need to create a new User Agent profile by going to
Tools -> User Agent Switcher -> Options -> Options
Then click on User Agents tab and hit the Add button.
Add the following fields:
Here is what it should look like (some of the characters got cut off at the end)
Then click on OK OK
Now when you want to use Hotmail you can just quickly switch the User Agent Profile to the newly created one. When you are done, simply switch back to the Default Profile.
After searching around for awhile I came across several solutions to get Hotmail working. One required opening up the about:config settings and changing the general.useragent.vendor from Ubuntu to Firefox. This works but it is required every time you restart your browser. There was also another solution that involved creating some .js script and placing it in your profile folder?!? Finally I found a somewhat decent solution. This should work in any Linux type system.
First you need to install the User Agent Switcher add on.
Then you need to create a new User Agent profile by going to
Tools -> User Agent Switcher -> Options -> Options
Then click on User Agents tab and hit the Add button.
Add the following fields:
Description : [whatever]
User Agent : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
App Name : Mozilla Firefox
App Version : 5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
Vendor : [blank]
Vendor Sub : [blank]
Here is what it should look like (some of the characters got cut off at the end)
Then click on OK OK
Now when you want to use Hotmail you can just quickly switch the User Agent Profile to the newly created one. When you are done, simply switch back to the Default Profile.
Friday, October 31, 2008
Capistrano Subversion password
Recently I ran into a problem with Capistrano asking for my password when performing a svn+ssh checkout even though I had my SSH keys configured correctly.
Capistrano hits the svn twice when performing a checkout. The first time it queries the most recent revision number and the second time to perform the actual checkout. It was during this second request that I was being asked for my password. After searching for awhile and trying multiple suggestions I finally came across a solution.
In app/config/deploy.rb :
Basically the ssh_options[:forward_agent] = true option forwards the first authenticated ssh session (the one that queries the revision number) to the second one (the one that performs the checkout).
If you are seeing the same problem this may just be the fix for you are looking for!
Capistrano hits the svn twice when performing a checkout. The first time it queries the most recent revision number and the second time to perform the actual checkout. It was during this second request that I was being asked for my password. After searching for awhile and trying multiple suggestions I finally came across a solution.
In app/config/deploy.rb :
ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/id_rsa"] #Obviously needed
#default_run_options[:pty] = true #Didn't work for me
#ssh_options[:paranoid] = false #Didn't work for me
ssh_options[:forward_agent] = true #Ah hah.. Success!
Basically the ssh_options[:forward_agent] = true option forwards the first authenticated ssh session (the one that queries the revision number) to the second one (the one that performs the checkout).
If you are seeing the same problem this may just be the fix for you are looking for!
Subscribe to:
Posts (Atom)