tag:blogger.com,1999:blog-60796218630454417832024-02-22T20:03:29.232+05:30TEAMPHPThe real problem is not whether machines think but whether men do...Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.comBlogger95125tag:blogger.com,1999:blog-6079621863045441783.post-88441987959612334252015-01-13T12:54:00.000+05:302015-01-13T12:59:40.291+05:30Jquery Advanced Best Practices <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="syntaxhighlighter " id="highlighter_537445" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; min-height: inherit !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 544.5px;">
<div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">1. Always Descend From an #id</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">This is the golden rule of the jQuery selectors. The fastest way to select an element in jQuery is by ID:</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$('#content').hide();</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">or select multiple elements descending from an ID:</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$('#content p').hide();</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">2.Use Tags Before Classes</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">The second fastest selector in jQuery is the Tag selector ($(‘head’)) because it maps to a native JavaScript method, getElementsByTagName(). The best way is to prefix a class with a tag name (and descend from an ID):</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var receiveNewsletter = $('#nslForm input.on');</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">The class selector is among the slowest selectors in jQuery; in IE it loops through the entire DOM. Avoid using it whenever possible. Never prefix an ID with a tag name. For example, this is slow because it will loop through all <div> elements looking for the ‘content’ ID:</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var content = $('div#content'); // VERY SLOW, AVOID THIS</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">Also, DON’T descend from multiple IDs:</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var traffic_light = $('#content #traffic_light'); // VERY SLOW, AVOID THIS</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">Cache the parent object then run queries on it:</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var header = $('#header');</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var menu = header.find('.menu');</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">menu = $('.menu', header);</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">4. Optimize selectors for Sizzle’s ‘right to left’ model</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var linkContacts = $('.contact-links div.side-wrapper');</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">instead of:</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var linkContacts = $('a.contact-links .side-wrapper')</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">5. Use find() rather than context</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var divs = $('.testdiv', '#pageBody'); </span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var divs = $('#pageBody').find('.testdiv');</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">var divs = $('#pageBody .testdiv');</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">5. Use direct functions rather than their convenience counterparts</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">For better performance you can use direct functions like $.ajax() rather than $.get(), $.getJSON(), $.post() because the last ones are shortcuts that call the $.ajax() function</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">6.Use shorcuts </span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">Consider, below jQuery code lines.</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").css("display", "none"); //Line 1</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").css("display", ""); //Line 2</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").html(""); //Line 3</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">Above code lines are very common but its unfortunate because some faster and more readable shortcuts available, yet ignored. Find below jQuery code lines that does the exactly same thing but these are more readable and fast.</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").hide(); //Line 1</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").show(); //Line 2</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").empty(); //Line 3</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">There are many more examples which you can find in your code. For example, to add CSS Class to any element</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").prop("class", "cssClass");</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">where the better approach would be,</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").addClass("cssClass");</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">Another example is of setting height and width,</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").css("height", "100px"); //Line 1</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").css("width", "100px"); //Line 2</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">using in-built jQuery functions,</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").height(100); //Line 1</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").width(100); //Line 2</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">Another common situation is of toggling (show/hide) of element. For example, </span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">if($("#elm").is(":visible")) </span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"> $("#elm").css("display", "none");</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">else </span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"> $("#elm").css("display", "");</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">where the better approach is,</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">$("#elm").toggle();</span></span><br />
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;"><br /></span></span>
<span style="color: #444444; font-family: Courier New, Courier, monospace; font-size: x-small;"><span style="line-height: 14.300000190734863px;">to be continued . . . .:)</span></span></div>
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<span style="font-family: Open Sans, sans-serif;"><span style="font-size: 14px; line-height: 26px;">
</span></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-27951113456189606172015-01-13T12:13:00.001+05:302015-01-13T12:17:12.450+05:30Jquery Best practice - Event Handling <div dir="ltr" style="text-align: left;" trbidi="on">
<b> We usually do this :</b><br />
<br />
$("#longlist li").on("mouseenter", function() {<br />
<br />
$(this).text("Click me!");<br />
<br />
});<br />
<br />
<br />
$("#longlist li").on("click", function() {<br />
<br />
$(this).text("Why did you click me?!");<br />
<br />
});<br />
<br />
This is fine IF...<br />
<br />
If you like using a lot of memory for event handlers<br />
If you don't have many DOM elements<br />
If you don't care about best practices<br />
<br />
<br />
<b>Best Approach : Event Delegation </b><br />
<br />
<br />
var list = $("#longlist");<br />
<br />
list.on("mouseenter", "li", function(){<br />
<br />
$(this).text("Click me!");<br />
<br />
});<br />
<br />
list.on("click", "li", function() {<br />
<br />
$(this).text("Why did you click me?!");<br />
<br />
});<br />
<br />
Simple but thoughtful :)<br />
<br />
Try n feel the difference...</div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-72784065655690594292015-01-13T12:02:00.003+05:302015-01-13T12:07:30.334+05:30JQuery Best Practices - DOM Manipulation<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<b> Usually we folllow like this ..</b><br />
<br />
// Set's an element's title attribute using it's current text<br />
$(".container input#elem").attr("title", $(".container input#elem").text());<br />
<br />
// Set's an element's text color to red<br />
$(".container input#elem").css("color", "red");<br />
<br />
// Makes the element fade out<br />
$(".container input#elem").fadeOut();<br />
<br />
<b>This is fine if ..</b><br />
<br />
If you like repeating yourself<br />
If you do not care about performance<br />
If you don't care about best practices<br />
<br />
<b> Best Approach.. </b><br />
<br />
// Stores the live DOM element inside of a variable<br />
<br />
var elem = $("#elem");<br />
<br />
// Set's an element's title attribute using it's current text<br />
elem.attr("title", elem.text());<br />
<br />
// Set's an element's text color to red<br />
elem.css("color", "red");<br />
<br />
// Makes the element fade out<br />
elem.fadeOut();<br />
<br />
cache your selectors in variables :)<br />
<br />
<b><span style="color: red;">Another Example </span></b><br />
<b><br /></b>
<b> Mostly we prefer doing like this ..</b><br />
<br />
// Dynamically building an unordered list from an array<br />
<br />
var localArr = ["Greg", "Peter", "Kyle", "Danny", "Mark"],<br />
<br />
list = $("ul.people");<br />
<br />
$.each(localArr, function(index, value) {<br />
<br />
list.append("<li id=" + index + ">" + value + "</li>");<br />
<br />
});<br />
<br />
// Dynamically building an unordered list from an array<br />
var localArr = ["Greg", "Peter", "Kyle", "Danny", "Mark"],<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>list = $("ul.people"),<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dynamicItems = "";<br />
<br />
$.each(localArr, function(index, value) {<br />
<br />
dynamicItems += "<li id=" + index + ">" + value + "</li>";<br />
<br />
});<br />
<br />
list.append(dynamicItems);<br />
<br />
<br />
Append only once instead of doing it every time ..:)<br />
<br />
Jst try :) </div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-65347558586020139622015-01-13T11:57:00.002+05:302015-01-13T11:57:57.697+05:30JQuery Best Practices - Document ready<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Most projects starts like this</b><br />
<br />
$("document").ready(function() {<br />
// The DOM is ready!<br />
// The rest of the code goes here<br />
});<br />
<br />
<b>This is fine if</b><br />
<br />
If you know the environments where your code will run<br />
If you do not care about page load performance<br />
If you don't care about best practices<br />
<br />
<b>This is better</b><br />
<br />
// IIFE - Immediately Invoked Function Expression<br />
<br />
(function($, window, document) {<br />
<br />
// The $ is now locally scoped<br />
<br />
// Listen for the jQuery ready event on the document<br />
$(function() {<br />
<br />
// The DOM is ready!<br />
<br />
});<br />
<br />
// The rest of the code goes here!<br />
<br />
}(window.jQuery, window, document));<br />
<br />
// The global jQuery object is passed as a parameter<br />
<br />
---------------------------------------------------------------------------------------------------------<br />
<div>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-50109069214796157242013-03-19T10:23:00.002+05:302013-03-19T10:29:06.274+05:30HTML 5 - Navigation with the nav element<div dir="ltr" style="text-align: left;" trbidi="on">
One of the new elements for HTML 5 is the <span style="color: orange;"><nav></span> element which allows you to group together links, resulting in more semantic markup and extra structure which may help screenreaders.<br />
<br />
<br />
HTML5 nav tag defines the section for navigation links in a document. It is not mandatory to place all the links of a document in nav element, but the major navigational links should be placed under it. This element can be used more than one place within a document. But nav element should be placed in such places in a document so that visitors can easily access the navigational links.<br />
<br />
Important point need to be remembered:<br />
<br />
HTML5 nav element is supported by latest versions of all web browsers. Internet Explorer 8 or earlier versions of Internet Explorer do not support nav element.<br />
<br />
<br />
<span style="background-color: #b6d7a8;"><b>How to use it</b></span><br />
<br />
You are probably used to using something like<br />
<br />
<span style="background-color: #d9ead3;"><div id="nav"></span><br />
<span style="background-color: #d9ead3;"><ul></span><br />
<span style="background-color: #d9ead3;"><li><a.... etc</span><br />
<span style="background-color: #d9ead3;">Or</span><br />
<br />
<ul id="mainNav"><br />
Well, for the sake of your markup, nothing much will change as you will now have something like this<br />
<br />
<span style="background-color: #d9ead3;"><nav></span><br />
<span style="background-color: #d9ead3;"><ul></span><br />
<span style="background-color: #d9ead3;"><li><a href="index.html">Home</a></li></span><br />
<span style="background-color: #d9ead3;"><li><a href="/about/">About</a></li></span><br />
<span style="background-color: #d9ead3;"><li><a href="/blog/">Blog</a></li></span><br />
<span style="background-color: #d9ead3;"></ul></span><br />
<span style="background-color: #d9ead3;"></nav></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<b style="background-color: #b6d7a8;">The specification</b><br />
<br />
<br />
In the following example, the page has several places where links are present, but only one of those places is considered a navigation section.<br />
<br />
<span style="background-color: #d9ead3;"><body></span><br />
<span style="background-color: #d9ead3;"><header></span><br />
<span style="background-color: #d9ead3;"><h1>Wake up sheeple!</h1></span><br />
<span style="background-color: #d9ead3;"><p><a href="news.html">News</a> -</span><br />
<span style="background-color: #d9ead3;"><a href="blog.html">Blog</a> -</span><br />
<span style="background-color: #d9ead3;"><a href="forums.html">Forums</a></p></span><br />
<span style="background-color: #d9ead3;"><p>Last Modified: <time>2009-04-01</time></p></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<span style="background-color: #d9ead3;"><nav></span><br />
<span style="background-color: #d9ead3;"><h1>Navigation</h1></span><br />
<span style="background-color: #d9ead3;"><ul></span><br />
<span style="background-color: #d9ead3;"><li><a href="articles.html">Index of all articles</a></li></span><br />
<span style="background-color: #d9ead3;"><li><a href="today.html">Things sheeple need to wake up for today</a></li></span><br />
<span style="background-color: #d9ead3;"><li><a href="successes.html">Sheeple we have managed to wake</a></li></span><br />
<span style="background-color: #d9ead3;"></ul></span><br />
<span style="background-color: #d9ead3;"></nav></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<span style="background-color: #d9ead3;"></header></span><br />
<span style="background-color: #d9ead3;"><article></span><br />
<span style="background-color: #d9ead3;"><p>...page content would be here...</p></span><br />
<span style="background-color: #d9ead3;"></article></span><br />
<span style="background-color: #d9ead3;"><footer></span><br />
<span style="background-color: #d9ead3;"><p>Copyright © 2006 The Example Company</p></span><br />
<span style="background-color: #d9ead3;"><p><a href="about.html">About</a> -</span><br />
<span style="background-color: #d9ead3;"><a href="policy.html">Privacy Policy</a> -</span><br />
<span style="background-color: #d9ead3;"><a href="contact.html">Contact Us</a></p></span><br />
<span style="background-color: #d9ead3;"></footer></span><br />
<span style="background-color: #d9ead3;"></body></span><br />
<br />
There are six items of navigation in the header element there. But only three are in the nav tag. There is no explanation as to what differentiates the first three links with the second three links – both go to different pages and all are in internal to that current site.<br />
<br />
See a second example:<br />
<br />
<span style="background-color: #d9ead3;"><body></span><br />
<span style="background-color: #d9ead3;"><h1>The Wiki Center Of Exampland</h1></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<span style="background-color: #d9ead3;"><nav></span><br />
<span style="background-color: #d9ead3;"><ul></span><br />
<span style="background-color: #d9ead3;"><li><a href="/">Home</a></li></span><br />
<span style="background-color: #d9ead3;"><li><a href="/events">Current Events</a></li></span><br />
<span style="background-color: #d9ead3;">...more...</span><br />
<span style="background-color: #d9ead3;"></ul></span><br />
<span style="background-color: #d9ead3;"></nav></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<span style="background-color: #d9ead3;"><article></span><br />
<span style="background-color: #d9ead3;"><header></span><br />
<span style="background-color: #d9ead3;"><h1>Demos in Exampland</h1></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<span style="background-color: #d9ead3;"><nav></span><br />
<span style="background-color: #d9ead3;"><ul></span><br />
<span style="background-color: #d9ead3;"><li><a href="#public">Public demonstrations</a></li></span><br />
<span style="background-color: #d9ead3;"><li><a href="#destroy">Demolitions</a></li></span><br />
<span style="background-color: #d9ead3;">...more...</span><br />
<span style="background-color: #d9ead3;"></ul></span><br />
<span style="background-color: #d9ead3;"></nav></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<span style="background-color: #d9ead3;"></header></span><br />
<span style="background-color: #d9ead3;"><section id="public"></span><br />
<span style="background-color: #d9ead3;"><h1>Public demonstrations</h1></span><br />
<span style="background-color: #d9ead3;"><p>...more...</p></span><br />
<span style="background-color: #d9ead3;"></section></span><br />
<span style="background-color: #d9ead3;"><section id="destroy"></span><br />
<span style="background-color: #d9ead3;"><h1>Demolitions</h1></span><br />
<span style="background-color: #d9ead3;"><p>...more...</p></span><br />
<span style="background-color: #d9ead3;"></section></span><br />
<span style="background-color: #d9ead3;">...more...</span><br />
<span style="background-color: #d9ead3;"><footer></span><br />
<span style="background-color: #d9ead3;"><p><a href="?edit">Edit</a> | <a href="?delete">Delete</a> | <a href="?Rename">Rename</a></p></span><br />
<span style="background-color: #d9ead3;"></footer></span><br />
<span style="background-color: #d9ead3;"></article></span><br />
<span style="background-color: #d9ead3;"><footer></span><br />
<span style="background-color: #d9ead3;"><p><small>© copyright 1998 Exampland Emperor</small></p></span><br />
<span style="background-color: #d9ead3;"></footer></span><br />
<span style="background-color: #d9ead3;"></body></span><br />
<span style="background-color: #d9ead3;"><br /></span>
This is a little more helpful as I find the biggest isse of the <nav> element is deciding which sets of links should be classed as major navigation.<br />
<br />
<br />
<span style="background-color: #d9ead3;">Other Possible Uses</span><br />
<br />
Below are a few more examples of other areas of the site in which you might consider using the <nav> element. It is also important to note that while XHTML 2 <nl> element, this hasn’t been replicated in HTML 5 because navigation does not have to take list form, as we’ll see.<br />
<br />
<ul style="text-align: left;">
<li>Table of Contents</li>
<li>Previous/next buttons (or pagination)</li>
</ul>
<ul style="text-align: left;">
<li>Menu - developers are using the <menu> element for navigation rather than the <nav> element. We thought it best to clarify that <menu> is to be used for a list of commands and is an interactive element and more likely to be used exclusively in Web Applications.</li>
</ul>
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-31012873456649282842013-03-19T10:11:00.001+05:302013-03-19T10:12:05.219+05:30HTML 5 - The header element<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Several new tags or elements have been added in HTML5. The header tag (<b><header></b>) is one of them. It is used as header of one or more sections or as a header of the document. HTML5 header tag should be used as a container of introductory contents like <h1> – <h6> tags, table of contents, search form, logo etc. with or without navigational links. More than header element can be used in a HTML5 document and it is generally placed at the beginning of the document or <article> tag.<br />
<br />
Important points need to be remembered:<br />
<br />
1. <header> and <head> tags are completely different.<br />
2. A <header> tag can’t be placed within <footer> or <address> tag. Also header element can’t be placed within another header element.<br />
3. HTML5 header element is supported by latest versions of all web browsers. Internet Explorer 8 or earlier versions of Internet Explorer do not support header element.<br />
<br />
There are few HTML5 header tag examples given below:<br />
<br />
Below the header tag is used as document header<br />
<br />
<span style="background-color: #d9ead3;">1<span class="Apple-tab-span" style="white-space: pre;"> </span><header></span><br />
<span style="background-color: #d9ead3;">2<span class="Apple-tab-span" style="white-space: pre;"> </span><h1>This is the heading of the page</h1></span><br />
<span style="background-color: #d9ead3;">3<span class="Apple-tab-span" style="white-space: pre;"> </span>With some supplementary information</span><br />
<span style="background-color: #d9ead3;">4<span class="Apple-tab-span" style="white-space: pre;"> </span></header></span><br />
Below the header element is used as article header<br />
<br />
<span style="background-color: #d9ead3;">1<span class="Apple-tab-span" style="white-space: pre;"> </span><article></span><br />
<span style="background-color: #d9ead3;">2<span class="Apple-tab-span" style="white-space: pre;"> </span><header></span><br />
<span style="background-color: #d9ead3;">3<span class="Apple-tab-span" style="white-space: pre;"> </span><h1>Title of this article</h1></span><br />
<span style="background-color: #d9ead3;">4<span class="Apple-tab-span" style="white-space: pre;"> </span>By S Ghosh</span><br />
<span style="background-color: #d9ead3;">5<span class="Apple-tab-span" style="white-space: pre;"> </span></header></span><br />
<span style="background-color: #d9ead3;">6<span class="Apple-tab-span" style="white-space: pre;"> </span>Contents of the article</span><br />
<span style="background-color: #d9ead3;">7<span class="Apple-tab-span" style="white-space: pre;"> </span></article></span><br />
<span style="background-color: #d9ead3;"><br /></span>
<span style="background-color: #d9ead3;">In summary <header> give us some great added semantic value in order to describe the head of a section.</span><br />
<div>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-72752015479735547112013-03-19T09:59:00.001+05:302013-03-19T10:11:51.400+05:30 An Inroduction to HTML 5 <div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<b><span style="font-family: inherit;"><br /></span></b></div>
<div style="border: 0px; margin-bottom: 10px; padding: 0px; text-align: justify; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
<div style="text-align: left;">
<span style="font-family: inherit; line-height: 24px;"><span style="color: orange; font-weight: bold;">HTML5 </span>is the latest version of Hyper Text Markup Language. The version of this language is 5 and it is still under development. The main aim of HTML5 is to increase the latest multimedia support and to decrease the dependency on client side scripting language like JavaScript and third party plugging like Adobe Flash Player etc. HTML5 can be effectively run on low-powered devices such as smart phones, tablets etc. Several new elements like <video>, <audio>, <canvas> etc. have been introduced in <span style="color: orange;">HTML5</span>.</span></div>
</div>
<div style="background-color: white; border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
<span style="font-family: inherit; line-height: 24px;"><b><br /></b></span></div>
<div style="border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
<span style="font-family: inherit; line-height: 24px;"><span style="background-color: orange; font-weight: bold;">HTML5 </span><span style="background-color: white;">is being developed in joint collaboration of the Web Hypertext Application Technology Working Group (WHATWG) and World Wide Web Consortium (W3C). As the development of HTML5 are still going on so it is not yet an official standard. No web browser supports all HTML5 elements yet, but popular web browsers like (Firefox, Chrome, Internet Explorer, Safari, Opera etc.) are adding more HTML5 tags support in their latest versions.</span></span></div>
<div style="background-color: white; border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
<span style="line-height: 24px;"><span style="font-family: inherit;">HTML5 and CSS3 have become popular tools that help in building a well-defined website. Each of them have many advanced features of their own but nowadays, they are used in combination with each other by expert web designers, to create refined web pages with semantic accuracy. Let us have a look at some advantages of HTML5 and CSS3.</span></span></div>
<div style="background-color: white; border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
<span style="font-family: inherit; line-height: 24px;"><b></b></span></div>
<div style="border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
</div>
<ul style="text-align: left;">
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
The first benefit you get is that the readable codes are semantically accurate. When a web design is not semantically accurate, it cannot attain a good rank. HTML5 and CSS3 help you to overcome this. The readable codes are very simple and easy to understand.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
The tutorials in the language help designers in developing a better web page. This paves way for the designers to make use of apt tools or elements in the language for a website.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Many websites need some extra plug-ins to view the videos in the web page. In case of HTML5 and CSS3, the audio and video effects are tagged and viewed without the support of third party plug-ins.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Using separate codes for the purpose of updations are important for all types of websites. These codes do not give a proper output at times. In HTML5 and CSS3, as the scripting is not necessary<br />
for validation you can avoid the usage of confusing complex codes.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Many browsers do not support all types of web pages but HTML5 and CSS3 help the designer to develop a web page that is compatible even with previous versions of your browsers.</div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Some elements in HTML5 and CSS3 allow you to handle graphics and photos efficiently. These elements use some procedural methodologies to draw up the graphics directly into the browser.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Flash applications are bound to cause problems. HTML5 combined with CSS3 provides you with many alternative features to support media. As CSS3 has enhanced itself with many features, there are many added elements that bring in the wow factor, when it is used with HTML5.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Creating Box Shadow requires numerous images and this process is made simple by using these new technologies. The text shadow is an element added to make the webpage more attractive. This can be carried out using the simple codes in CSS3. It makes the web layout very simple.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
One of the popular elements in web design is the use of rounded corners for buttons, layout elements, menus and much more. Using the ‘border-radius’ property, you can easily create rounded corners.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Many websites have contact forms, that help the clients get in touch with the company. Some forms may not be supported by browsers. There are many types of forms designed with HTML5 and CSS3 which have a unique design and are compatible with all the common browsers.<br />
<br /></div>
</span></li>
<li><span style="font-family: inherit;"><div style="border: 0px; display: inline !important; margin-bottom: 10px; padding: 0px; vertical-align: baseline;">
Using these technologies you can have full control over the colors in the templates, thereby eliminating the need to use separate codes for the color theme.</div>
</span></li>
</ul>
<div style="text-align: left;">
<b><span style="font-family: inherit;"><br /></span></b></div>
<div style="border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
<b><span style="font-family: inherit;"><br /></span></b></div>
<div style="border: 0px; margin-bottom: 10px; padding: 0px; text-align: left; vertical-align: baseline;">
<b><span style="font-family: inherit;"><br /></span></b></div>
<div style="text-align: left;">
<b><span style="font-family: inherit;"><br /></span></b></div>
<div style="background-color: white; color: rgb(35, 34, 62) !important; line-height: 24px;">
<b><br /></b></div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-47449431597341416742013-02-27T16:07:00.004+05:302013-02-27T16:37:47.342+05:30INTRODUCTION TO OBJECT ORIENTED JAVASCIRPT<div dir="ltr" style="text-align: left;" trbidi="on">
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
</style>
<![endif]-->
<br />
<div class="MsoNormal">
</div>
This article explains different ways you can create a custom
object using the JavaScript language. The JavaScript language includes several
built-in objects, such <span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">as <code><span style="font-family: "Calibri","sans-serif"; line-height: 115%; mso-ansi-font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Array</span></code>,
<code><span style="font-family: "Calibri","sans-serif"; line-height: 115%; mso-ansi-font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">String</span></code>, and <code><span style="font-family: "Calibri","sans-serif"; line-height: 115%; mso-ansi-font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Date</span></code> etc..</span>. But, if there
are custom functions that you want to create, you can create your own custom
objects using one of the available methods.<br />
<div class="MsoNormal">
Properties and methods are what make objects functional and
usable.</div>
<div class="MsoNormal">
The best way to understand the concept of an object is to
think of a real-life object.</div>
<div class="MsoNormal">
<span style="mso-spacerun: yes;"> </span>For example, use a
dog as your object. A dog can have properties such as <i style="mso-bidi-font-style: normal;">legs, ears, a tail, possibly a collar, and so on</i>. A dog can have
methods such <i style="mso-bidi-font-style: normal;">as barking, eating,
sleeping, and so on</i>. The methods can alter the properties of the dog. For
example, if the dog is barking, its ears may stand up, and if the dog is sleeping
its ears might be floppy .Imagine wanting to use a dog object in your project.
It can save a lot of time if you are interested in creating multiple dog
objects because they all have a lot of the same basic properties and methods.
And, if you want to use a dog object in another project, you can easily reuse
the object you already created.</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Following are the
different ways to create a custom object using the JavaScript language:</span></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">The Object function.</span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Literal notation.</span></li>
<li class="MsoNormal" style="line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Object constructor and
prototyping.</span></li>
</ul>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<a href="http://www.blogger.com/blogger.g?blogID=6079621863045441783" name="object-function"><span class="atitle"><u>The </u></span></a><span style="mso-bookmark: object-function;"><code><b style="mso-bidi-font-weight: normal;"><u><span style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Object</span></u></b></code><span class="atitle"><u> function</u></span></span><span class="atitle"></span></div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
The JavaScript language includes a function named <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Object</span></code>, which when used with the <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">new</span></code> operator creates an object. The <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Object</span></code> function is the starting point for any custom
functionality you want to achieve by creating an object.</div>
<div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<a href="http://www.blogger.com/blogger.g?blogID=6079621863045441783" name="listing1"><b><span style="font-family: "Calibri","sans-serif"; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;">1. Creating a custom object using the </span></b></a><span style="mso-bookmark: listing1;"><code><b><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Object</span></b></code><b><span style="font-family: "Calibri","sans-serif"; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;">
function</span></b></span><b><span style="font-family: "Calibri","sans-serif"; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;"></span></b></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">var
Gallery = new Object();</span></div>
<div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
To
make the <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Gallery</span></code> object helpful, you
can add properties and methods to give it functionality.</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<a href="http://www.blogger.com/blogger.g?blogID=6079621863045441783" name="listing2"><b><span style="font-family: "Calibri","sans-serif"; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;">2. A custom </span></b></a><span style="mso-bookmark: listing2;"><code><span style="font-size: 10.0pt; mso-bidi-font-weight: bold; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Gallery</span></code><b><span style="font-family: "Calibri","sans-serif"; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;"> object
with properties and methods</span></b></span><b><span style="font-family: "Calibri","sans-serif"; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-bidi; mso-hansi-theme-font: minor-latin;"></span></b></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<pre>var Gallery = new Object();</pre>
<pre> </pre>
<pre>/* </pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">The properties of the <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Gallery</span></code> object are <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">CurrentIndex</span></code>, <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Images</span></code>, and <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">_loopInterval</span></code>.</span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"> </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">To define them as properties of the <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Gallery</span></code> object, you simply assign them to the </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Gallery</span></code> object using dot syntax—append a dot and a variable name and then assign </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">that variable a value.</span> */</pre>
<pre> </pre>
<pre>window.onload= function()</pre>
<pre>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.Images = ['istockphoto_14149033.jpg', 'istockphoto_14232771.jpg', </pre>
<pre>'istockphoto_14667148.jpg'];</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.CurrentIndex = 0;</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery._loopInterval = setInterval(Gallery.Next, 2500);</pre>
<pre>};</pre>
<pre> </pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">/* <span style="mso-spacerun: yes;"> </span>The methods used are <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Next</span></code>, <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Prev</span></code>, and <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Display</span></code>. </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">To define them as methods of the <code><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Gallery</span></code> object, you use dot syntax and assign </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">each one its own function. </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">*/</span></pre>
<pre> </pre>
<pre>Gallery.Next = function()</pre>
<pre>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>if(Gallery.CurrentIndex < (Gallery.Images.length-1))</pre>
<pre><span style="mso-spacerun: yes;"> </span>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.CurrentIndex++;</pre>
<pre><span style="mso-spacerun: yes;"> </span>}</pre>
<pre><span style="mso-spacerun: yes;"> </span>else</pre>
<pre><span style="mso-spacerun: yes;"> </span>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.CurrentIndex = 0;</pre>
<pre><span style="mso-spacerun: yes;"> </span>}</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.Display();</pre>
<pre>};</pre>
<pre> </pre>
<pre>Gallery.Prev = function()</pre>
<pre>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>if(Gallery.CurrentIndex > 0)</pre>
<pre><span style="mso-spacerun: yes;"> </span>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.CurrentIndex--;</pre>
<pre><span style="mso-spacerun: yes;"> </span>}</pre>
<pre><span style="mso-spacerun: yes;"> </span>else</pre>
<pre><span style="mso-spacerun: yes;"> </span>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.CurrentIndex = (Gallery.Images.length-1);</pre>
<pre><span style="mso-spacerun: yes;"> </span>}</pre>
<pre><span style="mso-spacerun: yes;"> </span>Gallery.Display();</pre>
<pre>};</pre>
<pre> </pre>
<pre>Gallery.Display = function()</pre>
<pre>{</pre>
<pre><span style="mso-spacerun: yes;"> </span>var photoGallery = document.getElementById('photo-gallery');</pre>
<pre><span style="mso-spacerun: yes;"> </span>var currentImage = Gallery.Images[Gallery.CurrentIndex];</pre>
<pre><span style="mso-spacerun: yes;"> </span>photoGallery.src = "../assets/img/"+currentImage;</pre>
<pre>};</pre>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">/*
</span>Both the <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Next</span></code> and <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Prev</span></code> methods use the properties in this object. The <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">CurrentIndex</span></code> property identifies what the current
index of the <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Images</span></code> array is so that when
you increase or decrease the index it references a different array item. The <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Images</span></code> property is an array that stores the images
that you are displaying in the gallery. The <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">_loopInterval</span></code>
property automatically loops through the images in the gallery every 2.5
seconds. <span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">*/</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
To
call one of the methods in this object, such as the <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Next</span></code> method, you simply need to reference the <code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Gallery</span></code> object, followed by a dot, followed by the
name of the method (<code><span style="font-size: 10.0pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;">Next</span></code>), and, finally,
followed by opening and closing parentheses</div>
<pre> </pre>
<pre><a href="http://www.blogger.com/blogger.g?blogID=6079621863045441783" name="listing3"><b><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">3. Calling the </span></b></a><span style="mso-bookmark: listing3;"><code><b><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Next</span></b></code></span><span style="mso-bookmark: listing3;"><b><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"> method in the custom </span></b></span><span style="mso-bookmark: listing3;"><code><b><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Gallery</span></b></code></span><span style="mso-bookmark: listing3;"><b><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; font-weight: normal; mso-ascii-theme-font: minor-latin; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"> object</span></b></span><span style="mso-bookmark: listing3;"></span><b style="mso-bidi-font-weight: normal;"><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"></span></b></pre>
<pre> </pre>
<pre>Gallery.Next();</pre>
<pre> </pre>
<pre><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">To actually put this object into action, you can easily create controls that </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">navigate the images in your <code><span style="font-family: "Calibri","sans-serif"; mso-ansi-font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Images</span></code> array. First, you need to include the </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">JavaScript file, which in this case is an external file named Gallery.js.</span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"> Then you just need to add an HTML <code><span style="font-family: "Calibri","sans-serif"; mso-ansi-font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">img</span></code> tag that displays the images and add </span></pre>
<pre><span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">hyperlinks that control the next and previous navigation</span></pre>
<pre> </pre>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;">
<a href="http://www.blogger.com/blogger.g?blogID=6079621863045441783" name="listing4"><span style="mso-bidi-font-family: Calibri; mso-bidi-font-weight: bold; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">4. Sample HTML file with the custom Gallery object and Gallery functions</span></a><span style="mso-bookmark: listing4;"></span><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"></span></div>
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="mso-cellspacing: 0in; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184; width: 100%px;">
<tbody>
<tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0; mso-yfti-lastrow: yes;">
<td style="padding: 0in 0in 0in 0in;"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><html></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><head></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><title>Getting Started with Object-Oriented
JavaScript</title></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><script type="text/javascript"
src="js/Gallery.js"></script></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"></head></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><body></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><img
src="../assets/img/istockphoto_14149033.jpg"
id="photo-gallery" /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span><a
href="#" onclick="Gallery.Prev();">&lt;
Previous</a></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>&nbsp;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span><a
href="#" onclick="Gallery.Next();">Next
&gt;</a></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"></p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"></body></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"></html></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span class="atitle">To be continued …</span><span style="font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";"></span></div>
</td>
</tr>
</tbody></table>
<a name='more'></a></div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-75195768615024996212012-10-23T14:51:00.001+05:302012-10-23T14:52:15.655+05:30Difference between Application server and Web Server<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">What is Application Server and Web Server? Your search ends here .. </span><br />
<span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;"><br /></span>
<span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">apache, nginx, IIS are web servers</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">mongrel, webrick, phusion passenger are app servers</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><b style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">App server</b><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;"> is something which works with particular programming language and parses and executes the code</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">since mongrel and webrick can only work with rails, so they are app servers</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><b style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">Web servers</b><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;"> are servers which can take the request from the browser.</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">Web servers normally works on port 80 though we can change the port in configuration </span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">since mongrel and webrick can take that request directly, so they can be thought of as web servers but web servers do have a lot of other functionality like request pipeline, load balancing etc.</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">App servers lack these functionalities.</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">About Mongrel server:</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">mongrel work as web as well as app server if you are talking about dev environment</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">but in production, mongrel alone can not work it will be too slow</span><br style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;" /><span class="Apple-style-span" style="background-color: #fff9ee; color: #222222; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 21px;">so we need a web server in front of mongrel</span></div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-61574123796543433252012-10-23T14:47:00.000+05:302012-10-23T14:47:56.994+05:30Ruby On Rails Interview Preparation<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
1. Why Ruby on Rails?<br />
Ans: There are lot of advantages of using ruby on rails<br />
1. DRY Principal<br />
2. Convention over Configuration<br />
3. Gems and Plugins<br />
4. Scaffolding<br />
5. Pure OOP Concept<br />
6. Rest Support<br />
7. Rack support<br />
8. Action Mailer<br />
9. Rpc support<br />
10. Rexml Support<br />
11. etc..<br />
<br />
2. Explain about the programming language ruby?<br />
Ruby is the brain child of a Japanese programmer Matz. He created Ruby. It is a cross platform object oriented language. It helps you in knowing what your code does in your application. With legacy code it gives you the power of administration and organization tasks. Being open source, it did go into great lengths of development.<br />
3. Explain about ruby names?<br />
Classes, variables, methods, constants and modules can be referred by ruby names. When you want to distinguish between various names you can specify that by the first character of the name. Some of the names are used as reserve words which should not be used for any other purpose. A name can be lowercase letter, upper case letter, number, or an underscore, make sure that you follow the name by name characters.<br />
<br />
4. What is the Difference between Symbol and String?<br />
Ans: Symbol are same like string but both behaviors is different based on object_id, memory and process time (cpu time) Strings are mutable , Symbols are immutable.<br />
Mutable objects can be changed after assignment while immutable objects can only be overwritten. For example<br />
<br />
p "string object jak".object_id #=> 22956070<br />
p "string object jak".object_id #=> 22956030<br />
p "string object jak".object_id #=> 22956090<br />
<br />
p :symbol_object_jak.object_id #=> 247378<br />
p :symbol_object_jak.object_id #=> 247378<br />
p :symbol_object_jak.object_id #=> 247378<br />
<br />
p " string object jak ".to_sym.object_id #=> 247518<br />
p " string object jak ".to_sym.object_id #=> 247518<br />
p " string object jak ".to_sym.object_id #=> 247518<br />
<br />
p :symbol_object_jak.to_s.object_id #=> 22704460<br />
p :symbol_object_jak.to_s.object_id #=> 22687010<br />
p :symbol_object_jak.to_s.object_id #=> 21141310<br />
<br />
And also it will differ by process time<br />
<br />
For example:<br />
<br />
Testing two symbol values for equality (or non-equality) is faster than testing two string values for equality,<br />
<br />
Note : Each unique string value has an associated symbol<br />
<br />
<br />
5. What is Session and Cookies?<br />
Ans: Session: are used to store user information on the server side.<br />
cookies: are used to store information on the browser side or we can say client side<br />
Session : say session[:user] = âarunkumarâ it remains when the browser is not closed<br />
6. What is request.xhr?<br />
Ans: A request.xhr tells the controller that the new Ajax request has come, It always return Boolean values (TRUE or FALSE)<br />
7. What is MVC? and how it Works?<br />
Ans: MVC tends for Model-View-Controller, used by many languages like PHP, Perl, Python etc. The flow goes like this: Request first comes to the controller, controller finds and appropriate view and interacts with model, model interacts with your database and send the response to controller then controller based on the response give the output parameter to view, for Example your url is something like this:<br />
http://localhost:3000/users/new<br />
here users is your controller and new is your method, there must be a file in your views/users folder named new.html.erb, so once the submit button is pressed, User model or whatever defined in the rhtml form_for syntax, will be called and values will be stored into the database.<br />
<br />
8. What things we can define in the model?<br />
Ans: There are lot of things you can define in models few are:<br />
1. Validations (like validates_presence_of, numeracility_of, format_of etc.)<br />
2. Relationships(like has_one, has_many, HABTM etc.)<br />
3. Callbacks(like before_save, after_save, before_create etc.)<br />
4. Suppose you installed a plugin say validation_group, So you can also define validation_group settings in your model<br />
5. ROR Queries in Sql<br />
6. Active record Associations Relationship<br />
9. What is ORM in Rails?<br />
Ans: ORM tends for Object-Relationship-Model, it means that your Classes are mapped to table in the database, and Objects are directly mapped to the rows in the table.<br />
<br />
10. How many Types of Associations Relationships does a Model has?<br />
Ans: When you have more than one model in your rails application, you would need to create connection between those models. You can do this via associations. Active Record supports three types of associations:<br />
one-to-one : A one-to-one relationship exists when one item has exactly one of another item. For example, a person has exactly one birthday or a dog has exactly one owner.<br />
one-to-many : A one-to-many relationship exists when a single object can be a member of many other objects. For instance, one subject can have many books.<br />
many-to-many : A many-to-many relationship exists when the first object is related to one or more of a second object, and the second object is related to one or many of the first object.<br />
You indicate these associations by adding declarations to your models: has_one, has_many, belongs_to, and has_and_belongs_to_many.<br />
<br />
11. Difference between render and redirect?<br />
Ans:<br />
<br />
render example:<br />
render :partial<br />
render :new<br />
It will render the template new.rhtml without<br />
calling or redirecting to the new action.<br />
<br />
<br />
redirect example:<br />
redirect_to :controller => âusersâ, :action => ânewâ<br />
It forces the clients browser to request the<br />
new action.<br />
<br />
12. What is the Difference between Static and Dynamic Scaffolding?<br />
Ans: The Syntax of Static Scaffold is like this:<br />
ruby script/generate scaffold User Comment<br />
Where Comment is the model and User is your controller, So all n all static scaffold takes 2 parameter i.e your controller name and model name, whereas in dynamic scaffolding you have to define controller and model one by one.<br />
<br />
13. How you run your Rails Application without creating database ?<br />
Ans: You can run application by uncomment the line in environment.rb<br />
<br />
Path => rootpath conf/ environment.rb<br />
<br />
# Skip frameworks you're not going to use (only works if using vendor/rails)<br />
config.frameworks -= [ :action_web_service, :action_mailer,:active_record ]<br />
14. How to use sql db or mysql db. without defining it in the database.yml<br />
Ans: You can use ActiveRecord anywhere!<br />
<br />
require 'rubygems'<br />
<br />
require 'active_record'<br />
<br />
ActiveRecord::Base.establish_connection({<br />
<br />
:adapter => 'postgresql',<br />
<br />
:user => 'foo',<br />
<br />
:password => 'bar',<br />
<br />
:database => 'whatever'<br />
<br />
})<br />
<br />
class Task <><br />
<br />
set_table_tame "a_legacy_thingie"<br />
<br />
def utility_methods<br />
<br />
update_attribute(:title, "yep")<br />
<br />
end<br />
<br />
end<br />
<br />
Task.find(:first)<br />
<br />
Etcetera. Itâs ActiveRecord, you know what to do. Going wild:<br />
<br />
ActiveRecord::Base.establish_connection(:adapter => "sqlite3",<br />
<br />
:dbfile => ":memory:")<br />
<br />
ActiveRecord::Schema.define(:version => 1) do<br />
<br />
create_table :posts do |t|<br />
<br />
t.string :title<br />
<br />
t.text :excerpt, :body<br />
<br />
end<br />
<br />
end<br />
<br />
class Post <><br />
<br />
validates_presence_of :title<br />
<br />
end<br />
<br />
Post.create(:title => "A new post!")<br />
<br />
Post.create(:title => "Another post",<br />
<br />
:excerpt => "The excerpt is an excerpt.")<br />
<br />
puts Post.count<br />
<br />
15. What are helpers and how to use helpers in ROR?<br />
Ans: Helpers (âview helpersâ) are modules that provide methods which are automatically usable in your view. They provide shortcuts to commonly used display code and a way for you to keep the programming out of your views. The purpose of a helper is to simplify the view. Itâs best if the view file (RHTML/RXML) is short and sweet, so you can see the structure of the output.<br />
<br />
16. What is Active Record?<br />
Ans: Active Record are like Object Relational Mapping(ORM), where classes are mapped to table , objects are mapped to columns and object attributes are mapped to data in the table<br />
<br />
17. Ruby Support Single Inheritance/Multiple Inheritance or Both?<br />
Ans: Ruby Supports only Single Inheritance.<br />
You can achieve Multiple Inheritance through MIXIN concept means you achieve using module by including it with classes.<br />
18. How many types of callbacks available in ROR?<br />
Ans:<br />
<br />
(-) save<br />
(-) valid<br />
(1) before_validation<br />
(2) before_validation_on_create<br />
(-) validate<br />
(-) validate_on_create<br />
(3) after_validation<br />
(4) after_validation_on_create<br />
(5) before_save<br />
(6) before_create<br />
(-) create<br />
(7) after_create<br />
(8) after_save<br />
<br />
19. WHAT CAN RAILS MIGRATION DO?<br />
ANS:<br />
create_table(name, options)<br />
drop_table(name)<br />
rename_table(old_name, new_name)<br />
add_column(table_name, column_name, type, options)<br />
rename_column(table_name, column_name, new_column_name)<br />
change_column(table_name, column_name, type, options)<br />
remove_column(table_name, column_name)<br />
add_index(table_name, column_name, index_type)<br />
remove_index(table_name, column_name)<br />
Migrations support all the basic data types: string, text, integer, float, datetime, timestamp, time, date, binary and boolean:<br />
<br />
string - is for small data types such as a title.<br />
text - is for longer pieces of textual data, such as the description.<br />
integer - is for whole numbers.<br />
float - is for decimals.<br />
datetime and timestamp - store the date and time into a column.<br />
date and time - store either the date only or time only.<br />
binary - is for storing data such as images, audio, or movies.<br />
boolean - is for storing true or false values.<br />
Valid column options are:<br />
<br />
limit ( :limit => â50â )<br />
default (:default => âblahâ )<br />
null (:null => false implies NOT NULL)<br />
<br />
20. What is the naming conventions for methods that return a boolean result?<br />
Ans: Methods that return a boolean result are typically named with a ending question mark. For example: def active? return true #just always returning true end<br />
<br />
21. How do the following methods differ: @my_string.strip and @my_string.strip! ?<br />
Ans: The strip! method modifies the variable directly. Calling strip (without the !) returns a copy of the variable with the modifications, the original variable is not altered.<br />
22. What's the difference in scope for these two variables: @name and @@name?<br />
<br />
Ans: @name is an instance variable and @@name is a class variable<br />
<br />
23. What is the log that has to seen to check for an error in ruby rails?<br />
Ans: Rails will report errors from Apache in log/apache.log and errors from the Ruby code in log/development.log. If you're having a problem, do have a look at what these logs are saying. On Unix and Mac OS X you may run tail -f log/development.log in a separate terminal to monitor your application's execution.<br />
24. What is the use of global variable $ in Ruby?<br />
Ans: A class variable starts with an @@ sign which is immediately followed by upper or lower case letter. You can also put some name characters after the letters which stand to be a pure optional. A class variable can be shared among all the objects of a class. A single copy of a class variable exists for each and every given class.<br />
To write a global variable you start the variable with a $ sign which should be followed by a name character. Ruby defines a number of global variables which also include other punctuation characters such as $_ and $-k.<br />
For example: If you declare one variable as global we can access any where, where as class variable visibility only in the classà Example<br />
class Test<br />
def h<br />
à $a = 5<br />
à @b = 4<br />
Ã<br />
while $a > 0<br />
puts $a<br />
$a= $a - 1<br />
end<br />
end<br />
end<br />
test = Test.new<br />
test.h<br />
puts $aà à à à à à à à à à à à à à à à à à à à # 5<br />
puts @bà à à à à à à à à à à à à à à à à à à #nil<br />
<br />
25. Where does the start_tabnav gets informations for tabs rendering in ruby rail?<br />
Ans: The main Symbol let the start_tabnav method know to look for a special MainTabnav class where all the magic happens<br />
<br />
26. What is the Install rail package?<br />
Ans: There are several packages that you can download and install. The prebuilt Rails installer called Install rail which currently is only for Windows<br />
27. What is the log that has to seen to check for an error in ruby rails?<br />
Ans: Rails will report errors from Apache in log/apache.log and errors from the Ruby code in log/development.log. If you're having a problem, do have a look at what these logs are saying. On Unix and Mac OS X you may run tail -f log/development.log in a separate terminal to monitor your application's execution.<br />
<br />
28. What is the use of super in ruby rails?<br />
Ans: Ruby uses the super keyword to call the superclass (Parent class) implementation of the current method<br />
<br />
29. What is the difference between nil and false in ruby?<br />
Ans: False is a boolean datatype, Nil is not a data type it have object_id 4<br />
<br />
30. How is class methods defined in Ruby?<br />
Ans: A:def self.methodname<br />
--------<br />
--------<br />
end<br />
or<br />
def classname.methodname<br />
--------<br />
--------<br />
end<br />
<br />
31. How is object methods defined in Ruby?<br />
Ans:<br />
class jak<br />
def method1<br />
--------<br />
--------<br />
end<br />
end<br />
<br />
obj=jak.new<br />
It is single object<br />
def obj.object_method_one<br />
--------<br />
--------<br />
end<br />
obj.Send(object_method_every)<br />
It will be created every for every object creation<br />
<br />
32. What are the priority of operators available in Ruby ?<br />
Ans: Something that used in an expression to manipulate objects such as + (plus), - (minus), * (multiply), and / (divide). You can also use operators to do comparisons,such as with <, >, and &&. The priority is based on "BODMAS"<br />
<br />
33. What are the looping structures available in Ruby?<br />
Ans: for..in<br />
untill..end<br />
while..end<br />
do..end<br />
Note: You can also use each to iterate a array as loop not exactly like loop<br />
34. What are the object-oriented programming features supported by Ruby and how multiple inheritance supported in ?<br />
Ans: Classes,Objects,Inheritance,Singleton methods,polymorphism(accomplished by over riding and overloading) are some oo concepts supported by ruby. Multiple inheritance supported using Mixin concept.<br />
35. What is the scope of a local variable in Ruby and define it scope ?<br />
Ans: A new scope for a local variable is introduced in the toplevel, a class (module) definition, a method defintion. In a procedure block a new scope is introduced but you can access to a local variable outside the block.<br />
The scope in a block is special because a local variable should be localized in Thread and Proc objects.<br />
36. How is an enumerator iterator handled in Ruby?<br />
Ans: Iterator is handled using keyword 'each' in ruby.<br />
For example<br />
number=[1,2,3]<br />
then we can use iterator as<br />
number.each do |i|<br />
puts i<br />
end<br />
Above prints the values of an array $no which is accomplished using iterator.<br />
37. How is visibility of methods changed in Ruby (Encapsulation)?<br />
Ans: By applying the access modifier : Public , Private and Protected access Modifier<br />
<br />
38. What is the use of load,require, auto_load,require_relative in Ruby?<br />
Ans: A method that loads and processes the Ruby code from a separate file, including whatever classes, modules, methods, and constants are in that file into the current scope. load is similar, but rather than performing the inclusion operation once, it reprocesses the code every time load is called.<br />
auto_load - Whenever the interpreter call the method that time only it will initiate the method in hat file.<br />
require_relative - It it to load local folder files.<br />
<br />
More Questions:<br />
1. Explain choose_weighted method with example<br />
2. What is GIL in ruby ?<br />
3. Is variable is a object ?<br />
Ans : Variable is not an object<br />
4. List of protocols supported by ruby ?<br />
5. Explain Virtual attribute ?<br />
6. How to validate and modify attribute value ?<br />
7. How to serialize data with YAML ?<br />
</div>
Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-78276221751767358302012-08-09T17:18:00.002+05:302012-08-09T17:22:33.367+05:30Test Driven Development (TDD) in Ruby on Rails<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 style="font-family: Times,"Times New Roman",serif; margin: 12pt 0in 12pt 0.3in; page-break-before: always;">
<u><span lang="EN-GB" style="font-size: 18.0pt;">Introduction</span></u><u><span lang="EN-GB" style="font-size: 18.0pt;"></span></u></h1>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in;">
<span lang="EN-IN" style="font-size: 12.0pt; mso-ansi-language: EN-IN; mso-fareast-font-family: Calibri;">The purpose of this document is to describe
the working principle of Ruby on Rails test frameworks, its application,
advantages and disadvantages.</span><span lang="EN-IN" style="font-size: 10.0pt;"> </span><span style="font-size: 12.0pt;">This document contains an introduction
to Test driven development (TDD).</span></div>
<div class="template" style="font-family: Times,"Times New Roman",serif; margin-left: 0.25in;">
<br /></div>
<div class="template" style="font-family: Times,"Times New Roman",serif;">
<b style="mso-bidi-font-weight: normal;"><u><span lang="EN-IN" style="font-size: 14.0pt; font-style: normal; mso-ansi-language: EN-IN; mso-fareast-font-family: Calibri;">Test <span style="mso-spacerun: yes;"> </span>Driven Development (TDD)</span></u></b></div>
<div class="template" style="font-family: Times,"Times New Roman",serif; margin-left: 0.25in;">
<br /></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in;">
<i style="mso-bidi-font-style: normal;"><span lang="EN-IN" style="font-size: 12.0pt; mso-ansi-language: EN-IN; mso-fareast-font-family: Calibri;"><span style="mso-spacerun: yes;"> </span><span style="mso-tab-count: 1;"> </span></span></i><span style="font-size: 12.0pt;">Test Driven
Development is a development practice which involves writing test cases before
writing the code. Start by writing a very small test for code that does not yet
exist. Run the test and, naturally, it fails. Now we have to write the code to
pass the test.ie, writing code only for the requirement. Large numbers of tests
help to limit the number of defects in the code. The early and frequent nature
of the testing helps to catch defects early in the development cycle, preventing
them from becoming endemic and expensive problems.</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in;">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 14.0pt;">TDD
in Ruby on Rails</span></u></b></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal;">
<span style="font-size: 12.0pt;"><span style="mso-spacerun: yes;"> </span>Ruby on rails supports test
frameworks for Test Driven Development;<span style="color: #202020;"> A<span class="apple-converted-space"> </span><b>Test Framework</b><span class="apple-converted-space"> </span>is a tool or library that provides a
backdrop for writing tests.</span></span>
<span style="font-size: 12.0pt;">This
is an excellent way to build up a test suite that exercises every part of the application.</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 20.25pt; margin: 0in 12pt 12pt;">
<span style="color: #202020; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">There are several testing frameworks in use for Ruby today:</span></div>
<ul style="font-family: Times,"Times New Roman",serif;" type="disc">
<li class="MsoNormal" style="color: #202020; line-height: 18.0pt; margin-bottom: 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Test::Unit</span><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"> is
included with Ruby 1.8, and follows the "xUnit" conventions</span></li>
<li class="MsoNormal" style="color: #202020; line-height: 18.0pt; margin-bottom: 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Minitest</span><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"> is
included with Ruby 1.9, and allows both xUnit and RSpec style tests</span></li>
<li class="MsoNormal" style="color: #202020; line-height: 18.0pt; margin-bottom: 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">RSpec</span><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">,
which<span style="mso-spacerun: yes;"> </span>has more concise syntax and
can be used in the same project, but creates a separate suite of tests,
called "specs"</span></li>
<li class="MsoNormal" style="color: #202020; line-height: 18.0pt; margin-bottom: 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">In </span><span style="color: black; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Cucumber</span><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">,
tests are written not in Ruby but in a language designed for tests</span></li>
<li class="MsoNormal" style="color: #202020; line-height: 18.0pt; margin-bottom: 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Rspec-2, which is used with Rails -3. Since We are
using Rails -3 Rspec -2 is the best option we can use for test driven
development</span></li>
</ul>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt; margin-left: 0.25in;">
<span style="background: white; color: black; font-size: 12.0pt;">For using this, we have
to twist thinking a little bit. Our goal is not to write eventual production
code right away , but our goal is to make our test cases pass. </span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt; margin-left: 0.25in;">
<b style="mso-bidi-font-weight: normal;"><u><span style="background: white; color: black; font-size: 14.0pt;">Work Flow Structure</span></u></b></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt; margin-left: 0.25in;">
<span style="background: white; color: black; font-size: 12.0pt;">We can structure the test
driven workflow as follows:</span></div>
<ul style="font-family: Times,"Times New Roman",serif;" type="disc">
<li class="MsoNormal" style="line-height: 150%; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">First write a test</span></b><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">: This test describes the behavior of a small element
of your system.</span>
<span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">Tests in TDD are called
programmer tests. When writing the tests it should be kept in mind that
the tests should concentrate on testing the true behaviors, i.e. if a
system has to handle multiple inputs, the tests should reflect multiple
inputs.</span></li>
<li class="MsoNormal" style="line-height: 150%; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">Run the test: </span></b><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>The test
definitely fails because you have not yet built the code for that part of
your system. This important step tests your test case, verifying that your
test case fails.</span>
<span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">The automatic tests should be
run after each change of the application code in order to assure that the
changes have not introduced errors to the previous version of the code</span></li>
<li class="MsoNormal" style="line-height: 150%; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">Write Code:</span></b><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";"> Then only real coding comes<b style="mso-bidi-font-weight: normal;">, </b>write enough code to make the test pass.</span> <span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">In TDD, the code writing is
actually a process for making the test work, i.e. writing the code that passes
the test.</span></li>
<li class="MsoNormal" style="line-height: 150%; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">Run the test:</span></b><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";"> Again run the test and verify that they pass.</span></li>
</ul>
<div class="MsoListParagraph" style="font-family: Times,"Times New Roman",serif; line-height: 150%; text-indent: -0.25in;">
<span style="font-size: 10.0pt; line-height: 150%; mso-bidi-font-family: Symbol; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><b style="mso-bidi-font-weight: normal;">Refactor
the code</b> - Refactoring is a process of improving the internal structure by
editing the existing working code, without changing its external behavior. The
idea of refactoring is to carry out the modifications as a series of small
steps without introducing new defects into to the system</div>
<ul style="font-family: Times,"Times New Roman",serif;" type="disc">
<li class="MsoNormal" style="line-height: 150%; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";">Run all tests: </span></b><span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>To verify that
the refactoring did not change the external behavior.</span></li>
</ul>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 150%;">
<span style="font-size: 12.0pt; line-height: 150%; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>See the Structure below: </span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; margin-left: 0.5in;">
<span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman"; mso-no-proof: yes;"><img height="446" src="file:///C:%5CUsers%5CEXPCOK01%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_image002.gif" width="413" /></span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif;">
<span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;">
</span>The first step involves simply writing a piece of code that tests the
desired functionality. The second one is required to validate that the test is
correct, i.e. the test must not pass at this point, because the behavior under
implementation must not exist as yet. Nonetheless, if the test passes, the test
is either not testing the correct behavior or the TDD principles have not been
followed. The third step is the writing of the code. However, it should be kept
in mind to only write as little code as possible to pass the. Next, all tests
must be run in order to see that the change has not introduced any problems somewhere
else in the system. Once all tests pass, the internal structure of the code
should be improved by refactoring.</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt; margin-left: 0.25in;">
<br /></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt; margin-left: 0.25in;">
<b style="mso-bidi-font-weight: normal;"><u><span style="background: white; color: black; font-size: 14.0pt;">Rspec2</span></u></b></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt; margin-left: 0.25in;">
<span style="color: black; font-size: 12.0pt;">RSpec is a great tool in the behavior
driven design process of writing human readable specifications that direct and
validate the development of your application. What follows are some guidelines
taken from the literature, online resources, and from our experience. </span>Rspec is not a tool for
Integration Testing but for Unit Testing, if you want to set up integration
tests, then you should use <b>Cucumber.</b> Cucumber is designed to
easy Behavior Driven Development but even if you don't BDD it is perfect for
integration testing.</div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt; margin-left: 0.25in;">
<b style="mso-bidi-font-weight: normal;"><u><span style="background: white; color: black; font-size: 14.0pt;">Examples <span style="mso-spacerun: yes;"> </span>For
Rspec-2<span style="mso-spacerun: yes;"> </span>Test case</span></u></b></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; margin: 0in 0in 0in 0.25in; text-align: left;">
<span style="color: black; font-size: small; line-height: 115%;">We can integrate Rspec to Ruby On Rails by installing the Rspec2 gem.</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0in 0.25in; text-align: left;">
<span style="font-size: small;"> gem install
rspec-rails</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0in 0.25in; text-align: left;">
<span style="font-size: small;"><br /></span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0in 0.25in; text-align: left;">
<span style="font-size: small;">For this
example, we’ll describe and develop the beginnings of a User class, which can
be assigned any number of roles. Start by creating a directory for the files
for this tutorial.</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in; text-align: left;">
<span style="font-size: small;"> </span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in; text-align: left;">
<span style="font-size: small;"> *
mkdir rspec_example</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in; text-align: left;">
<span style="font-size: small;"> *
cd rspec_example</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in; text-align: left;">
<span style="font-size: small;"><br /></span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; margin: 0in 0in 0in 0.25in; text-align: left;">
<span style="color: #661a33; font-size: small; line-height: 115%;"> </span><span style="font-size: small;">The first methods we’ll encounter
are ` d</span><span style="font-size: small;"><code><span style="line-height: 115%;">escribe`</span></code></span><span style="font-size: small;">
and `</span><span style="font-size: small;"><code><span style="line-height: 115%;">it`</span></code></span><span style="font-size: small;">.</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; margin: 0in 0in 0in 0.25in; text-align: left;">
<span style="font-size: small;">Create a file in this
directory named user_spec.rb and type
the following:</span></div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<div style="margin-left: 0.25in;">
<br /></div>
<div style="margin-left: 0.5in;">
<span style="font-size: small;"><code>describe User do</code></span></div>
<div style="margin-left: 0.5in;">
<span style="font-size: small;"><code>end</code></span></div>
<div style="margin-left: 0.25in;">
<br /></div>
<div style="margin-left: 0.25in;">
<span style="font-size: small;">The <code>describe</code> method creates an instance of <code>Behavior</code>. So “describe User” is really saying “describe the behaviour of the User class”</span><span style="font-size: small;">.<code></code></span></div>
</div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left; text-indent: 0.25in;">
<span lang="EN-IN" style="font-size: small;">Run the following command:</span></div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<span style="font-size: small;"> * <code>rspec spec/</code> user_spec.rb</span><br />
<br />
<div style="margin-left: 0.25in;">
<span style="font-size: small;"> The r<code>spec</code> command gets installed when you install the rspec-rails gem. It supports a large number of command line options.</span></div>
</div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<span lang="EN-IN" style="font-size: small;"> Running </span><span style="font-size: small;"><code><span lang="EN-IN">user_spec.rb</span></code></span><span lang="EN-IN" style="font-size: small;"> should have resulted in output that includes the following error:</span></div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<span style="font-size: small;"> <span style="color: red;">./user_spec.rb:1: uninitialized constant User (NameError)</span></span><br />
<span style="color: red; font-size: small;"> </span><br />
<span style="font-size: small;">We haven’t even written a single line of production code and already Rspec2 is telling us what code we need to write. We need to create a User class to resolve this error, </span><br />
<br />
<br />
<br />
<span style="font-size: small;"> so create user.rb with the following:</span><br />
<br />
<span style="font-size: small;"><code> class User</code></span><br />
<span style="font-size: small;"><code> end</code></span></div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<span style="font-size: small;"> </span><span lang="EN-IN" style="font-size: small;">And require it in
user_spec.rb:</span></div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<span style="font-size: small;"><code>require 'user'</code></span><br />
<div style="margin-left: 0.5in;">
<br /></div>
<span style="font-size: small;"><code>describe User do</code></span><br />
<span style="font-size: small;"><code>end</code></span><br />
<br />
<span style="font-size: small;">Now run the r<code>spec</code> command again, will get a result like this</span><br />
<span style="font-size: small;"> </span><br />
<span style="color: #76923c; font-size: small;">Finished in 6.0e-06 seconds</span><br />
<span style="color: #76923c; font-size: small;">0 examples, 0 failures</span></div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<span lang="EN-IN" style="font-size: small;">The output shows that we have no examples yet, so let’s add
one. We’ll start by describing the intent of example without any code.</span></div>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<span style="font-size: small;"><code>describe User do</code></span><br />
<span style="font-size: small;"><code> it "should be in any roles assigned to it" do</code></span><br />
<span style="font-size: small;"><code> end</code></span><br />
<span style="font-size: small;"><code>end</code></span><br />
<br />
<span style="color: black; font-size: small;">Run the spec, but this time adds the --format option:</span><br />
<br />
<span style="color: black; font-size: small;">$ rspec spec/user_spec.rb --format doc</span><br />
<br />
<span style="color: #76923c; font-size: small;">User - should be in any roles assigned to it</span><br />
<span style="color: #76923c; font-size: small;">Finished in 0.022865 seconds</span><br />
<span style="color: #76923c; font-size: small;">1 example, 0 failures</span><br />
<br />
<span style="color: black; font-size: small;">Now add a Ruby statement that begins to express the described intent.</span><br />
<br />
<span style="color: black; font-size: small;">describe User do</span><br />
<span style="color: black; font-size: small;"> it "should be in any roles assigned to it" do</span><br />
<span style="color: black; font-size: small;"> user.should be_in_role ("assigned role")</span><br />
<span style="color: black; font-size: small;"> end</span><br />
<span style="color: black; font-size: small;">end</span><br />
<br />
<span style="color: black; font-size: small;">… and run the spec command.</span><br />
<br />
<span style="color: black; font-size: small;">$ rspec spec/user_spec.rb --format specdoc</span><br />
<br />
<span style="color: #c00000; font-size: small;">User - should be in any roles assigned to it (ERROR - 1)</span><br />
<br />
<span style="color: #c00000; font-size: small;">1) NameError in 'User should be in any roles assigned to it' undefined local variable or method `user' for #<#<Class:0x14ed15c>:0x14ecdd8> ./user_spec.rb:6:</span><br />
<br />
<span style="color: #c00000; font-size: small;">Finished in 0.017956 seconds</span><br />
<br />
<span style="color: #c00000; font-size: small;">1 example, 1 failure</span><br />
<br />
<span style="font-size: small;">The output tells us that there is an error that no <code>user has been defined</code>, so the next step is to make one:</span><br />
<br />
<span style="font-size: small;">describe User do</span><br />
<span style="font-size: small;"> it "should be in any roles assigned to it" do</span><br />
<span style="font-size: small;"> user = User.new</span><br />
<span style="font-size: small;"> user.should be_in_role ("assigned role")</span><br />
<span style="font-size: small;"> end</span><br />
<span style="font-size: small;">end</span><br />
<br />
<span style="font-size: small;">Run the spec command,</span><br />
<span style="font-size: small;">$ rspec spec/user_spec.rb --format specdoc</span><br />
<br />
<span style="color: #c00000; font-size: small;">User - should be in any roles assigned to it (ERROR - 1)</span><br />
<span style="color: #c00000; font-size: small;">1) NoMethodError in 'User should be in any roles assigned to it' undefined method `in_role?' for #<User:0x14ec8ec> ./user_spec.rb:7:</span><br />
<span style="color: #c00000; font-size: small;">Finished in 0.020779 seconds</span><br />
<span style="color: #c00000; font-size: small;">1 example, 1 failure</span><br />
<br />
<span style="font-size: small;">Now we learn that User does not respond to in_role?, so we add that to User:</span><br />
<br />
<span style="font-size: small;">class User</span><br />
<span style="font-size: small;"> def in_role?(role)</span><br />
<span style="font-size: small;"> end</span><br />
<br />
<span style="font-size: small;">$ rspec spec/user_spec.rb --format specdoc</span><br />
<br />
<span style="color: #c00000; font-size: small;">User - should be in any roles assigned to it (FAILED - 1)</span><br />
<span style="color: #c00000; font-size: small;">1) 'User should be in any roles assigned to it' FAILED expected in_role?("assigned role") to return true, </span><br />
<span style="color: #c00000; font-size: small;">got nil ./user_spec.rb:7:</span><br />
<span style="color: #c00000; font-size: small;">Finished in 0.0172110000000001 seconds</span><br />
<span style="color: #c00000; font-size: small;">1 example, 1 failure</span><br />
<br />
<span style="font-size: small;">We now have a failing example, which is the first goal. We always want to see a meaningful failure before </span><br />
<span style="font-size: small;">success because that’s the only way we can be sure the success is the result of writing code in the right place in the system.</span><br />
<br />
<span style="font-size: small;">To get this to pass, we do the simplest thing that could possibly work:</span><br />
<span style="font-size: small;">Edit user.rb </span><br />
<br />
<span style="font-size: small;">class User</span><br />
<span style="font-size: small;"> def in_role?(role)</span><br />
<span style="font-size: small;"> true</span><br />
<span style="font-size: small;"> end</span><br />
<br />
<br />
<span style="font-size: small;">$ rspec spec/user_spec.rb --format specdoc</span><br />
<br />
<span style="color: #76923c; font-size: small;">User - should be in any roles assigned to it</span><br />
<span style="color: #76923c; font-size: small;">Finished in 0.018173 seconds</span><br />
<span style="color: #76923c; font-size: small;">1 example, 0 failures</span><br />
<br />
<span style="font-size: small;">That passes, but we’re not done yet. Take a look again at the example:</span><br />
<br />
<span style="font-size: small;">describe User do</span><br />
<span style="font-size: small;"> it "should be in any roles assigned to it" do</span><br />
<span style="font-size: small;"> user = User.new</span><br />
<span style="font-size: small;"> user.should be_in_role("assigned role")</span><br />
<span style="font-size: small;"> end</span><br />
<span style="font-size: small;">end</span><br />
<br />
<span style="font-size: small;">The description says that the User “should be in any roles assigned to it”, but we haven’t assigned any roles to</span><br />
<span style="font-size: small;"> it. Let’s add that assignment to the example:</span><br />
<br />
<span style="font-size: small;">describe User do</span><br />
<span style="font-size: small;"> it "should be in any roles assigned to it" do</span><br />
<span style="font-size: small;"> user = User.new</span><br />
<span style="font-size: small;"> user.assign_role("assigned role")</span><br />
<span style="font-size: small;"> user.should be_in_role("assigned role")</span><br />
<span style="font-size: small;"> end</span><br />
<span style="font-size: small;">end</span><br />
<br />
<span style="font-size: small;">$ rspec spec/user_spec.rb --format specdoc</span><br />
<br />
<span style="color: #c00000; font-size: small;">User - should be in any roles assigned to it (ERROR - 1)</span><br />
<span style="color: #c00000; font-size: small;">1) NoMethodError in 'User should be in any roles assigned to it' undefined method `assign_role' for</span><br />
<span style="color: #c00000; font-size: small;"> #<User:0x14ec784> ./user_spec.rb:6:</span><br />
<span style="color: #c00000; font-size: small;">Finished in 0.018564 seconds</span><br />
<span style="color: #c00000; font-size: small;">1 example, 1 failure</span><br />
<br />
<span style="font-size: small;">Following the advice in the output, we now add the assign_role method to User.</span><br />
<br />
<span style="font-size: small;">class User</span><br />
<span style="font-size: small;"> def in_role?(role)</span><br />
<span style="font-size: small;"> true</span><br />
<span style="font-size: small;"> end</span><br />
<br />
<span style="font-size: small;"> def assign_role(role) </span><br />
<span style="font-size: small;"> end</span><br />
<span style="font-size: small;"> end</span><br />
<br />
<span style="font-size: small;">$ rspec spec/user_spec.rb --format specdoc</span><br />
<br />
<span style="color: #76923c; font-size: small;">User - should be in any roles assigned to it</span><br />
<span style="color: #76923c; font-size: small;">Finished in 0.018998 seconds</span><br />
<span style="color: #76923c; font-size: small;">1 example, 0 failures</span></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0in 0.25in; text-align: left;">
<br /></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in;">
<br /></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; margin-bottom: 0in;">
<b style="mso-bidi-font-weight: normal;"><u><span style="color: black; font-size: 14.0pt; line-height: 115%; mso-themecolor: text1;">Advantages :</span></u></b></div>
<ul style="font-family: Times,"Times New Roman",serif; margin-top: 0in;" type="disc">
<li class="MsoNormal" style="background: white; color: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-list: l1 level1 lfo3; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Testing
improves your designs</span></b><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">:
Each target object that you test must have at least two clients: your
production code, and your test case. These clients force you to decouple
your code</span></li>
<li class="MsoNormal" style="background: white; color: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-list: l1 level1 lfo3; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Testing
reduces unnecessary code</span></b><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">:
When you write your test cases first, you get in the habit of writing only
enough code to make the test case pass. You reduce the temptation to code
features because you might need them later.</span></li>
</ul>
<div class="MsoNormal" style="background: none repeat scroll 0% 0% white; font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in;">
<br /></div>
<ul style="font-family: Times,"Times New Roman",serif; margin-top: 0in;" type="disc">
<li class="MsoNormal" style="background: white; color: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-list: l1 level1 lfo3; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Simple
Development Procedure: </span></b><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>Each test case that you write establishes
a small problem. Solving that problem with code is rewarding. </span></li>
</ul>
<div class="MsoNormal" style="background: none repeat scroll 0% 0% white; font-family: Times,"Times New Roman",serif; line-height: normal; margin-bottom: 0in;">
<br /></div>
<ul style="font-family: Times,"Times New Roman",serif; margin-top: 0in;" type="disc">
<li class="MsoNormal" style="background: white; color: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-list: l1 level1 lfo3; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Testing
allows more freedom</span></b><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">: <span style="mso-spacerun: yes;"> </span>If you have test cases that will catch
likely errors, you'll find that you're more willing to make improvements
to your code.</span></li>
</ul>
<div class="MsoListParagraph" style="font-family: Times,"Times New Roman",serif;">
<br /></div>
<ul style="font-family: Times,"Times New Roman",serif; margin-top: 0in;" type="disc">
<li class="MsoNormal" style="background: white; color: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-list: l1 level1 lfo3; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Efficient
Product: </span></b><span style="font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">If we can generate test cases
for all the possible scenarios, then the result will be highly efficient,
well documented product.</span><span style="background: white; font-size: 10.0pt;"> </span><span style="background: white; font-size: 12.0pt;">TDD can lead to more modularized, flexible, and extensible code.</span></li>
</ul>
<div class="MsoListParagraph" style="font-family: Times,"Times New Roman",serif;">
<br /></div>
<ul style="font-family: Times,"Times New Roman",serif; margin-top: 0in;" type="disc">
<li class="MsoNormal" style="background: white; color: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-list: l1 level1 lfo3; mso-themecolor: text1; tab-stops: list .5in;"><b style="mso-bidi-font-weight: normal;"><span style="background: white; font-size: 12.0pt;">Documentation:</span></b><span style="background: white; font-size: 12.0pt;"> After using this technique it
satisfies a bunch of requirements, also have documentation, describing the
behavior of the system, and a good start at a test suite. Each test case
backs up a fundamental requirement in the system </span></li>
</ul>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Times,"Times New Roman",serif; line-height: 18pt; margin-bottom: 7.5pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="background: white; color: black; font-size: 14.0pt;">Disadvantages :</span></u></b></div>
<ul style="font-family: Times,"Times New Roman",serif;" type="disc">
<li class="MsoNormal" style="mso-list: l3 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b><span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";">Big time investment.</span></b><span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";"> For the simple case we lose about 20+% of the actual implementation,
but for complicated cases you lose much more.</span> Also more code to write. <span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";">We have to create test
cases<span style="mso-spacerun: yes;"> </span>for models,<span style="mso-spacerun: yes;"> </span>controllers<span style="mso-spacerun: yes;"> </span>and<span style="mso-spacerun: yes;">
</span>views ,which consumes a lot of time</span></li>
<li class="MsoNormal" style="mso-list: l3 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b><span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";">Additional Complexity.</span></b><span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";"> For complex cases test cases
are harder to calculate.</span></li>
<li class="MsoNormal" style="mso-list: l3 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span><b>Design
Impacts.</b> Sometimes the design is not clear at the start and evolves as
we go along - this will force us to redo the test which will generate a
big time lose</span></li>
<li class="MsoNormal" style="mso-list: l3 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><b><span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";">Continuous Tweaking.</span></b><span style="font-size: 12.0pt; line-height: 115%; mso-fareast-font-family: "Times New Roman";"> For data structures and black box algorithms unit
tests would be perfect, but for algorithms that tend to be changed,
tweaked or fine tuned, this can cause a big time investment that one might
claim is not justified. </span></li>
</ul>
<div style="font-family: Times,"Times New Roman",serif; text-align: left;">
<br /></div>
</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com1tag:blogger.com,1999:blog-6079621863045441783.post-41506552942481040202012-04-23T15:39:00.003+05:302012-04-23T15:40:45.704+05:30Who is already on Rails<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-size-adjust: none; font-stretch: normal; font: 18px/25px georgia; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span style="font-family: Times, "Times New Roman", serif;">Tens of thousands of Rails applications are already live. People are using Rails in the tiniest part-time operations to the biggest companies.</span></span><br />
<br />
<span style="color: #333333; font-family: Times;">You know your Favourite Social Networking Website, <a href="http://www.twitter.com/">www.twitter.com</a> , using ROR...</span><br />
<br />
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-size-adjust: none; font-stretch: normal; font: 18px/25px georgia; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><br />
<span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-size-adjust: none; font-stretch: normal; font: 18px/25px georgia; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><table border="0" class="productgrid" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; letter-spacing: normal; margin: 0px auto; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><tbody>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.basecamphq.com/?source=rails" style="color: black; text-decoration: underline;"><img alt="Basecamp" height="110" src="http://rubyonrails.org/images/applications/basecamp.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.basecamphq.com/?source=rails" style="color: #336699; text-decoration: underline;">Basecamp</a>: The original Rails app.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.twitter.com/" style="color: black; text-decoration: underline;"><img alt="Twitter" height="110" src="http://rubyonrails.org/images/applications/twitter.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.twitter.com/" style="color: #336699; text-decoration: underline;">Twitter</a>: Stay connected.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.shopify.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/shopify.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.shopify.com/" style="color: #336699; text-decoration: underline;">Shopify</a>: E-commerce made easy.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.yellowpages.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/yellowpages.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.yellowpages.com/" style="color: #336699; text-decoration: underline;">Yellow Pages</a>: Find it locally.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.github.com/" style="color: black; text-decoration: underline;"><img alt="Github" height="110" src="http://rubyonrails.org/images/applications/github.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.github.com/" style="color: #336699; text-decoration: underline;">Github</a>: Git repo hosting.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.livingsocial.com/" style="color: black; text-decoration: underline;"><img alt="Lighthouse" height="110" src="http://rubyonrails.org/images/applications/livingsocial.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.livingsocial.com/" style="color: #336699; text-decoration: underline;">Livingsocial</a>: Online local commerce.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://sortfolio.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/sortfolio.png" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://sortfolio.com/" style="color: #336699; text-decoration: underline;">Sortfolio</a>: Find a web designer.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.hulu.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/hulu.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.hulu.com/" style="color: #336699; text-decoration: underline;">Hulu</a>: Stream TV & Movies.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.groupon.com/" style="color: black; text-decoration: underline;"><img alt="Groupon" height="110" src="http://rubyonrails.org/images/applications/groupon.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.groupon.com/" style="color: #336699; text-decoration: underline;">Groupon</a>: Daily deals.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.geni.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/geni.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.geni.com/" style="color: #336699; text-decoration: underline;">Geni</a>: Find your ancestors.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.backpackit.com/?source=rails" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/backpack.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.backpackit.com/?source=rails" style="color: #336699; text-decoration: underline;">Backpack</a>: Personal organization.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.ravelry.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/ravelry.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.ravelry.com/" style="color: #336699; text-decoration: underline;">Ravelry</a>: Knitting community.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.43things.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/43things.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.43things.com/" style="color: #336699; text-decoration: underline;">43things</a>: Your goals in life.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.justin.tv/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/justintv.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.justin.tv/" style="color: #336699; text-decoration: underline;">Justin TV</a>: Live video.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.scribd.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/scribd.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.scribd.com/" style="color: #336699; text-decoration: underline;">Scribd</a>: Books, presentations, more.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.ilike.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/ilike.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.ilike.com/" style="color: #336699; text-decoration: underline;">iLike</a>: Find more music.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.streeteasy.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/streeteasy.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.streeteasy.com/" style="color: #336699; text-decoration: underline;">Streeteasy</a>: Find a place in NYC.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.chow.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/chow.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.chow.com/" style="color: #336699; text-decoration: underline;">Chow</a>: Food, drink, fun.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://getharvest.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/harvest.png" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://getharvest.com/" style="color: #336699; text-decoration: underline;">Harvest</a>: Tracking time since '06.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://home.inklingmarkets.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/inklingmarkets.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://home.inklingmarkets.com/" style="color: #336699; text-decoration: underline;">Inkling Markets</a>: Trade the future.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.alistapart.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/ala.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.alistapart.com/" style="color: #336699; text-decoration: underline;">A List Apart</a>: 'zine for web devs.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.revolutionhealth.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/revolutionhealth.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.revolutionhealth.com/" style="color: #336699; text-decoration: underline;">Revolution Health</a>: Get healthy.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.newyorkjets.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/newyorkjets.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.newyorkjets.com/" style="color: #336699; text-decoration: underline;">New York Jets</a>: Play ball!</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.mingle2.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/mingle2.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.mingle2.com/" style="color: #336699; text-decoration: underline;">Mingle2</a>: Get a date.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.vitalsource.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/vitalsource.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.vitalsource.com/betterbooks/" style="color: #336699; text-decoration: underline;">VitalSource</a>: Shopping for books.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.blinksale.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/blinksale.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.blinksale.com/" style="color: #336699; text-decoration: underline;">Blinksale</a>: Easy online invoicing.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.cookpad.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/cookpad.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.cookpad.com/" style="color: #336699; text-decoration: underline;">Cookpad</a>: Japanese dishes.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.blurb.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/blurb.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.blurb.com/" style="color: #336699; text-decoration: underline;">Blurb</a>: Print your own book.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.tobi.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/tobi.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.tobi.com/" style="color: #336699; text-decoration: underline;">Tobi</a>: 1-1 shopping.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.spock.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/spock.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.spock.com/" style="color: #336699; text-decoration: underline;">Spock</a>: Search for people.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.lumosity.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/lumosity.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.lumosity.com/" style="color: #336699; text-decoration: underline;">Lumosity</a>: Train your brain.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.lacoctelera.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/lacoctelera.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.lacoctelera.com/" style="color: #336699; text-decoration: underline;">Lacoctelera</a>: Spanish blogs.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.a-better-tomorrow.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/abt.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.a-better-tomorrow.com/" style="color: #336699; text-decoration: underline;">A Better Tomorrow</a>: T to the shirt.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.urbanbaby.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/urbanbaby.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.urbanbaby.com/" style="color: #336699; text-decoration: underline;">Urban Baby</a>: Hey junior!</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.metrotwin.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/metrotwin.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.metrotwin.com/" style="color: #336699; text-decoration: underline;">Metrotwin</a>: London meets NY.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://mix.oracle.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/oraclemix.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://mix.oracle.com/" style="color: #336699; text-decoration: underline;">Oracle Mix</a>: Shape the DB.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.43places.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/43places.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.43places.com/" style="color: #336699; text-decoration: underline;">43places</a>: Go somewhere.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.iconbuffet.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/iconbuffet.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.iconbuffet.com/" style="color: #336699; text-decoration: underline;">Iconbuffet</a>: Shop royalty-free icons.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.highrisehq.com/?source=rails" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/highrise.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.highrisehq.com/?source=rails" style="color: #336699; text-decoration: underline;">Highrise</a>: Prepare for business.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.getsatisfaction.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/getsatisfaction.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.getsatisfaction.com/" style="color: #336699; text-decoration: underline;">Get Satisfaction</a>: Customer service.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.penny-arcade.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/pennyarcade.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.penny-arcade.com/" style="color: #336699; text-decoration: underline;">Penny Arcade</a>: Comics for gamers.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.tadalist.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/tadalist.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.tadalist.com/" style="color: #336699; text-decoration: underline;">Tadalist</a>: Share simple todo lists.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.blingee.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/blingee.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.blingee.com/" style="color: #336699; text-decoration: underline;">Blingee</a>: Fun photos.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.bleacherreport.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/bleacherreport.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.bleacherreport.com/" style="color: #336699; text-decoration: underline;">Bleacher Report</a>: Keep score.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.43people.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/43people.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.43people.com/" style="color: #336699; text-decoration: underline;">43people</a>: Meet someone.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.funnyordie.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/funnyordie.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.funnyordie.com/" style="color: #336699; text-decoration: underline;">Funny or Die</a>: LOL!</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.campfirenow.com/?source=rails" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/campfire.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.campfirenow.com/?source=rails" style="color: #336699; text-decoration: underline;">Campfire</a>: Group chat.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.insiderpages.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/insiderpages.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.insiderpages.com/" style="color: #336699; text-decoration: underline;">Insider Pages</a>: Find local businesses.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.zendesk.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/zendesk.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.zendesk.com/" style="color: #336699; text-decoration: underline;">Zendesk</a>: Customer support</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.odeo.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/odeo.gif" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.odeo.com/" style="color: #336699; text-decoration: underline;">Odeo</a>: Find. Play. Enjoy.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://seekingalpha.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/seekingalpha.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://seekingalpha.com/" style="color: #336699; text-decoration: underline;">Seeking Alpha</a>: Stock market site.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.pragprog.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/pragmaticbookshelf.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.pragprog.com/" style="color: #336699; text-decoration: underline;">Pragmatic Bookshelf</a>: Learn more.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.soundcloud.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/soundcloud.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.soundcloud.com/" style="color: #336699; text-decoration: underline;">Soundcloud</a>: Move music.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.iseekgolf.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/iseekgolf.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.iseekgolf.com/" style="color: #336699; text-decoration: underline;">iseekgolf</a>: AU's #1 golf site.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.xing.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/xingmarketplace.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.xing.com/" style="color: #336699; text-decoration: underline;">Xing Marketplace</a>: Reach pros.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.ruby-lang.org/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/rubylang.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.ruby-lang.org/" style="color: #336699; text-decoration: underline;">Ruby Programming Language</a>.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.letsfreckle.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/freckle.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.letsfreckle.com/" style="color: #336699; text-decoration: underline;">Freckle</a>: Time tracking.</div>
</td></tr>
<tr><td style="text-align: left;"><a class="no_link_hover" href="http://www.qype.co.uk/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/qype.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.qype.co.uk/" style="color: #336699; text-decoration: underline;">Qype</a>: Guide to the UK.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.moviepilot.de/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/moviepilot.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.moviepilot.de/" style="color: #336699; text-decoration: underline;">Moviepilot</a>: German movie DB.</div>
</td><td style="text-align: left;"><a class="no_link_hover" href="http://www.susestudio.com/" style="color: black; text-decoration: underline;"><img height="110" src="http://rubyonrails.org/images/applications/susestudio.jpg" style="border-image: initial; border: 1px solid rgb(204, 204, 204); margin: 0px 10px 5px 0px; padding: 1px;" width="175" /></a><br />
<div style="font-family: verdana; font-size: 10px; font-weight: normal; line-height: 14px; margin-bottom: 25px; margin-top: 0px; text-align: left;">
<a href="http://www.susestudio.com/" style="color: #336699; text-decoration: underline;">SUSE Studio</a>: Build your distro.</div>
</td></tr>
</tbody></table>
<br />
<br />
Lots of others ....Now You can think of switcing to ROR...rt?..</span></div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-18971349927643720122012-04-23T14:37:00.007+05:302012-04-23T14:37:56.853+05:30PHP migrates to Git<div dir="ltr" style="text-align: left;" trbidi="on">
The migration of the PHP source code from Subversion to Git is complete. You can clone or fork the source from our <a href="https://github.com/php/php-src"><span style="color: #000099;">GitHub mirror</span></a>, and we also now support pull requests made via GitHub. The source is also available via <a href="http://git.php.net/"><span style="color: #000099;">git.php.net</span></a>, and full instructions on cloning the php-src tree can be found at <a href="http://php.net/git"><span style="color: #000099;">php.net/git</span></a>. <br />
<br />
One immediate benefit is that future PHP release tags will be signed by the PHP development team. We will be releasing GPG keys for verification purposes in the next few days. <br />
More information on the migration and the new workflow can be found at the <a href="https://wiki.php.net/vcs/gitfaq"><span style="color: #000099;">Moving to Git FAQ</span></a> on the PHP Wiki. <br />
<br />
<br />
[Courtesy : <a href="http://www.php.net/archive/2012.php#id2012-03-20-1">http://www.php.net/archive/2012.php#id2012-03-20-1</a>]<br />
<hr />
</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-49183227116529194802012-04-20T15:40:00.002+05:302012-04-20T15:41:30.155+05:30Yiinfinite-Scroll<div dir="ltr" style="text-align: left;" trbidi="on">
This extension uses the infinite scroll jQuery plugin, from
http://www.infinite-scroll.com/ to create an infinite scrolling
pagination, like in twitter. This kind of pagination is also called
Endless Scroll.<br />
<br />
<br />
You want to See the code <a href="http://www.davialexandre.com.br/demos/yiinfinite_scroll" target="_blank">Lets go</a> ....</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-69268643121304482662012-04-20T14:52:00.001+05:302012-04-20T14:53:11.128+05:30Some Excellent Jquery Plugins Links . . . .<div dir="ltr" style="text-align: left;" trbidi="on">
Hey , just go through the amazing world of Jquery ..<br />
<br />
<a href="http://www.dyve.net/jquery/?googlemaps">http://www.dyve.net/jquery/?googlemaps</a><br />
<br />
<a href="http://marcgrabanski.com/article/jquery-google-maps-tutorial-basics">http://marcgrabanski.com/article/jquery-google-maps-tutorial-basics</a><br />
<br />
<a href="http://gmap3.net/">http://gmap3.net/</a><br />
<br />
<a href="http://demos.webia.info/map_demo_revised/map.html">http://demos.webia.info/map_demo_revised/map.html</a>#<br />
<br /><a href="http://gmap.nurtext.de/examples.html">http://gmap.nurtext.de/examples.html</a><br />
<br /><a href="http://www.vijayjoshi.org/2010/01/19/how-to-dynamically-load-the-google-maps-javascript-api-on-demand-loading/">http://www.vijayjoshi.org/2010/01/19/how-to-dynamically-load-the-google-maps-javascript-api-on-demand-loading/</a><br />
<br />
<a href="http://www.smashinglabs.pl/gmap/examples">http://www.smashinglabs.pl/gmap/examples</a><br />
<br /><a href="http://www.yiiframework.com/extension/gmapmultiplot/">http://www.yiiframework.com/extension/gmapmultiplot/</a></div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-15633203363133926012012-04-20T10:43:00.000+05:302012-04-20T15:41:54.508+05:30Megabytes, Gigabytes, Terabytes... What Are They?<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="left">
These terms are usually used in the world of computing to describe disk space, or data storage space, and system memory. For instance, just a few years ago we were describing hard drive space using the term Megabytes. Today, Gigabytes is the most common term being used to describe the size of a hard drive. In the not so distant future, Terabyte will be a common term. But what are they? This is where it gets quite confusing because there are at least three accepted definitions of each term.</div>
<br />
<div align="left">
According to the IBM Dictionary of computing, when used to describe disk storage capacity, a megabyte is 1,000,000 bytes in decimal notation. But when the term megabyte is used for real and virtual storage, and channel volume, 2 to the 20th power or 1,048,576 bytes is the appropriate notation. According to the Microsoft Press Computer Dictionary, a megabyte means either 1,000,000 bytes or 1,048,576 bytes. According to Eric S. Raymond in The New Hacker's Dictionary, a megabyte is always 1,048,576 bytes on the argument that bytes should naturally be computed in powers of two. So which definition do most people conform to? </div>
<br />
<div align="left">
When referring to a megabyte for disk storage, the hard drive manufacturers use the standard that a megabyte is 1,000,000 bytes. This means that when you buy an 80 Gigabyte Hard drive you will get a total of 80,000,000,000 bytes of available storage. This is where it gets confusing because Windows uses the 1,048,576 byte rule so when you look at the Windows drive properties an 80 Gigabyte drive will report a capacity of 74.56 Gigabytes and a 250 Gigabyte drive will only yield 232 Gigabytes of available storage space. Anybody confused yet? With three accepted definitions, there will always be some confusion so I will try to simplify the definitions a little. </div>
<br />
<div align="left">
The 1000 can be replaced with 1024 and still be correct using the other acceptable standards. Both of these standards are correct depending on what type of storage you are referring.</div>
<br />
<table style="height: 199px; width: 499px;"><tbody>
<tr> <td height="15" scope="row"><h3>
<span class="style12"><strong>Processor or Virtual Storage</strong></span></h3>
</td> <td><h3>
<span class="style12"><strong>Disk Storage</strong></span></h3>
</td> </tr>
<tr> <td height="176" scope="row" width="223"><div align="left">
· 1 Bit = Binary Digit<br />
· 8 Bits = 1 Byte<br />
· 1024 Bytes = 1 Kilobyte <br />
· 1024 Kilobytes = 1 Megabyte <br />
· 1024 Megabytes = 1 Gigabyte <br />
· 1024 Gigabytes = 1 Terabyte <br />
· 1024 Terabytes = 1 Petabyte <br />
· 1024 Petabytes = 1 Exabyte<br />
· 1024 Exabytes = 1 Zettabyte <br />
· 1024 Zettabytes = 1 Yottabyte <br />
· 1024 Yottabytes = 1 Brontobyte<br />
· 1024 Brontobytes = 1 Geopbyte </div>
</td> <td width="264">· 1 Bit = Binary Digit<br />
· 8 Bits = 1 Byte<br />
· 1000 Bytes = 1 Kilobyte <br />
· 1000 Kilobytes = 1 Megabyte <br />
· 1000 Megabytes = 1 Gigabyte <br />
· 1000 Gigabytes = 1 Terabyte <br />
· 1000 Terabytes = 1 Petabyte <br />
· 1000 Petabytes = 1 Exabyte<br />
· 1000 Exabytes = 1 Zettabyte <br />
· 1000 Zettabytes = 1 Yottabyte <br />
· 1000 Yottabytes = 1 Brontobyte<br />
· 1000 Brontobytes = 1 Geopbyte </td></tr>
</tbody></table>
</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-71667526917869801192012-04-11T11:09:00.002+05:302012-04-11T11:09:24.668+05:30OOPS - What Is a Class?<div dir="ltr" style="text-align: left;" trbidi="on">
Simply a class is a <span style="color: #3d85c6;"><em><strong>blue print</strong></em></span> from which individual <a href="http://teamphp.blogspot.in/2012/04/oops-what-is-object.html" target="_blank">objects</a> are created.<br />
<br />
In the real world, you'll often find many individual <a href="http://teamphp.blogspot.in/2012/04/oops-what-is-object.html" target="_blank">objects</a> all of the same kind. There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. A class is the blueprint from which individual objects are created.<br />
<br />
Its better if you can refer to an example right, take a look <br />
<br /><span style="color: #3d85c6;">class Bicycle {</span><br />
<span style="color: #3d85c6;"> int cadence = 0;<br /> int speed = 0;<br /> int gear = 1;</span><br />
<span style="color: #3d85c6;"> void changeCadence(int newValue) {<br /> cadence = newValue;<br /> }</span><br />
<span style="color: #3d85c6;"> void changeGear(int newValue) {<br /> gear = newValue;<br /> }</span><br />
<span style="color: #3d85c6;"> void speedUp(int increment) {<br /> speed = speed + increment; <br /> }</span><br />
<span style="color: #3d85c6;"> void applyBrakes(int decrement) {<br /> speed = speed - decrement;<br /> }</span><br />
<span style="color: #3d85c6;"> void printStates() {<br /> System.out.println("cadence:" +<br /> cadence + " speed:" + <br /> speed + " gear:" + gear);<br /> }<br />}</span><br />
<br />The fields cadence, speed, and gear represent the object's state, and the methods (changeCadence, changeGear, speedUp etc.) define its interaction with the outside world.<br />
<br />
A class can contain any of the following variable types.<br />
<br />
<span style="color: #351c75;">Local variables</span> . variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and the variable will be destroyed when the method has completed.<br />
<br />
<span style="color: #351c75;">Instance variables</span> . Instance variables are variables within a class but outside any method. These variables are instantiated when the class is loaded. Instance variables can be accessed from inside any method, constructor or blocks of that particular class.<br />
<br />
<span style="color: #351c75;">Class variables</span> . Class variables are variables declared with in a class, outside any method, with the static keyword.<br />
<br />
Now take a look at how we can create an instance of this class ie an <span id="goog_375625810"></span>Obj<span id="goog_375625806"></span><a href="http://www.blogger.com/"></a><span id="goog_375625807"></span>ect<span id="goog_375625811"></span><br />
<br />
<span style="color: #0b5394;">class BicycleDemo {</span><br />
<br /><span style="color: #0b5394;"> public static void main(String[] args) {</span><br />
<span style="color: #0b5394;"> // Create two different Bicycle objects</span><br />
<span style="color: #0b5394;"> Bicycle bike1 = new Bicycle();<br /> Bicycle bike2 = new Bicycle();</span><br />
<span style="color: #0b5394;"> // Invoke methods on those objects</span><br />
<span style="color: #0b5394;"> bike1.changeCadence(50);<br /> bike1.speedUp(10); </span><br />
<span style="color: #0b5394;"> }<br /> <br /> }</span><br />
<br />Now you have an idea of 'what is a class', 'how to create a class', 'how to create instance of a class'...<br />
Long way to go...be confident with basics....Now its time to focus on basics...</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-12071188693260012212012-04-11T10:47:00.003+05:302012-04-11T10:47:55.473+05:30OOPS - What Is an Object?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="color: #444444;"><span style="font-family: Times, "Times New Roman", serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">An <strong>object</strong> is an instance of a Class. The relationship is such that many objects can be created using one <strong>class</strong>. Each object has its own data but its underlying structure (i.e., the type of data it stores, its behaviors) are defined by the class</span></span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="color: #444444;"><span style="font-family: Times, "Times New Roman", serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Objects are key to understanding object-oriented technology. Look around right now and you'll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.</span></span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="color: #444444;"><span style="font-family: Times, "Times New Roman", serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Real-world objects share two characteristics: They all have state and behavior. Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.</span></span></span></div>
<span style="color: #444444;"><span style="font-family: Times, "Times New Roman", serif;"><span style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><div style="text-align: left;">
<br />Hey, Just take a minute right now to observe the real-world objects around you. For each object that you see, ask yourself two questions: "What possible states can this object be in?" and "What possible behavior can this object perform?". </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Now write down your observations. As you do, you'll notice that real-world objects vary in complexity; </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
your desktop lamp may have only two possible states (on and off) and two possible behaviors (turn on, turn off), but your desktop radio might have additional states (on, off, current volume, current station) and behavior (turn on, turn off, increase volume, decrease volume, seek, scan, and tune).</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
You may also notice that some objects, in turn, will also contain other objects. These real-world observations all translate into the world of object-oriented programming</div>
</span><div style="text-align: left;">
</div>
</span><div style="text-align: left;">
</div>
</span><div style="text-align: left;">
</div>
<div style="text-align: left;">
<br /></div>
</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-67655158877534390222012-04-10T15:33:00.001+05:302012-04-10T15:33:18.849+05:30NetBeans IDE Keyboard Shortcuts<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh00RQZQuuvgN9ET2F_iZPJl8syFTEgj5QDneoMrhb50z3dlSw1-gcscHOHY6j726z5v-oMy0IDn3yOKnQR02BA1MeHy16EqxwkHym8pG6wCPXotir3nVuj1dYM5iexcnduxIjuZ3M66Tc/s1600/Netbeans.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="444" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh00RQZQuuvgN9ET2F_iZPJl8syFTEgj5QDneoMrhb50z3dlSw1-gcscHOHY6j726z5v-oMy0IDn3yOKnQR02BA1MeHy16EqxwkHym8pG6wCPXotir3nVuj1dYM5iexcnduxIjuZ3M66Tc/s640/Netbeans.png" width="640" /></a></div>
</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-91348800314669896362012-04-10T15:23:00.005+05:302012-04-10T15:23:57.654+05:30How AWS Product Advertising API works<div dir="ltr" style="text-align: left;" trbidi="on">
1. The application uses the Product Advertising API to supply item descriptions and images,<br /> and customer and seller reviews, which you present to your customers.<br />
<br />
2. Customers shop on the web site.<br />
<br />
3. When the customer is ready to purchase the items in their e-commerce shopping cart, the<br />Application sends an HTML form to Product Advertising API and Amazon completes the<br />purchase by getting purchase information, such as payment method and shipping address,<br />And then Amazon fulfills the order by shipping the items.<br />
<br />
The Product Advertising API allows developers to advertise products from all Amazon sites.<br />
<br />
To become a Product Advertising API developer, sign up at the page for your locale:<br />Eg: For US <a href="https://affiliate-program.amazon.com/gp/flex/advertising/api/sign-in.html">https://affiliate-program.amazon.com/gp/flex/advertising/api/sign-in.html</a><br />
<br />
To become an Associate, go to the Amazon Associates main page for your locale:<br />Eg: For US <a href="https://affiliate-program.amazon.com/">https://affiliate-program.amazon.com/</a><br />
<br />
Once you have registered as an Amazon Associate, you will need a key pair, consisting of an access<br />Key ID and a secret key.<br />
For that go to <a href="https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html">https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html</a><br />
<br />
<strong>Product Advertising API :</strong><br />
• Requests and responses occur across the Internet<br />
• Client and server use REST, SOAP, or XML as the means of communication<br />
• Client and server agree on the grammar and syntax used in the requests and responses by specifying a WSDL.<br />
• Requests and responses are not tied to a single operating system or programming language.<br />The web servers carry out their service by finding the item descriptions and then sending those back to the requester.<br />
All Product Advertising API requests are based on REST or SOAP and all of the responses are based on XML.<br />
<br />
<strong>Functionality :</strong><br />
<br />
Functionality includes:<br />
<br />
• Finding items to buy. These items are for sale by Amazon or other merchants.<br />
• Finding information about those items. This item information includes such things as the titles of tracks on a CD, the rating of a movie, the kind of metal used in a piece of jewelry, accessories that go with an item, the author of a book, or the composer of a piece of music.<br />
• Getting customer reviews of items. Show customers what others think about the items on sale.<br />
• Create a fully-functional shopping cart. Add items that are immediately available or ones that will become available in the future, such as in a pre-sale of a book.<br />
• Adding, removing, and otherwise modifying the items in the shopping cart. Have full control over the contents of their shopping cart.<br />
• Getting information about the company selling the item. Show customers what others think about the merchant selling the item.<br />
• Finding similar items for sale. Generate additional sales by suggesting other items similar to the ones the customers are buying.<br />
• Purchasing the items in the shopping cart. Once the customer decides to buy the contents in their shopping cart, Amazon takes care of the shipping, payment, and order fulfillment, or notifies you to take care of the same.<br />
• Find items on a friend's wish list, wedding registry or baby registry and purchase those items.<br />Product Advertising API offers you the tools to create a complete, rich online shopping experience for customers.</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-20513306355256692542012-04-10T15:19:00.000+05:302012-04-10T15:19:22.009+05:30Amazon’s web services (AWS)<div dir="ltr" style="text-align: left;" trbidi="on">
Amazon’s web services (AWS) are cost-effective, dependable, flexible, comprehensive services that provides high-end infrastructure of Web service platform on cloud.<br />
<br />
Amazon.com provides an API named as Amazon Product Advertising API through which we can fetch information regarding Amazon.com products and show them on our site. The site owner can also get the benefit of a referral fees upto 15% of the product's selling price for every purchase of Amazon.com products done via our website.<br />
You need to create a Product Advertising API account at <a href="https://affiliateprogram.amazon.com/gp/flex/advertising/api/sign-in.html">https://affiliateprogram.amazon.com/gp/flex/advertising/api/sign-in.html</a> to use Amazon.com API facility.<br />
<br />
After creating an account you will get an api key and a secret key associated with your account which you will need to use while fetching records from Amazon.com.<br />
<br />
To only list Amazon.com products on your site will need the API key, the Secret Key and below mentioned signature key but if you wish to get referral fees for referrals then you need to be part of the Amazon associates program.<br />
You can create an account for associates program at <a href="https://affiliate-program.amazon.com/">https://affiliate-program.amazon.com/</a>. <br />
<br />After creating an account you will get an associate tag.<br />
<br /> For authentication we need to generate a signature key for every request to Amazon.com. In PHP, we can generate signature by using sha256 and hmac. The PHP code for generating signature key can be accessed at <a href="http://www.a2sdeveloper.com/page-rest-authentication-for-php4.html">http://www.a2sdeveloper.com/page-rest-authentication-for-php4.html</a><br />
<br /> Amazon provides products for a number of categories like Books, DVD, Music etc. To get results from all categories a category named all can be used</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-10321723866691999912012-04-10T15:13:00.002+05:302012-04-10T15:13:50.530+05:30Test Driven Development (TDD) in ROR(Ruby On Rails)<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "Calibri","sans-serif"; font-size: 12pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><strong>Test Driven Development</strong> is a development
practice which involves writing test cases before writing the code. Start by
writing a very small test for code that does not yet exist. Run the test and,
naturally, it fails. Now we have to write the code to pass the test.ie, writing
code only for the requirement. Large numbers of tests help to limit the number
of defects in the code. The early and frequent nature of the testing helps to
catch defects early in the development cycle, preventing them from becoming
endemic and expensive problems.</span><br />
<br />
<span style="font-family: "Calibri","sans-serif"; font-size: 12pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><span style="font-family: Times New Roman;">
</span><span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-spacerun: yes;"></span> <strong>Ruby on rails</strong> supports test
frameworks for Test Driven Development;<span style="color: #202020;"> A<span class="apple-converted-space"> </span><strong><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Test Framework</span></strong><span class="apple-converted-space"> </span>is
a tool or library that provides a backdrop for writing tests.</span></span> <span style="font-size: 12pt;">This is an excellent way to build up a test suite that
exercises every part of the application.</span></span><br />
<br />
<span style="font-family: Times New Roman;">
</span>
<span style="color: #202020; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">There are several testing
frameworks in use for Ruby today:<o:p></o:p></span></span><br />
<span style="font-family: Calibri;"><span style="color: black; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Test::Unit</span><span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"> is
included with Ruby 1.8, and follows the "xUnit" conventions<o:p></o:p></span></span><br />
<ul type="disc">
<li class="MsoNormal" style="color: #202020; line-height: 18pt; margin: 0in 0in 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: Calibri;"><span style="color: black; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Minitest</span><span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"> is
included with Ruby 1.9, and allows both xUnit and RSpec style tests<o:p></o:p></span></span></li>
<li class="MsoNormal" style="color: #202020; line-height: 18pt; margin: 0in 0in 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: Calibri;"><span style="color: black; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">RSpec</span><span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">, which<span style="mso-spacerun: yes;"> </span>has more concise syntax and can be used
in the same project, but creates a separate suite of tests, called
"specs"<o:p></o:p></span></span></li>
<li class="MsoNormal" style="color: #202020; line-height: 18pt; margin: 0in 0in 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: Calibri;"><span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">In </span><span style="color: black; font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Cucumber</span><span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">, tests are
written not in Ruby but in a language designed for tests<o:p></o:p></span></span></li>
<li class="MsoNormal" style="color: #202020; line-height: 18pt; margin: 0in 0in 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;">Rspec-2,
which is used with Rails -3. </span></span></li>
</ul>
<div class="MsoNormal" style="color: #202020; line-height: 18pt; margin: 0in 0in 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;">
<span style="font-size: 12pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="font-family: Calibri;"><strong><u>Work Flow</u></strong></span></span></div>
<ul type="disc"><span style="color: black;">
</span>
<li class="MsoNormal" style="line-height: 150%; margin: 0in 0in 10pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black;"><span style="font-family: Calibri;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">First write a test</span></b><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">: This test
describes the behavior of a small element of your system.</span><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"> </span><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Tests in TDD
are called programmer tests. When writing the tests it should be kept in
mind that the tests should concentrate on testing the true behaviors, i.e.
if a system has to handle multiple inputs, the tests should reflect
multiple inputs.<o:p></o:p></span></span></span></li>
<span style="color: black;">
</span>
<li class="MsoNormal" style="line-height: 150%; margin: 0in 0in 10pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black;"><span style="font-family: Calibri;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Run the test: </span></b><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>The test definitely fails because you
have not yet built the code for that part of your system. This important
step tests your test case, verifying that your test case fails.</span> <span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">The
automatic tests should be run after each change of the application code in
order to assure that the changes have not introduced errors to the
previous version of the code<o:p></o:p></span></span></span></li>
<span style="color: black;">
</span>
<li class="MsoNormal" style="line-height: 150%; margin: 0in 0in 10pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black;"><span style="font-family: Calibri;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Write Code:</span></b><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"> Then only
real coding comes<b style="mso-bidi-font-weight: normal;">, </b>write enough
code to make the test pass.</span> <span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">In TDD, the code writing is
actually a process for making the test work, i.e. writing the code that passes
the test.<o:p></o:p></span></span></span></li>
<span style="color: black;">
</span>
<li class="MsoNormal" style="line-height: 150%; margin: 0in 0in 10pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="color: black;"><span style="font-family: Calibri;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Run the test:</span></b><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"> Again run
the test and verify that they pass.<o:p></o:p></span></span></span></li>
<span style="color: black;">
</span></ul>
<div class="MsoListParagraph" style="line-height: 150%; margin: 0in 0in 0pt 0.5in; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;">
<span style="color: black;"><span style="font-family: Symbol; font-size: 10pt; line-height: 150%; mso-bidi-font-family: Symbol; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";">
</span></span></span><b style="mso-bidi-font-weight: normal;"><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Refactor the
code</span></b><span style="font-family: "Calibri","sans-serif"; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">
- Refactoring is a process of improving the internal structure by editing the
existing working code, without changing its external behavior. The idea of
refactoring is to carry out the modifications as a series of small steps
without introducing new defects into to the system</span></span></div>
<ul type="disc"><span style="color: black;">
</span>
<li class="MsoNormal" style="line-height: 150%; margin: 0in 0in 10pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: Calibri;"><span style="color: black;"><b style="mso-bidi-font-weight: normal;"><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Run all tests: </span></b><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>To verify that the refactoring did not
change the external behavior.</span></span></span></li>
</ul>
<div class="MsoNormal" style="line-height: 150%; margin: 0in 0in 10pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;">
<span style="font-family: Calibri;"><span style="color: black;"><span style="font-size: 12pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: "Times New Roman";">Hope Now you Had some Idea abt TDD...<o:p></o:p></span></span></span></div>
<ul type="disc"><span style="color: black;">
</span></ul>
<div class="MsoNormal" style="color: #202020; line-height: 18pt; margin: 0in 0in 7.5pt; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in;">
<span style="color: black;">
</span></div>
<ul type="disc">
</ul>
</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com1tag:blogger.com,1999:blog-6079621863045441783.post-5915901375629539112012-04-10T14:58:00.002+05:302012-04-10T14:59:50.903+05:30Java - 12 Important Interview Questions<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"><strong>1 : What
is an abstract class?</strong></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span><span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>
</strong>Abstract class must be extended/subclassed
(to be useful). It serves as a template.
A class that is abstract may not be instantiated
(ie, you may not call its constructor),
abstract class may contain static data.
Any class with an abstract method is automatically
abstract itself, and must be declared as
such.<br />
A class may be declared abstract even if
it has no abstract methods. This prevents
it from being instantiated<br />
</span></span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>2 :</strong>
<strong>What
is the difference between an Interface
and an Abstract class? </strong></span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
An
abstract class can have instance methods
that implement a default behavior.
An Interface
can only declare constants and
instance
methods, but cannot implement
default behavior and all methods are implicitly abstract. An interface
has all public members and no implementation. An abstract class is a
class which may have the usual flavors of class members (private,
protected, etc.), but has some abstract methods.</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"><strong>3 : What
is the purpose of garbage collection in
Java, and when is it used?</strong></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">The
purpose of garbage collection is to identify
and discard objects that are no longer needed
by a program so that their resources can
be reclaimed and reused. A Java object is
subject to garbage collection when it becomes
unreachable to the program in which it is
used.</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>4 :</strong> <strong>Describe
synchronization in respect to multithreading.</strong></span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">With
respect to multithreading, synchronization
is the capability to control the access
of multiple threads to shared resources.
Without synchonization, it is possible for
one thread to modify a shared variable while
another thread is in the process of using
or updating same shared variable. This usually
leads to significant errors.</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span></div>
<div style="text-align: left;">
<strong><span style="font-family: Times, "Times New Roman", serif; font-size: large;">5 : What
are pass by reference and passby value?</span></strong></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
Pass By Reference means the
passing the address itself rather than passing
the value. Passby Value means passing a
copy of the value to be passed. </span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span></div>
<div style="text-align: left;">
<strong><span style="font-family: Times, "Times New Roman", serif; font-size: large;">6 : What
is HashMap and Map?</span></strong></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
Map
is Interface and Hashmap is class that implements
that.</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>7 :</strong>
<b>Difference between Vector and ArrayList?</b></span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
Vector
is synchronized whereas arraylist is not.</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>8 :</strong>
<b>Difference
between Swing and Awt?<a href="" name="q9"></a></b></span></span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">AWT
are heavy-weight componenets. Swings are
light-weight components. Hence swing works
faster than AWT.</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>9 :</strong>
<strong>What
is the difference between a constructor
and a method? </strong></span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span><span style="font-family: Times, "Times New Roman", serif; font-size: large;">A
constructor is a member function of a class
that is used to create objects of that class.
It has the same name as the class itself,
has no return type, and is invoked using
the new operator.<br />
A method is an ordinary member function
of a class. It has its own name, a return
type (which may be void), and is invoked
using the dot operator.</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>10:</strong>
<strong>State
the significance of public, private, protected,
default modifiers both singly and in combination
and state the effect of package relationships
on declared items qualified by these modifiers</strong></span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span><span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><em><strong>public
: </strong></em>Public class is visible
in other packages, field is visible everywhere
(class must be public too)<br />
<em><strong>private :</strong></em> Private
variables or methods may be used only by
an instance of the same class that declares
the variable or method, A private feature
may only be accessed by the class that owns
the feature.<br />
<em><strong>protected :</strong></em> Is
available to all classes in the same package
and also available to all subclasses of
the class that owns the protected feature.This
access is provided even to subclasses that
reside in a different package from the class
that owns the protected feature.<br />
<em><strong>default :</strong></em>What
you get by default ie, without any access
modifier (ie, public private or protected).It
means that it is visible to all within a
particular package.</span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif;"><span style="font-size: large;"><strong>11 :</strong>
<strong>What
is final?<a href="" name="q15"></a></strong></span></span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
A
final class can't be extended ie., final
class may not be subclassed. A final method
can't be overridden when its class is inherited.
You can't change value of a final variable
(is a constant).</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<table border="0" cellpadding="0" cellspacing="0" class="bodytext" style="text-align: left;"><tbody>
<tr valign="top"><td width="3%"><span style="font-family: Times, "Times New Roman", serif; font-size: large;"><strong>12 :</strong></span></td><td class="bodytext" width="97%"><span style="font-family: Times, "Times New Roman", serif; font-size: large;"> </span><span style="font-family: Times, "Times New Roman", serif; font-size: large;"><strong>What is static in java?</strong></span><br />
<strong></strong><span style="font-family: Times, "Times New Roman", serif; font-size: large;"> </span></td></tr>
<tr valign="top"><td height="81"><span style="font-family: Times, "Times New Roman", serif; font-size: large;"><strong></strong></span></td><td><span style="font-family: Times, "Times New Roman", serif; font-size: large;">Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass</span><br />
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">.</span><br />
<br />
</td></tr>
</tbody></table>
</div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"> </span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;">
</span></div>
<div style="text-align: left;">
<span style="font-family: Times, "Times New Roman", serif; font-size: large;"></span></div>
</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-33413003302313383312012-04-10T12:46:00.001+05:302012-04-10T12:46:49.301+05:30Applets in JAVA<div dir="ltr" style="text-align: left;" trbidi="on">
An applet is a Java program that runs within a Java-compatible WWW browser or<br />in an appletviewer. To execute your applet, the browser:<br />
<br />
Creates an instance of your applet<br />
<br />• Sends messages to your applet to automatically invoke predefined lifecycle<br />methods<br />
<br />The predefined methods automatically invoked by the runtime system are:<br />
<br />• init(). This method takes the place of the Applet constructor and is only called<br />once during applet creation. Instance variables should be initialized in this method.<br />GUI components such as buttons and scrollbars should be added to the GUI in<br />this method.<br />
<br />• start(). This method is called once after init() and whenever your applet is<br />revisited by your browser, or when you deiconify your browser. This method<br />should be used to start animations and other threads.<br />
<br />• paint(Graphics g). This method is called when the applet drawing area needs<br />to be redrawn. Anything not drawn by contained components must be drawn in<br />this method. Bitmaps, for example, are drawn here, but buttons are not because<br />they handle their own painting.<br />
<br />• stop(). This method is called when you leave an applet or when you iconify<br />your browser. The method should be used to suspend animations and other<br />threads so they do not burden system resources unnecessarily. It is guaranteed to<br />be called before destroy().<br />
<br />• destroy(). This method is called when an applet terminates, for example, when<br />quitting the browser. Final clean-up operations such as freeing up system<br />resources with dispose() should be done here.<br />
<br />
The dispose() method of Frame<br />removes the menu bar. Therefore, do not forget to call super.dispose() if you<br />override the default behavior.<br />
<br />The basic structure of an applet that uses each of these predefined methods is:<br />import java.applet.Applet;<br />
<br />// include all AWT class definitions<br />
<br />import java.awt.*;<br />public class AppletTemplate extends Applet {<br />public void init() {<br />// create GUI, initialize applet<br />}<br />public void start() {<br />// start threads, animations etc...<br />}<br />public void paint(Graphics g) {<br />// draw things in g<br />}<br />public void stop() {<br />// suspend threads, stop animations etc...<br />}<br />public void destroy() {<br />// free up system resources, stop threads<br />}<br />}</div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0tag:blogger.com,1999:blog-6079621863045441783.post-10674330937754738852012-04-10T12:40:00.000+05:302012-04-10T12:40:56.687+05:30Major differences between applications and applets in JAVA<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: TimesNewRomanPSMT;"><ol style="text-align: left;">
<li><div style="text-align: left;">
Applets are not allowed to use file I/O and sockets (other than to the host</div>
</li>
</ol>
platform). Applications do not have these restrictions.<br />
</span><span style="font-family: TimesNewRomanPSMT;">2. An applet must be a subclass of the Java </span><span style="font-family: CourierNewPSMT; font-size: x-small;"><span style="font-family: CourierNewPSMT; font-size: x-small;">Applet </span></span><span style="font-family: TimesNewRomanPSMT;">class. Aplications do not need to</span><br />
<span style="font-family: TimesNewRomanPSMT;"><div align="LEFT">
subclass any particular class.</div>
</span><div align="LEFT">
<span style="font-family: Symbol;"></span></div>
<span style="font-family: Symbol;"></span><div align="LEFT">
<span style="font-family: TimesNewRomanPSMT;">3. Unlike applets, applications can have menus.</span></div>
<span style="font-family: TimesNewRomanPSMT;">
</span><span style="font-family: Symbol;"></span><br />
<span style="font-family: Symbol;"></span><div align="LEFT">
<span style="font-family: TimesNewRomanPSMT;">4. Unlike applications, applets need to respond to predefined lifecycle messages</span></div>
<span style="font-family: TimesNewRomanPSMT;">
</span><span style="font-family: TimesNewRomanPSMT;">from the WWW browser in which they're running.</span><br />
<span style="font-family: TimesNewRomanPSMT;"></span></div>Anonymoushttp://www.blogger.com/profile/01358921294305721949noreply@blogger.com0