<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Ki4ngel's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 21:36:26 GMT</pubDate>
    <description>DZone Snippets: Ki4ngel's Code Snippets</description>
    <item>
      <title>Copy MySQL table</title>
      <link>http://snippets.dzone.com/posts/show/5489</link>
      <description>&lt;code&gt;&lt;br /&gt;CREATE TABLE table_destination SELECT * FROM table_source ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;CREATE TABLE table_destination LIKE table_source ;&lt;br /&gt;INSERT INTO table_destination SELECT * FROM table_source ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Source: &lt;a href="http://www.ab-d.fr/"&gt;Asselin Benoit Development ( MySQL, SQL )&lt;/a&gt; &amp; &lt;a href="http://www.agenceici.com"&gt;Agence ici, agence de communication&lt;/a&gt;</description>
      <pubDate>Tue, 13 May 2008 17:31:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5489</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>parseInt() in PHP</title>
      <link>http://snippets.dzone.com/posts/show/5237</link>
      <description>&lt;code&gt;&lt;br /&gt;function parseInt($string) {&lt;br /&gt;//	return intval($string);&lt;br /&gt;	if(preg_match('/(\d+)/', $string, $array)) {&lt;br /&gt;		return $array[1];&lt;br /&gt;	} else {&lt;br /&gt;		return 0;&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;echo parseInt("2008"); // 2008&lt;br /&gt;echo parseInt("99.90 dollars"); // 99&lt;br /&gt;echo parseInt("www.w3.org"); // 3&lt;br /&gt;echo parseInt("300 spartiates"); // 300&lt;br /&gt;echo parseInt("block text..."); // 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: AB-D Cr&#233;ation de sites internet&lt;/a&gt;</description>
      <pubDate>Sun, 16 Mar 2008 15:39:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5237</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>insertAfter() with insertBefore() and node.nextSibling</title>
      <link>http://snippets.dzone.com/posts/show/5179</link>
      <description>insertAfter() with insertBefore() and node.nextSibling&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Node.prototype.insertAfter = function(newNode, refNode) {&lt;br /&gt;	if(refNode.nextSibling) {&lt;br /&gt;		return this.insertBefore(newNode, refNode.nextSibling);&lt;br /&gt;	} else {&lt;br /&gt;		return this.appendChild(newNode);&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: Benoit Asselin&lt;/a&gt;</description>
      <pubDate>Tue, 26 Feb 2008 20:53:30 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5179</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Selector :target in CSS 3</title>
      <link>http://snippets.dzone.com/posts/show/5155</link>
      <description>&lt;code&gt;&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;title&gt;CSS3 *:target&lt;/title&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;style type="text/css" media="screen"&gt;&lt;br /&gt;	&lt;br /&gt;	h1:hover { text-decoration: underline; } /* CSS 1 et 2 */&lt;br /&gt;	h1:target { background-color: #ff6600; } /* CSS 3 */&lt;br /&gt;	&lt;br /&gt;	&lt;/style&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;h1 id="title-1"&gt;Title n&#176;1&lt;/h1&gt;&lt;br /&gt;	&lt;p&gt;CSS...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;CSS...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;CSS...&lt;/p&gt;&lt;br /&gt;	&lt;hr /&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;h1 id="title-2"&gt;Title n&#176;2&lt;/h1&gt;&lt;br /&gt;	&lt;p&gt;CSS...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;CSS...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;CSS...&lt;/p&gt;&lt;br /&gt;	&lt;hr /&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;p&gt;&lt;a href="#title-1"&gt;Title n&#176;1&lt;/a&gt; | &lt;a href="#title-2"&gt;Title n&#176;2&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: AB-D.fr&lt;/a&gt;</description>
      <pubDate>Tue, 19 Feb 2008 20:59:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5155</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Position : fixed in MSIE6</title>
      <link>http://snippets.dzone.com/posts/show/5132</link>
      <description>&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;title&gt;"position: fixed" compatible Microsoft Internet Explorer 6&lt;/title&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	&lt;!-- Code CSS for Firefox, Safari, Opera, Internet Explorer 7... --&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;style type="text/css" media="screen"&gt;&lt;br /&gt;		&lt;br /&gt;	#fixed {&lt;br /&gt;		position: fixed;&lt;br /&gt;		left: 0; top: 0; right: 0;&lt;br /&gt;		width: 100%;&lt;br /&gt;		padding: 10px; background: gray;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;/style&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	&lt;!-- Code CSS for Internet Explorer 6 --&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;!--[if lte IE 6]&gt;&lt;br /&gt;	&lt;style type="text/css" media="screen"&gt;&lt;br /&gt;	&lt;br /&gt;	#fixed {&lt;br /&gt;		position: absolute;&lt;br /&gt;		top: expression((document.documentElement.scrollTop || document.body.scrollTop) + this.offsetHeight - this.offsetHeight);&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;/style&gt;&lt;br /&gt;	&lt;![endif]--&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;div id="fixed"&gt;DIV in position: fixed;&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;p&gt;Content...&lt;/p&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: Asselin Benoit Developpement, conception de sites internet&lt;/a&gt;</description>
      <pubDate>Mon, 11 Feb 2008 20:39:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5132</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Make a variable CSS</title>
      <link>http://snippets.dzone.com/posts/show/5110</link>
      <description>Page.html&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;	&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;title&gt;Variable CSS&lt;/title&gt;&lt;br /&gt;	&lt;link rel="stylesheet" type="text/css" href="style.php" /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;Title&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="color-1"&gt; Text  Text  Text  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="color-2"&gt; Text  Text  Text  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="color-3"&gt; Text  Text  Text  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Style.php&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;header('Content-Type: text/css');&lt;br /&gt;&lt;br /&gt;$color_0 = '#000000';&lt;br /&gt;$color_1 = '#ff0000';&lt;br /&gt;$color_2 = '#ff3300';&lt;br /&gt;$color_3 = '#ff6600';&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;* { font-family: sans-serif; }&lt;br /&gt;&lt;br /&gt;h1 {&lt;br /&gt;	padding: 5px;&lt;br /&gt;	color: &lt;?= $color_0 ?&gt;;&lt;br /&gt;	border: 5px solid &lt;?= $color_2 ?&gt;;&lt;br /&gt;	background-color: &lt;?= $color_3 ?&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;p.color-1 { color: &lt;?= $color_1 ?&gt;; }&lt;br /&gt;p.color-2 { color: &lt;?= $color_2 ?&gt;; font-weight: bold; }&lt;br /&gt;p.color-3 { color: &lt;?= $color_3 ?&gt;; font-style: italic; }&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr"&gt;Source: Asselin Benoit D&#233;veloppement, cr&#233;ation de site internet amiens&lt;/a&gt;</description>
      <pubDate>Wed, 06 Feb 2008 19:02:03 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5110</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Regular Expressions with MySQL</title>
      <link>http://snippets.dzone.com/posts/show/5011</link>
      <description>&lt;code&gt;&lt;br /&gt;SELECT * FROM texts WHERE content REGEXP '[^a-z]Hello[^a-z]' ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you really want to force a REGEXP comparison to be case sensitive, use the BINARY keyword to make one of the strings a binary string.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;SELECT * FROM texts WHERE content REGEXP BINARY '[^a-zA-Z]Hello[^a-zA-Z]' ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Warning: some characters do not work. Example :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;SELECT * FROM texts WHERE content REGEXP '[^\w]Hello[^\w]' ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;ab-d.fr source code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Sat, 19 Jan 2008 22:05:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5011</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>Google Analytics</title>
      <link>http://snippets.dzone.com/posts/show/4933</link>
      <description>&lt;code&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://www.google-analytics.com/urchin.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;_uacct = "MY-KEY";&lt;br /&gt;urchinTracker();&lt;br /&gt;--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;src:&lt;/a&gt;&lt;a href="http://www.tai-do.com/"&gt;ab-d&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Sun, 30 Dec 2007 15:10:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4933</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>iPhone Orientation</title>
      <link>http://snippets.dzone.com/posts/show/4912</link>
      <description>iPhoneOrientation&lt;br /&gt;Demonstrates how to handle iPhone or iPod touch orientation events using HTML, CSS, and JavaScript.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;index.html&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;		&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;&lt;br /&gt;		&lt;meta name="viewport" content="width=device-width, user-scalable=no" /&gt;&lt;br /&gt;		&lt;title&gt;Handling iPhone or iPod touch Orientation Events&lt;/title&gt; &lt;br /&gt;		&lt;br /&gt;		&lt;!-- The iPhoneOrientation.css file is used to adjust the page appearance --&gt;&lt;br /&gt;		&lt;link rel="stylesheet" href="iPhoneOrientation.css" type="text/css" /&gt;&lt;br /&gt;		&lt;br /&gt;		&lt;!-- The iPhoneOrientation.js file shows how to handle iPhone orientation events --&gt;&lt;br /&gt;		&lt;script type="text/javascript" src="iPhoneOrientation.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body class="portrait"&gt;&lt;br /&gt;		&lt;!-- Display a message that describes the current iPhone orientation after rotation --&gt;&lt;br /&gt;		&lt;div id="currentOrientation"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;!-- The container div is made of two inner divs: leftContainer and rightContainer. The leftContainer and rightContainer are stacked&lt;br /&gt;				 up one above the other when iPhone is in portrait orientation and side by side when iPhone is in landscape orientation --&gt;&lt;br /&gt;		&lt;div id="container"&gt;&lt;br /&gt;			&lt;!--The button class is used to build a rounded rectangle around each text --&gt;&lt;br /&gt;			&lt;!--The page appearance changes whenever iPhone rotates between portrait and landscape display views --&gt;&lt;br /&gt;			&lt;div id="leftContainer"&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/DebuggingSafarioniPhoneContent/chapter_10_section_1.html'"&gt;Debug Console&lt;/div&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/chapter_4_section_8.html'"&gt;Viewport Settings&lt;/div&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;			&lt;div id="rightContainer"&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/AdjustingtheTextSize/chapter_5_section_4.html'"&gt;Highlighting Elements&lt;/div&gt;&lt;br /&gt;					&lt;div class="button" onclick="window.location.href='http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/DesigningForms/chapter_7_section_1.html'"&gt;Form Auto Correction&lt;/div&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;	&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;iPhoneOrientation.css&lt;br /&gt;&lt;code&gt;&lt;br /&gt;body &lt;br /&gt;{&lt;br /&gt;		margin: 0px;&lt;br /&gt;		padding: 0px;&lt;br /&gt;		font-size: 12px;&lt;br /&gt;		font-family: 'Lucida Grande', Verdana, sans-serif;&lt;br /&gt;		font-weight: bold;&lt;br /&gt;		/* Turn off font resizing */&lt;br /&gt;		-webkit-text-size-adjust: none;   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set the background color of the page when the body tag's class attribute is equal to portrait. &lt;br /&gt;   The expression body[class="value"] is a CSS attribute selector where "body" is the html element to be styled, "class" the body's attribute to be&lt;br /&gt;   manipulated, and "value" the class attribute's value, which is either portrait, landscapeLeft, or landscapeRight.&lt;br /&gt;   This expression is used to dynamically select a body style according to the class attribute value. For instance, if the body's class attribute is set&lt;br /&gt;   to landscapeLeft, then all style declarations matching body[class="landscapeLeft"] will be used to style "Handling iPhone or iPod touch Orientation Events". &lt;br /&gt;   The JavaScript updateOrientation function in the iPhoneOrientation.js file is used to set the body's class attribute to one of these values.&lt;br /&gt;   Further information about CSS attribute selectors can be found at  http://www.w3.org/TR/css3-selectors/#attribute-selectors.&lt;br /&gt; */&lt;br /&gt;body[class="portrait"] &lt;br /&gt;{&lt;br /&gt;		background: white;    	&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Adjust a button when the body's class attribute is equal to portrait */&lt;br /&gt;body[class="portrait"] .button    &lt;br /&gt;{	&lt;br /&gt;		background: white;&lt;br /&gt;		width: 210px;&lt;br /&gt;		height: 13px;&lt;br /&gt;		&lt;br /&gt;		padding: 10px 0px;&lt;br /&gt;		margin: 10px auto;&lt;br /&gt;		&lt;br /&gt;		font-size: 15px;&lt;br /&gt;		&lt;br /&gt;		/* text is black on the button */&lt;br /&gt;		color: black;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The leftContainer and rightContainer div elements are stacked up one after the other when the body's class attribute is equal to portrait. &lt;br /&gt;   They are both 200 pixels wide. */&lt;br /&gt;body[class="portrait"] #leftContainer&lt;br /&gt;{&lt;br /&gt;		width: 200px;&lt;br /&gt;		margin: auto auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;body[class="portrait"] #rightContainer&lt;br /&gt;{&lt;br /&gt;		width: 200px;&lt;br /&gt;		margin: auto auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set the background color of the page when the body's class attribute is set to landscapeLeft */&lt;br /&gt;body[class="landscapeLeft"] &lt;br /&gt;{&lt;br /&gt;		background: lightgrey;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Adjust a button when the body's class attribute is set to landscapeLeft */&lt;br /&gt;body[class="landscapeLeft"] .button  &lt;br /&gt;{&lt;br /&gt;		background: black;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The container div is evenly split between leftContainer and rightContainer when the body's class attribute is set to landscapeLeft.&lt;br /&gt;   leftContainer and rightContainer are stacked side by side. leftContainer aligns buttons to the left side of the page; &lt;br /&gt;   rightContainer aligns buttons to the right side of the page. */&lt;br /&gt;body[class="landscapeLeft"] #leftContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		/* Align the div to the left of the page  */&lt;br /&gt;		float: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;body[class="landscapeLeft"] #rightContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		/* Align the div to the right of the page  */&lt;br /&gt;		float: right;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Set the background color of the page when the body's class attribute is equal to landscapeRight */&lt;br /&gt;body[class="landscapeRight"] &lt;br /&gt;{&lt;br /&gt;		background: tan;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Adjust a button when the body's class attribute is equal to landscapeRight */&lt;br /&gt;body[class="landscapeRight"] .button  &lt;br /&gt;{&lt;br /&gt;		background: darkred;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The container div is evenly split between leftContainer and rightContainer when the body's class attribute is set to landscapeRight.&lt;br /&gt;   leftContainer aligns buttons to the left side of the page; rightContainer aligns buttons to the right side of the page. */&lt;br /&gt;body[class="landscapeRight"] #leftContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		float: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;body[class="landscapeRight"] #rightContainer&lt;br /&gt;{&lt;br /&gt;		width: 50%;&lt;br /&gt;		float: right;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Draw a rounded rectangle around a text */&lt;br /&gt; .button    &lt;br /&gt;{&lt;br /&gt;		font-weight: bold;&lt;br /&gt;		text-align: center;&lt;br /&gt;		&lt;br /&gt;		width: 130px;&lt;br /&gt;		height: 13px;&lt;br /&gt;		font-size: 10px;&lt;br /&gt;		&lt;br /&gt;		/* text is white on the button */&lt;br /&gt;		color: white;	&lt;br /&gt;	&lt;br /&gt;		/* Draw a rectangle around a text */&lt;br /&gt;		border: 1px solid black;    &lt;br /&gt;		&lt;br /&gt;		/* Round each corner of the generated rectangle */&lt;br /&gt;		-webkit-border-radius: 5px;   &lt;br /&gt;		padding: 5px 0px;&lt;br /&gt;		margin: 5px auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* Defines styling properties for the currentOrientation div, which shows a message that indicates iPhone's current orientation after rotation */&lt;br /&gt;#currentOrientation&lt;br /&gt;{		&lt;br /&gt;		width: 280px;&lt;br /&gt;		text-align: center;&lt;br /&gt;		margin: 10px auto;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;a&lt;br /&gt;{&lt;br /&gt;		text-decoration: none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* The container div contains four buttons that are evenly divided between the inner leftContainer and rightContainer div elements.&lt;br /&gt;   Its width does not change when iPhone switches between portrait and landscape orientations. */&lt;br /&gt;#container&lt;br /&gt;{&lt;br /&gt;		/* fixed width across all iPhone orientation changes */&lt;br /&gt;		width: 300px;&lt;br /&gt;		margin: 10px auto;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;iPhoneOrientation.js&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* updateOrientation checks the current orientation, sets the body's class attribute to portrait, landscapeLeft, or landscapeRight, &lt;br /&gt;   and displays a descriptive message on "Handling iPhone or iPod touch Orientation Events".  */&lt;br /&gt;function updateOrientation()&lt;br /&gt;{&lt;br /&gt;	/*window.orientation returns a value that indicates whether iPhone is in portrait mode, landscape mode with the screen turned to the&lt;br /&gt;	  left, or landscape mode with the screen turned to the right. */&lt;br /&gt;	var orientation=window.orientation;&lt;br /&gt;	switch(orientation)&lt;br /&gt;	{&lt;br /&gt;	&lt;br /&gt;		case 0:&lt;br /&gt;				/* If in portrait mode, sets the body's class attribute to portrait. Consequently, all style definitions matching the body[class="portrait"] declaration&lt;br /&gt;				   in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */&lt;br /&gt;				document.body.setAttribute("class","portrait");&lt;br /&gt;				&lt;br /&gt;				/* Add a descriptive message on "Handling iPhone or iPod touch Orientation Events"  */&lt;br /&gt;				document.getElementById("currentOrientation").innerHTML="Now in portrait orientation (Home button on the bottom).";&lt;br /&gt;				break;	&lt;br /&gt;				&lt;br /&gt;		case 90:&lt;br /&gt;				/* If in landscape mode with the screen turned to the left, sets the body's class attribute to landscapeLeft. In this case, all style definitions matching the&lt;br /&gt;				   body[class="landscapeLeft"] declaration in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */&lt;br /&gt;				document.body.setAttribute("class","landscapeLeft");&lt;br /&gt;				&lt;br /&gt;				document.getElementById("currentOrientation").innerHTML="Now in landscape orientation and turned to the left (Home button to the right).";&lt;br /&gt;				break;&lt;br /&gt;		&lt;br /&gt;		case -90:	&lt;br /&gt;				/* If in landscape mode with the screen turned to the right, sets the body's class attribute to landscapeRight. Here, all style definitions matching the &lt;br /&gt;				   body[class="landscapeRight"] declaration in the iPhoneOrientation.css file will be selected and used to style "Handling iPhone or iPod touch Orientation Events". */&lt;br /&gt;				document.body.setAttribute("class","landscapeRight");&lt;br /&gt;				&lt;br /&gt;				document.getElementById("currentOrientation").innerHTML="Now in landscape orientation and turned to the right (Home button to the left).";&lt;br /&gt;				break;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Point to the updateOrientation function when iPhone switches between portrait and landscape modes.&lt;br /&gt;window.onorientationchange=updateOrientation;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Source: http://developer.apple.com/samplecode/iPhone/idxSafari-date.html&lt;br /&gt;( &lt;a href="http://www.ab-d.fr/"&gt;AB-D&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Sat, 22 Dec 2007 12:53:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4912</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
    <item>
      <title>count() in JavaScript</title>
      <link>http://snippets.dzone.com/posts/show/4865</link>
      <description>The same function as &lt;a href="http://www.php.net/count"&gt;count()&lt;/a&gt; in php.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Array.prototype.count = function() {&lt;br /&gt;	return this.length;&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Sample :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var v_array = [ 5, 10, 15, 20, 25];&lt;br /&gt;document.writeln(v_array.count());  // 5&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ab-d.fr/"&gt;Source: AB-D.fr&lt;/a&gt;</description>
      <pubDate>Sat, 08 Dec 2007 13:11:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4865</guid>
      <author>ki4ngel (Benoit Asselin)</author>
    </item>
  </channel>
</rss>
