<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JavaBeat &#187; Web 2.0</title>
	<atom:link href="http://www.javabeat.net/category/web-2-0/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javabeat.net</link>
	<description>Java Technology News</description>
	<lastBuildDate>Mon, 13 May 2013 20:10:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Canvas Tag in HTML5</title>
		<link>http://www.javabeat.net/2011/07/canvas-tag-in-html5/</link>
		<comments>http://www.javabeat.net/2011/07/canvas-tag-in-html5/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 23:36:53 +0000</pubDate>
		<dc:creator>krishnas</dc:creator>
				<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/?p=2430</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>Introduction HTML5 is the version of HTML and XHTML that has rekindled the future of HTML and is treated as the future of the web technology. HTML5 originated with the cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG) and has the capability to address the increasing [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><a id="dd_start"></a><h2>Introduction</h2>
<p><b>HTML5</b> is the version of HTML and XHTML that has rekindled the future of HTML and is treated as the future of the web technology. <b>HTML5</b> originated with the cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG) and has the capability to address the increasing RIA demands. The new features like canvas, video, audio, local storage, web worker, web sockets etc have given <b>HTML5</b> a real push in the market.</p>
<p>As <b>HTML5</b> is still developing in leaps and bounce, support is still not available for the advanced features in certain browsers. Though modern browsers support most of the features, google chrome is the best among the available. The alarming issue yet to be resolved is the lack of support for <b>HTML5</b> features in IE. It is expected that in the next release of the IE, more features will be supported.</p>
<h2>Canvas</h2>
<p>Canvas is one of the most discussed additions in HTML5.This feature allows to create dynamic effects in web pages without any external plug-in. Canvas creates a 2d drawing area where, images can be added, build graph, create animation etc using JavaScript functionality. Canvas tag is supported in all major browsers like Mozilla, Chrome, Safari, Opera etc</p>
<h3>&lt;Canvas&gt; Element</h3>
<p>Canvas element creates a rectangular portion in the webpage with co-ordinate system. Canvas element, like any other <b>HTML5</b> element has DOM structure with its specific id attribute. There can be more than one canvas tag in a page. Each Canvas element can be clearly differentiated using id attribute.  JavaScript should be used to draw images or build animation on Canvas.</p>
<p>Canvas element without any associated JavaScript code is completely empty. It does not have any border or content of its own.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;canvas id=“demoCanvas” width=“200” height=“200”&gt;&lt;/canvas&gt;</pre></td></tr></table></div>

<p>Canvas is a container tag with three attributes. &#8216;Width&#8217; and &#8216;Height&#8217; attributes are used to fix the size of the available drawing area created by the element. Like any other element in HTML canvas also has the &#8216;ID&#8217; attribute, which can be used to access the element using scripting language. All the attributes are optional and width and height can be set using DOM properties. If the size of the canvas is not set, it will occupy a default width of 300 pixels and height of 150 pixels. The text between the starting tag and end tag of canvas will be displayed on the browser if the browser does not support Canvas.</p>
<h3>Rendering Context</h3>
<p>The drawing surface canvas creates has one or more rendering context associated within and can be used for creating and manipulating the contents in canvas. Presently only 2d drawing context is available as 3d rendering context is still in experimental stages. Scripting languages should be used to access the context in order to draw on it. Rendering context of the canvas element can be accessed using the DOM method known as getContext().</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">var canvas = document.getElementById(‘demoCanvas’);  // get canvas DOM node 
	var ctx = canvas.getContext('2d');  //to access the drawing context</pre></td></tr></table></div>

<p>The canvas DOM node can be retrieved using the JavaScript method getElemntById(). Once the Canvas element is accessed, using the getContext() method the drawing context is accessed. The method getContext takes a parameter of type context. In the above example &#8217;2d&#8217; drawing context has been accessed.</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>The complete code of a sample <b>HTML5</b> page using canvas is shown below.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Canvas&lt;/title&gt;
		&lt;script type=&quot;text/javascript&quot;&gt;
		function draw() {
			var canvas = document.getElementById(&quot;demoCanvas&quot;);
			if (canvas.getContext){
				var ctx = canvas.getContext('2d');
			} else {
				alert('Your browser does not support canvas!!');
			}
		}
		&lt;/script&gt;
	&lt;/head&gt;
	&lt;body onload=&quot;draw()&quot;&gt;
		&lt;canvas id=&quot;demoCanvas&quot; width=&quot;300&quot; height=&quot;225“ &gt;&lt;/canvas&gt;
	&lt;/body&gt;
	&lt;/html&gt;</pre></td></tr></table></div>

<h3>Drawing Shapes</h3>
<p>Canvas is a two dimensional grid with the values of &#8216;X&#8217; axis increasing towards the right and the values of &#8216;Y&#8217; axis increasing towards the bottom edge. The co-ordinate points are used to position while drawing objects on the canvas. Rectangle is the only shape that can be drawn on the canvas. All other shapes are created through a combination in canvas. There are three different functions available for drawing rectangles.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">fillRect(x,y,width,height) // Draws a filled rectangle from the specified coordinates
	strokeRect(x,y,width,height) // Draws a rectangular outline from the specified coordinates
	clearRect(x,y,width,height)  //Clears the specified area</pre></td></tr></table></div>

<p>All the three methods have four parameters, namely</p>
<ul>
<li>X		- x coordinate relative to origin</li>
<li>Y		- y coordinate relative to origin</li>
<li>Width	- width of the rectangle</li>
<li>Height	- height of the rectangle</li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;head&gt;
		&lt;script type=&quot;text/javascript&quot;&gt;
		function draw() {
			var canvas = document.getElementById(&quot;demoCanvas&quot;);
			if (canvas.getContext){
				var ctx = canvas.getContext('2d');
				ctx.fillRect(20,20,75,75);
				ctx.clearRect(40,40,50,50);
				ctx.strokeRect(10,10,100,100);
			} else {
				alert('Your browser does not support canvas!!');
			}
		}
		&lt;/script&gt;
	&lt;/head&gt;
	&lt;body onload=&quot;draw()&quot;&gt;
		&lt;canvas id=&quot;demoCanvas&quot; width=&quot;300&quot; height=&quot;225“style=&quot;border; 5px green dashed&quot; &gt;&lt;/ canvas&gt;
	&lt;/body&gt;</pre></td></tr></table></div>

<p>Different types of path can be drawn in order to obtain complex shapes other than rectangle. The available functions are:-</p>
<ul>
<li>beginPath()</li>
<ul>
<li>beginPath() starts a  new path or fresh path on the canvas.</li>
</ul>
<li>closePath()</li>
<ul>
<li>The method is used to draw a straight line from the starting point to the current point. It tries to close the shape.</li>
</ul>
<li>stroke() and fill()</li>
<ul>
<li>These methods are used to draw shapes on the canvas. stroke() method draws only an outline of the shape and the fill() method paints a solid shape. The two methods can be combined in order to obtain complex shapes.</li>
</ul>
<li>moveTo()</li>
<ul>
<li>This method doesn&#8217;t draw anything on the canvas. It is like lifting the pointer from one point to another.</li>
<li>The method takes two parameters, the coordinates of the new starting point</li>
<li>This method is very useful for drawing complex shapes in order to reach different co-ordinate points on the canvas</li>
</ul>
<li>lineTo()</li>
<ul>
<li>This method is used to draw straight lines</li>
<li>The method takes two parameters, the x and y coordinates of the end point of the line. The beginning point of the line will be the ending point of the previously drawn path. moveTo() method can be used to change the starting point to draw lines from different points</li>
</ul>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot;&gt;
	function draw() {
		var canvas = document.getElementById(&quot;demoCanvas&quot;);
		var ctx = canvas.getContext('2d');
		ctx.beginPath();
		ctx.moveTo(40,40);
		ctx.lineTo(100,40);
		ctx.lineTo(40,100);
		ctx.fill();
		ctx.beginPath();
		ctx.moveTo(30,30);
		ctx.lineTo(120,30);
		ctx.lineTo(30,120);
		ctx.lineTo(30,30);
		ctx.stroke();
	}
	&lt;/script&gt;
	&lt;body onload=&quot;draw()&quot;&gt;
		&lt;canvas id=&quot;demoCanvas&quot; width=&quot;300&quot; height=&quot;225“ &gt;&lt;/canvas&gt;
	&lt;/body&gt;</pre></td></tr></table></div>

<ul>
<li>arc()</li>
<ul>
<li>This method is used to draw circles and curves. This is one of the methods that is used very often to draw shapes on canva.</li>
<li>This method takes five parameters:</li>
<ul>
<li>x and y are the coordinates of the circle&#8217;s center</li>
<li>Radius is the radius of the circle or arc</li>
<li>The startAngle and endAngle parameters define the start and end points of the arc ,which are measured from the x axis. Angles in the arc function are measured in radians.</li>
<li>The anticlockwise parameter is a Boolean value. If true, the arc is drawn in anticlockwise direction, otherwise in  clockwise direction.</li>
</ul>
</ul>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">arc(x, y, radius, startAngle, endAngle, anticlockwise);
&nbsp;
&nbsp;
	&lt;script type=&quot;text/javascript&quot;&gt;
	function draw() {
		var canvas = document.getElementById(&quot;demoCanvas&quot;);
		var ctx = canvas.getContext('2d');
		for (var i=0;i&lt;5;i++){
			for (var j=0;j&lt;5;j++){
				ctx.beginPath();
				ctx.arc(20+j*15,20+i*15,10,0,Math.PI*2,true);
				ctx.stroke();
			}
		}
	}
	&lt;/script&gt;
	&lt;body onload=&quot;draw()&quot;&gt;
		&lt;canvas id=&quot;demoCanvas&quot; width=&quot;300&quot; height=&quot;225“ &gt;&lt;/canvas&gt;
	&lt;/body&gt;</pre></td></tr></table></div>

<p>Colors can be set to different shapes in canvas using fillStyle() and strokeStyle() methods. fillStyle() is used to fill a shape with a specific colour and strokeStyle() to draw a border. Both fillStyle and strokeStyle have black as default value, if no colour is set.</P></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">//colour can be set in the following ways:
	ctx.fillStyle = “Red&quot;;  
	ctx.fillStyle = &quot;#FFA810&quot;;  
	ctx.fillStyle = &quot;rgb(205,0, 185)&quot;;</pre></td></tr></table></div>

<h3>Images in Canvas</h3>
<p>Canvas is a holding area even for images. Images can be added to any co-ordinate position on the canvas. drawImage() method is used to draw the image on the canvas at the specified coordinates using the co-ordinate system . The image object is created and passed as a parameter to the drawImage() method.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot;&gt;
	function draw() {
		var canvas = document.getElementById(&quot;demoCanvas&quot;);
		var ctx = canvas.getContext('2d');
		var cat = new Image();
		cat.src = &quot;car.png“;
		ctx.drawImage(cat,50,50);
	&lt;/script&gt;
	&lt;body onload=&quot;draw()&quot;&gt;
		&lt;canvas id=&quot;demoCanvas&quot; width=&quot;300&quot; height=&quot;225“ &gt;&lt;/canvas&gt;
	&lt;/body&gt;</pre></td></tr></table></div>

<h2>Conclusion</h2>
<p>Canvas tag can be used to design games and complex dynamic effects in <b>HTML5</b>. In near future, with the canvas extending its support to 3d context drawing more and more dynamic effects can be generated. Presently there are games and websites which have made use of canvas extensively.</p>
<div class='dd_outer'><div class='dd_inner'><div id='dd_ajax_float'><div class='dd_button_v'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Fwww.javabeat.net%2Fcategory%2Fweb-2-0%2Ffeed%2F" send="false" show_faces="false"  layout="box_count" width="50"  ></fb:like></div><div style='clear:left'></div><div class='dd_button_v'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.javabeat.net/category/web-2-0/feed/'></g:plusone></div><div style='clear:left'></div><div class='dd_button_v'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.javabeat.net/category/web-2-0/feed/" data-count="vertical" data-text="Web 2.0" data-via="javabeat" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style='clear:left'></div><div class='dd_button_extra_v'><script type="text/javascript">jQuery(document).load(function(){ stLight.options({publisher:'bab47279-62c9-46af-addc-79fd1fe8fee0'}); });</script><div class="st_email_custom"><span id='dd_email_text'>email</span></div></div><div style='clear:left'></div><div class='dd_button_extra_v'><div id='dd_print_button'><span id='dd_print_text'><a href='javascript:window:print()'>print</a></span></div></div><div style='clear:left'></div></div></div></div><script type="text/javascript">var dd_offset_from_content = 44; var dd_top_offset_from_content = 0;</script><script type="text/javascript" src="http://www.javabeat.net/wp-content/plugins/digg-digg//js/diggdigg-floating-bar.js?ver=5.3.0"></script><div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2011/07/canvas-tag-in-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Web 2.0?</title>
		<link>http://www.javabeat.net/2008/09/what-is-web-2-0/</link>
		<comments>http://www.javabeat.net/2008/09/what-is-web-2-0/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 13:01:52 +0000</pubDate>
		<dc:creator>JavaBeat</dc:creator>
				<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/examples/?p=244</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>Web 2.0, a phrase is a cluster term for the new phase of World Wide Web, which was coined by O’Reilly and Media live International in 2003 and popularized by the first Web 2.0 conference in 2004. There is no certain definition of Web 2.0, even though; it stands for the transformation of the web [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><p>
<b><i>Web 2.0</i></b>, a phrase is a cluster term for the new phase of World Wide Web, which was coined by O’Reilly and Media live International in 2003 and popularized by the first <b><i>Web 2.0</i></b> conference in 2004. There is no certain definition of <b><i>Web 2.0</i></b>, even though; it stands for the transformation of the web into a full-fledged computing platform.
</p>
<p>
<b><i>Web 2.0</i></b> is not a modified version of World Wide Web, but it is a different way to utilize Internet into web platform like weblogs, social book marking, wikis, podcasts, RSS feeds (and other forms of many-to-many publishing), social networking web, Web APIs, Web standards and online service provider. It is like open sourcing and genuine interactivity in which user can upload anything, download anything and can use the content according to its own wish. There is no restriction of more or less measure of content, uploading and downloading. All these are absolutely free.
</p>
<p>
According to ‘O’Reilly, the inventor of <b><i>Web 2.0</i></b>, “<b><i>Web 2.0</i></b> is the business revolution in the computer industry caused by the move to the Internet as platform, and an attempt to understand the rules for success on that new platform”. So <b><i>Web 2.0</i></b> is a new way of business via Internet. It’s really a new business tactic that is being used on the mass level across the world. The success of ‘YouTube’, ‘Orkut’, ‘MySpace’, ‘Google’, ‘live’, ‘Wikipedia’ and many more websites are the biggest examples of Web 2.0.
</p>
<p>
As we have already mentioned that <b><i>Web 2.0</i></b> has not any specific definition. Many users have defined its in their own way. According to Wikipedia, “<b><i>Web 2.0</i></b> is a term often applied to a perceived ongoing transition of the World Wide Web from a collection of websites to a full-fledged computing platform serving web applications to end users. Ultimately <b><i>Web 2.0</i></b> services are expected to replace desktop computing applications for many purposes.”
</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>
On the other hand, according to Wall Street Technology powered by CMP ‘United Business Media’, the coinventor of <b><i>Web 2.0</i></b>, “<b><i>Web 2.0</i></b> refers to Rich Internet Applications (RIAs) that use the Internet as a platform to create interactive user interfaces that resemble PCbased applications. Typically, RIAs emphasize online collaboration among users.”
</p>
<p>
Several supporters of <b><i>Web 2.0</i></b> have defined it according to their uses, observations and experiences, but in brief, we can say that:
</p>
<ul>
<li><b><i>Web 2.0</i></b> is a conversion of websites from unique information structure having the sources of content and functionality. That’s why being a computing platforms it serves web applications to end-users.</li>
<li><b><i>Web 2.0</i></b> is a new way of organizing and categorizing of the content, audio, video, pictures and movies highly stressing to the growth of the economic value of the Web.</li>
<li>Tim O’Reilly, the father of <b><i>Web 2.0 along with his colleague John Battelle summarized the key principles <b><i>Web 2.0</i></b> applications in 2005. According to them:</li>
<p>          a)The web as a platform<br />
          b)Data as the driving force</p>
<li>Network effects created by an architecture of participation</li>
<li>Innovation in assembly of systems and sites composed by pulling together features from distributed, independent developers (a kind of “open source” development)</li>
<li>Lightweight business models enabled by content and service syndication</li>
<li>The end of the software adoption cycle (“the perpetual beta”)</li>
<li>Software above the level of a single device, leveraging the power of the “Long Tail”</li>
<li>Ease of picking-up by early adopters</li>
</ul>
<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2008/09/what-is-web-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
