Ruby on Rails guide web sites

1. Gems release, current  version, popularity, bug tracker and for gem wiki link

https://www.ruby-toolbox.com/

2. Ruby language Fundamentals

http://ruby-doc.org/ under it http://docs.ruby-doc.com/docs/ProgrammingRuby/

3. Rails API doc

http://railsapi.com/

4. Get started with rails installation

http://rubyonrails.org/

5. Subversion Git

http://gitref.org/

6.  Live example

http://railsforzombies.org/

7. Online practice Ruby

codepad.org

How to open mobile view on Desktop browsers?

Actually it is very simple

1. Firstly you will have to install Mozilla Firefox browser on you stytem.
2. Install the User Agent AddOn in Firefox and restart Firefox.
3. From Tool Bar of Firefox: Tools >> Default User Agent >> iPhone

Destop firefox user Agent to open mobile view iphone, android on desktop

Destop firefox user Agent

Then this will open the iPhone view of the websites for you in desktop if it exists.
Now, If you want to view the looks of the website for other devices the go to:
Tools >> Default user Agent >> Edit User Agents >> New >> New User Agent

User Agent Firefox

Edit User Agent

and then in
Description : Example iPhone, Android, Tablet etc
User Agent : Paste the following

For iPhone :
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16

Tablet ios :
Mozilla/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B141 Safari/8536.25

BlackBerry:
BlackBerry8520/5.0.0.681 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/301

Android 4.04:
Mozilla/5.0 (Linux; U; Android 4.0.4; en-gb; GT-S7562 Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

This UserAgent woks fine with Ruby on Rails Project using Mobile_Fu gem for creating different mobile views.

How to freeze my Rails application?, Why I Should freeze my Rails application?

Ruby on Rails allows you to “freeze” the version of Rails used by your application.

1. Following command will freeze your application to the version of Rails that is currently on server:

rake rails:freeze:gems

This command will copy the Rails files to the “vendor/rails” directory of the application. When the Rails application the it will first check for the presence of “vendor/rails” directory. If it exists, Rails will load the Rails components from the directory instead of using the main server copy of Rails.

Unfreezing:

rake rails:unfreeze

Freezing to a different version

This command freezes the application to Rails 2.2.2:

rake rails:freeze:edge RELEASE=2.2.2

Following command freezes Rails to the current development version of your application:

rake rails:freeze:edge

To Find the Rails version of your application using use this command:

script/about

After updating Rails version update your configuration file “config/boot.rb”:

rake rails:update

Ajax call on succes of the previous ajax call?

1st ajax call:


$.ajax({
url:"/your_controller/your_action",
cache:false,
success:function (data) {
check_subs = data; //returned text
if(check=="no"){
alert("This service is not for you.")
}
if(check_subs=="yes"){
var calling_url='http:///subscription/.aspx?entrytype=ACT&entrymode=pack_w&request_attempt=' + random_uuid;
$.ajax({ //2nd ajax call
url:calling_url,
cache:false,
success:function (data) {
alert("Your request for pack is sent ");
console.log(data);
}
});

}
}
});
}
}

Post caling in rails with link_to tag.

Http calling:

<%= link_to “Click to call”, url_for(:action => ‘your_action’, :controller => ‘your_controller’), {:class => ‘html_class’, :method => :post %>

Ajax calling:

<%= link_to “Click to call “, url_for(:action => ‘your_action’, :controller => ‘your_controller’), {:class => ‘html_class’, :method => :post, :remote => true} %>

Css elements used to keep your the html elements at their appropriate location.

Actually by profession I am a application developer and deals in developments in web and desktop. More interestingly I spent my time in writing logic’s and db and end user GUI  management. But now in my new company we don’t  have a designer so I am doing a designer job too and sharing my experience in form of a blog. So here is my small blog with few css important points and elements. I will keep on updating this post.

Point 1: Never design a page using table tags always use div.

Actually By using table tags you are just limiting your design scope.Because init you will have to keep every element inside a TD tag and then handling every elements by TDusing colspan & rowspan and giving every TD different width and height or giving TD  an ID or class and then handling thoes TD on css page is a complete mess. Moreover if place a DIV inside TD the whole look of your website will be ruptured in Internet Explorer and Opera. But may work fine with Chrome and Mozilla browser.

CSS:

1. Margin: margin-left , margin-right, margin-top, margin-bottom

2. Padding: margin-left , margin-right, margin-top, margin-bottom

3. z-index

4. Opacity: Range 0.0 to 1.0

5. Filter: Range 0 to 100 Specially for Internet explorer

example: alpha(opacity=40);

6. Float: left, right

7. Position: static, relative, absolute, fixed

8. Vertical-algin: middle, top, bottom, inherit, text-top, text-bottom  http://www.w3schools.com/cssref/playit.asp?filename=playcss_vertical-align&preval=50%25

9. line-height: px and % used to blur or darken text or setting gap between 2 consecutive                      dlines.

10. white-space: nowrap , will remove all enter.

Eclipse stops functioning if we update java version via notification or from else where?

After updating a java version why eclipse stops functioning or the java programs which were executing fine stop executing and on terminal when we ask for java to tell its version by java -version command in prompt it gives us the following error:

C:\Users\Dell>java -version
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

what is the reason behind all this it means your java version have been changed and latest java updates has been installed and now you must update you system variable to get back every thing normal. Go to : properties of your computer then system properties then in system variable update the PATH by edit option and init preappend the PATH to your new jre which in my case is :

C:\Program Files\Java\jdk1.6.0_22\jre\bin

then every thing get back to normal.