Feeds:
Posts
Comments

Archive for February, 2011

Greetings!

I was working with an application ( sample app ) from Learn Rails by Example

It uses Git Version Control System to track the changes of code.

I had a master branch and a sub-branch ( sign-in-out )

After checkout from the master branch,

[rajee@localhost sample_app]$ git checkout master

Switched to branch ‘master’

I tried to merge the sub-branch ( sign-in-out ) into master.

[rajee@localhost sample_app]$ git merge sign-in-out

But i received the following error

Error

Updating 77e2668..3db6c58
error: Your local changes to the following files would be overwritten by merge:
webrat.log
Please, commit your changes or stash them before you can merge.
Aborting

Then i googled and found a link http://stackoverflow.com/questions/1291459/to-git-checkout-without-overwriting-data to solve it.

After reading the link, i found git stash command will solve my error.

Then i looked for git stash manual page to know what it is.

Solution

[rajee@localhost sample_app]$ git stash
Saved working directory and index state WIP on master: 77e2668 Finished user signup
HEAD is now at 77e2668 Finished user signup

Now issuing merge command

[rajee@localhost sample_app]$ git merge sign-in-out
Updating 77e2668..3db6c58
Fast-forward
app/controllers/application_controller.rb    |    1 +
app/controllers/sessions_controller.rb       |   25 +

..

Wow…It worked 🙂 🙂

Advertisements

Read Full Post »

Hai,

Today we ( teammates ) spent time with our mentor Chandrashekar sir 🙂

We discussed with the user stories for our next project

While talking about it, our sir mentored us in a topic, “Time Management

He told about how to manage the time to make us productive on every day.

I recollected my friend, Shrini’s words, who use to mentor me then for a good career

Iam impressed by the following lines from our sir’s talk

If there is no one to assign a work for you, do self-plan and assign work for ourselves, so that you will get more interested to do it, rather than for others

Thanks for a wonderful talk sir

After the  class gets over, i started to watch Chapter 10 of Learn Rails by Example

This lesson is nearly 2 and 1/2 hour video

I have watched only one hour video but didnt work on it.

Hope to watch and work it out on the next working day

Read Full Post »

Hai,

Today i received a mail regarding a screencast done by bala and posted to kanchilug mailing list.

It is approximately 11 minute tutorial.

From this video i learnt on

  • Handling folders in number of tabs
  • Changing the background inside a file browser
  • To view the current location
  • Shortcut keys for minimizing/closing the windows, enlarging/decreasing the folder sizes etc.

I have fedora 14 on my system.

Though this video showcased Ubuntu features, it works in fedora too.

And one more unique feature is, it is done in our mother tongue, Tamil 🙂

Here’s the screencast



Thanks a lot to Bala.

Read Full Post »

Hai,

Today i completed watching and working with Chapter 9 of Learn Rails by Example

I learnt on how to generate a successful Sign up, Sign in and Sign out methodologies

But i faced show stoppers in this lesson.

Hope, it will get solved working with it one more time and reading the book

The first step in  the development of Sign in and Sign out is to generate a session controller

Generate session controller


rails generate controller Sessions new

Modify the routes.rb The next step is to modify the routes.rb file to include the resource, sessions

resources :sessions
match '/signin', :to => 'sessions#new'
match '/signout' :to => 'sessions#destroy'

Creating Sign-in form


<h1>Sign in</h1>

<%= form_for(:session, :url => sessions_path) do |f| %>

<div>
 <%= f.label :email %><br />
 <%= f.text_field :email %>
 </div>
 <div>
 <%= f.label :password %><br />
 <%= f.password_field :password %>
 </div>
 <div>
 <%= f.submit "Sign in" %>
 </div>
 <% end %>

<p>New user? <%= link_to "Sign up now!", signup_path %></p>


This tutorial introduced me to important concepts such as cookies, authentication

I thought of updating the code of what i practised today, but i faced a problem in updating my git repository

When i gave the git merge sign-in-out command, received the following error

Error

Updating 77e2668..3db6c58
error: Your local changes to the following files would be overwritten by merge:
webrat.log
Please, commit your changes or stash them before you can merge.
Aborting

I searched to solve it but couldn’t end up

Hope to solve it soon and will share my learning experience with Chapter 9.

By 3:45 p.m., we gathered for a SCRUM meet, and i told as i worked with Chapter 9.

So far, i have completed learning nine lessons, and will be continuing with Chapter 10 :)


Read Full Post »

Hai

Today i worked the exercises at the end of Chapter 8 of Learn Rails by Example and watched the Chapter 9 screencast

Working with Chapter 8 Exercises

Question 1:

Write tests to check for the presence of each field (name, email, password, password_confirmation) on the signup form.

Solution


require 'spec_helper'
describe UsersController do
render_views
describe "GET 'new'" do

it "should have a name field" do
 get :new
 response.should have_selector("input[name='user[name]'][type='text']")
 end

 it "should have an email field" do
 get :new
 response.should have_selector("input[name='user[email]'][type='text']")
 end

 it "should have a password field" do
 get :new
 response.should have_selector("input[name='user[password]'][type='password']")
 end

 it "should have a password confirmation field" do
 get :new
 response.should have_selector("input[name='user[password_confirmation]'][type='password']")
 end

 end

Since i dont know to give a solution for Question 2, i skipped it and moved to Question 3

Question 3

Refine the code of ‘flash HTML’ in application.html.erb using content_tag helper

Solution

<% flash.each do |key, value| %>
<%= content_tag(:div, value, :class => "flash #{key}") %>
<% end %>

Then i started to watch Chapter 9 screencast.

It completes the sign in and sign out mechanism for the application

I didnt start to work on it.

By 4:00 p.m. we had a SCRUM meet and i told as i worked with Chapter 8 exercises and watched Chapter 9 tutorial

Will be start to work on Chapter 9 by tomorrow 🙂

Read Full Post »

Greetings!

Today i completed working with Chapter 8 of Learn Rails by Example

From this lesson, i learnt to create a functioning ‘Sign Up‘ form

The first step is to write test cases matching the valid information entered by the user

Writing success test case if the attributes are valid

spec/controllers/users_controller_spec.rb


describe "success" do

 before(:each) do
 @attr = { :name => "New User", :email => "user@example.com",
 :password => "foobar", :password_confirmation => "foobar" }
 end

 it "should create a user" do
 lambda do
 post :create, :user => @attr
 end.should change(User, :count).by(1)
 end

 it "should redirect to the user show page" do
 post :create, :user => @attr
 response.should redirect_to(user_path(assigns(:user)))
 end

 it "should have a welcome message" do
 post :create, :user => @attr
 flash[:success].should =~ /welcome to the sample app/i
 end

Add  code to save the user.

It is included inside create method in app/controllers/users_controller.rb


def create
 @user = User.new(params[:user])
 if @user.save
 redirect_to @user, :flash => { :success => "Welcome to the Sample App!"}
 else
 @title = "Sign up"
 render 'new'
 end

 end

Then wrote integration test for the Sign up form


rails generate integration_test users

Writing integration tests cases in spec/requests/users_spec.rb


require 'spec_helper'

describe "Users" do

 describe "signup" do

 describe "failure" do

 it "should not make a new user" do
 lambda do
 visit signup_path
 fill_in "Name",         :with => ""
 fill_in "Email",         :with => ""
 fill_in "Password",     :with => ""
 fill_in "Confirmation", :with => ""
 click_button
 response.should render_template('users/new')
 response.should have_selector('div#error_explanation')
 end.should_not change(User, :count)
 end

 end

 describe "success" do

 it "should make a new user" do
 lambda do
 visit signup_path
 fill_in "Name",         :with => "Example User"
 fill_in "Email",         :with => "user@example.com"
 fill_in "Password",     :with => "foobar"
 fill_in "Confirmation", :with => "foobar"
 click_button
 response.should have_selector('div.flash.success',
 :content => "Welcome")
 response.should render_template('users/show')
 end.should change(User, :count).by(1)
 end

 end

 end

end

Here’s my updated Git and Heroku URL’s

Git URL : https://github.com/rajee/sample_app

Heroku URL : http://floating-river-137.heroku.com/

By 3:45 p.m., we gathered for a SCRUM meet and i told as completed working with Chapter 8

Our mentor, Chandrashekar sir asked us to go through a ReadySet templates ( http://readyset.tigris.org/ )

After the meet, i explored a little bit on it.

ReadySet template is a open source project consists of project management templates helpful in documenting the project.

By tomorrow, i will continue my rails learning process from Chapter 9 🙂

Read Full Post »

Hai

To create screencasts in open source technologies i installed the screen recording software, gtk-recordmydesktop

Installation:

yum install gtk-recordmydesktop

You can found the software in Applications -> Sound & Video -> gtk-recordMyDesktop

Read Full Post »

Older Posts »