The Web’s Funniest Error Messages

Nice images collection on Mashable
In this step:
- using “Flash Message Conductor” (http://swik.net/Rails/Robby+on+Rails/Flash+Message+Conductor+now+a+Gem/c39as) I managed messages and errors.
- using javascript + css I managed row highlight both in contacts view and mailinglists view
<!-- _row.html.erb <== contacts view -->
<tr class="<%= cycle('oddrow','evenrow') %>" onmouseover="cell_over(this, 'TrHover')" onmouseout="cell_out(this)">
<td>< %=h row.email %></td>
<td>< %=h row.firstname %></td>
<td>< %=h row.lastname %></td>
<td>< %=h row.privacy %></td>
<td>
< %= link_to 'Edit', :controller => 'contacts', :action => :edit, :id => row.id %>
</td>
<td>
< %= link_to_remote 'Delete',
:update => 'container',
:url => { :action => :destroy, :id => row.id},
:confirm => 'Are you sure?', :method => :delete
%>
</td>
</tr>
/**
* mouseover.js
* @author massimo
*/
function cell_over(cell, classname) {
if (document.all || document.getElementById) {
cell.classBackup = cell.className;
cell.className = classname;
}
}
function cell_out(cell){
if (document.all || document.getElementById) {
cell.className = cell.classBackup;
}
}
- using Ajax I managed “new contact”
<%= javascript_include_tag :defaults %>
....
<% form_remote_tag(:url => {:action => 'create'},
:html => {:id => 'contact_form'}) do %>
<div id="contact_para">
<p>
<b>Email</b>
<%= text_field "contact", "email" %>
</p>
<p>
<b>Firstname</b>
<%= text_field "contact", "firstname" %>
</p>
<p>
<b>Lastname</b>
<%= text_field "contact", "lastname" %>
</p>
<p>
<b>Authorized</b>
<%= check_box "contact", "privacy" %>
</p>
<p>
<%= submit_tag 'Add' %>
</p>
</div>
<% end %>
The below video show the site functionality.

You can download the source developed till now clicking here.
In the 2 following video you can see how to create pages accessible only to logged in users.


You can download the source developed till now clicking here.
Hi all.
To manage users, instead of reinvent the wheel, we can use Ruby on Rails plugins. The web site Agile Web Development contains a complete list of plugins. In home page, in the “browse by tag” section, you can click on “authentication” and then select “Restful-authentication”.
The Restful-authentication plugin provides a foundation for managing user authentication:
* Login / logout
* Secure password handling
* Account activation by validating email
* Account approval / disabling by admin
* Rudimentary hooks for authorization and access control.
Ok, now we have to install the plugin:


ruby script/generate authenticated user sessions
Run the migration
The system also generated a migration file. Run the migration with:
rake db:migrate
Modify the routes file
Open up config/routes.rb and add to the named route section:
map.activate '/activate/:activation_code', :controller => 'users',
:action => 'activate'
While the routes file is still open, add more named routes (giving the user actions nice, friendly urls)
map.signup '/signup', :controller => 'users', :action => 'new' map.login '/login', :controller => 'sessions', :action => 'new' map.logout '/logout', :controller => 'sessions', :action => 'destroy'
Add an observer
Add an observer to config/enviroment.rb (within the Rails::Initializer.run block) :
config.active_record.observers = :user_observer
At this point, the basic system should be working. Start up your development server and go to http://localhost:3000/signup. Also try http://localhost:3000/login to confirm it’s fine.

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.example-domain.com",
:port => 25,
:domain => "www.example-domain.com",
:authentication => :login,
:user_name => "user@example-domain.com",
:password => "secret"
}
:address and :port – Determines the address and port of the SMTP server you’ll be using. These default to localhost and 25 , respectively.
:domain – The domain the mailer should use when identifying itself to the server (usually the top-level domain name of the machine sending the email).
:authentication – One of :plain, :login or :cram_md5. Should be omitted if the server does not require authentication. Also omit :username and :password options if you omit this parameter.
:username and :password – Mail account login credentials. Required if :authentication is set.
Note:
to test ActionMailer I used a private smtp server but it’s possible to use the smtp server of your email providere such as GMail (on the net there’s a lot of tutorials; e.g. try this one: http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration-for-gmail).
How the registration process works
After the filling of the login form the system send to the user an email with an activation code.


You can download the source developed till now clicking here.
In the next step we will see how to create pages accessible only to logged in users.
Hi all,
in this second step we’ll define the layout of the site and the controller to manage the informative pages.
First of all define the application layout:






You can download the source developed till now clicking here.
In the next step we will deal the user management.
Hi all,
some info before to start: my development environment is on a Linux machine and I use Aptana RadRails as IDE and MySql as database.

Each area will be developed step by step.
First of all we must create a new Rails project: menu File->New->Rails project.







Hi all,
I’m trying to learn Ruby on Rails and to do this I read a couple of books (Agile Web Development with Rails Second Edition, Simply Rails 2 by Patrick Lorenz), tutorials and saw LearningRails screencasts.
In spite of my effort my proficiency of Rails is still basic so I decided to improve it building a real web site and to share my code in this blog. In this way I hope to learn, also with your help (comments/suggestions), Rails in depth.
I’ll try to build an “Email Marketing Web SIte”: my inspiration is the MailChimp website, a professional and well done website.
Obviously my website will not be a replica of MailChimp nor a professional website: I only hope to examine and develop the main aspects of email marketing.
That’s all for now.
Stay tuned.
Massimo
Samsung Electronics Co. Ltd., a leading mobile phone provider, today announced the launch of its own open mobile platform, Samsung bada [bada] in December. This new addition to Samsung’s mobile ecosystem enables developers to create applications for millions of new Samsung mobile phones, and consumers to enjoy a fun and diverse mobile experience.
In order to build a rich smartphone experience accessible to a wider range of consumers across the world, Samsung brings bada, a new platform with a variety of mobile applications and content.
The name ‘bada’, which means ‘ocean’ in Korean, was chosen to convey the limitless variety of potential applications which can be created using the new platform.
Read on Bada blog