<?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>WiseCodes &#187; JAVA</title>
	<atom:link href="http://www.wisecodes.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wisecodes.com</link>
	<description>Bringing You The Power of Code !!</description>
	<lastBuildDate>Wed, 01 Sep 2010 19:33:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>What&#8217;s New in the compiler of the JDK 7</title>
		<link>http://www.wisecodes.com/2009/09/whats-new-in-the-compiler-of-the-jdk-7/</link>
		<comments>http://www.wisecodes.com/2009/09/whats-new-in-the-compiler-of-the-jdk-7/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 16:11:37 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[JDK 7]]></category>
		<category><![CDATA[Learn]]></category>

		<guid isPermaLink="false">http://www.wisecodes.com/?p=831</guid>
		<description><![CDATA[Darcy Joseph tells us of the developments that have the compiler in JDK 7. They are usually minor changes discussed at the forums, which include various amenities in the language syntax. The news of the JDK 7 will be: Switch to objects of type String Automatic resource management Improved type inference for the creation of [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a rel="attachment wp-att-833" href="http://www.wisecodes.com/2009/09/whats-new-in-the-compiler-of-the-jdk-7/javalogo_060909/"><img class="aligncenter size-full wp-image-833" title="JavaLogo_060909" src="http://www.wisecodes.com/wp-content/uploads/2009/09/JavaLogo_060909.jpg" alt="JavaLogo_060909" width="450" height="54" /></a></p>
<p>Darcy Joseph tells us of the <strong><a href="http://blogs.sun.com/darcy/entry/project_coin_final_five" target="_blank">developments that have the compiler in JDK 7</a></strong>. They are usually minor changes discussed at the forums, which include various amenities in the language syntax.</p>
<p>The news of the JDK 7 will be:</p>
<ul>
<li>Switch to objects of type String</li>
<li>Automatic resource management</li>
<li>Improved type inference for the creation of Generics</li>
<li>Invocation of methods with varargs simplified</li>
<li>Improvements in numeric literals</li>
<li>Language Support for Collections</li>
<li>Language support for JSR 292</li>
</ul>
<p>Let&#8217;s see in detail these features.</p>
<h2>Switch to objects of type String</h2>
<p>It will be possible to use the switch operator with objects of type String. This will avoid potential &#8220;if-then-else&#8221;. So this new feature would allow us to:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code11'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83111"><td class="code" id="p831code11"><pre class="java" style="font-family:monospace;">  <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> s <span style="color: #339933;">=</span> ...
  <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;A1&quot;</span><span style="color: #339933;">:</span>
      processA1 <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// And continue ...</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;A2&quot;</span><span style="color: #339933;">:</span>
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;A3&quot;</span><span style="color: #339933;">:</span>
      processA2A3 <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;A4&quot;</span>
       processA4 <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// And continue ...</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
      processDefault <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Automatic resource management</h2>
<p>A &#8220;resource&#8221; is an object that must be closed manually, such as java.io.InputStream, OutputStream, Reader, Writer, Formatter;<br />
java.nio.Channel; java.net.Socket; java.sql.Connection, Statement, ResultSet among others. These resources are usually open in a try block and close in a finally.</p>
<p>Recursos automatic management is a special form of the operator where you try one or more state resources. The scope of these resources is limited to the block. When the block ends, either normally or abruptly, all declared resources are automatically closed.</p>
<p>The main advantage is that it eliminates the need for manual closing, and it causes errors. Furthermore, it &#8220;prevents&#8221; the second exception (the close ()), always leaving the exception of the block that is usually more interesting.</p>
<p>An example usage would be:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code12'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83112"><td class="code" id="p831code12"><pre class="java" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> readFirstLineFromFile<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> path<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">IOException</span></a> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abufferedreader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BufferedReader</span></a> br <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abufferedreader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BufferedReader</span></a><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afilereader+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">FileReader</span></a><span style="color: #009900;">&#40;</span>path<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
           <span style="color: #000000; font-weight: bold;">return</span> br.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>As we see, the try block () declares a resource, is then used within the block. When finished, it closes automatically. It is also possible to declare more than one resource:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code13'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83113"><td class="code" id="p831code13"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InputStream</span></a> in <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afileinputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">FileInputStream</span></a><span style="color: #009900;">&#40;</span>src<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aoutputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">OutputStream</span></a> out <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afileoutputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">FileOutputStream</span></a><span style="color: #009900;">&#40;</span>destination<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> buf <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">8192</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">int</span> n<span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">=</span> in.<span style="color: #006633;">read</span><span style="color: #009900;">&#40;</span>buf<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
                out.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>buf, <span style="color: #cc66cc;">0</span>, n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Improved type inference for the creation of Generics</h2>
<p>This also includes the possibility to infer the types for instantiation using Generics. In cases parameterized types are obvious from the context, this parameter in the constructor can be omitted and replaced with an empty set &lt;&gt;.</p>
<p>For example, the following line:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code14'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83114"><td class="code" id="p831code14"><pre class="java" style="font-family:monospace;"> Map<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span> testmap <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>can be replaced by:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code15'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83115"><td class="code" id="p831code15"><pre class="java" style="font-family:monospace;">Map<span style="color: #339933;">&lt;</span>String, List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> testmap <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>Improvements in numeric literals</h2>
<p>Just as we can declare decimal numeric literals, octal and hexadecimal literals now we can declare binary. This is very useful in certain areas. For this, use the prefix 0b, which is also the same compilers that use C / C + +, Ruby and Python. For example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code16'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83116"><td class="code" id="p831code16"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// A literal 'byte' 8-bit</span>
<span style="color: #000066; font-weight: bold;">byte</span> wcByte <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span>0b00100101<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// A literal 'short' 16-bit</span>
<span style="color: #000066; font-weight: bold;">short</span> wcShort <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">short</span><span style="color: #009900;">&#41;</span>0b1010000101010101<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//  More literal 'int' of 32-bit 'int'</span>
<span style="color: #000066; font-weight: bold;">int</span> wcInt1 <span style="color: #339933;">=</span> 0b10100001010001011010000101000101<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> wcInt2 <span style="color: #339933;">=</span> 0b101<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>These variables are then used normally, for example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code17'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83117"><td class="code" id="p831code17"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> A2 <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The decimal value of 10100101 is &quot;</span> <span style="color: #339933;">+</span> 0b10100101<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>On the other hand, added the possibility to use an underscore (_) separator of numbers, to facilitate the reading of them. Thus, the compiler will ignore the character &#8220;_&#8221; when used in numeric literals. For example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code18'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83118"><td class="code" id="p831code18"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">int</span> numberOfTelephone <span style="color: #339933;">=</span> <span style="color: #cc66cc;">757</span>_757_7575<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">long</span> CreditCard <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1234</span>_5678_9123_4567L<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">long</span> bundle <span style="color: #339933;">=</span> <span style="color: #cc66cc;">777</span>_77_7575L<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">float</span> money <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span>_345_132.75<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">long</span> hexBytes <span style="color: #339933;">=</span> 0xFF_EC_AE_5E<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">long</span> hexWords <span style="color: #339933;">=</span> 0xFFEC_AE5E<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">long</span> maxLong <span style="color: #339933;">=</span> 0x7fff_ffff_ffff_ffffL<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">long</span> bytes <span style="color: #339933;">=</span> 0b11010010_01101001_10010101_10010010<span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>Language Support for Collections</h2>
<p>It adds language support to treat like Arrays Collection.</p>
<p>For example, you can write the following to declare an immutable List:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code19'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83119"><td class="code" id="p831code19"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Alist+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">List</span></a> wcDigits <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">4</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">9</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">6</span>, <span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>It will also be possible to access lists and maps using array syntax:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p831code20'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p83120"><td class="code" id="p831code20"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> arguments<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Alist+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">List</span></a> wcArrayList <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aarrays+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Arrays</span></a>.<span style="color: #006633;">asList</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;a&quot;</span>,<span style="color: #0000ff;">&quot;b&quot;</span>,<span style="color: #0000ff;">&quot;c&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> fristElement <span style="color: #339933;">=</span> wcArrayList<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>
&nbsp;
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Amap+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Map</span></a> testmap <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashmap+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">HashMap</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    testmap<span style="color: #009900;">&#91;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;One&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Language support for JSR 292</h2>
<p>This low-level change made minor changes to the Java language to be simpler to work with some features of the JVM. This will allow Java code to interoperate and / or implement libraries in other languages. That is, will ensure greater integration between Java and code in other languages. For more information read the proposal of <strong><a href="http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001131.html" target="_blank">support for JSR 292</a></strong>.</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/09/whats-new-in-the-compiler-of-the-jdk-7/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/09/whats-new-in-the-compiler-of-the-jdk-7/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/09/whats-new-in-the-compiler-of-the-jdk-7/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The 10 most important skills for future programmers</title>
		<link>http://www.wisecodes.com/2009/09/the-10-most-important-skills-for-future-programmers/</link>
		<comments>http://www.wisecodes.com/2009/09/the-10-most-important-skills-for-future-programmers/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 14:34:27 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Domain]]></category>
		<category><![CDATA[Future]]></category>
		<category><![CDATA[Humman Skills]]></category>
		<category><![CDATA[Hygiene]]></category>
		<category><![CDATA[Important]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Porgrammers]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Skills]]></category>
		<category><![CDATA[Web Devlopment]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.wisecodes.com/?p=824</guid>
		<description><![CDATA[It is important to ensure that we are benefiting as much as possible when we invest time and effort to train and learn new things. The following list will see the 10 we should learn skills that our curriculum is relevant for the next 5 years. This list is not complete and covers some niche [...]]]></description>
			<content:encoded><![CDATA[<p>It is important to ensure that we are benefiting as much as possible when we invest time and effort to train and learn new things.</p>
<p>The following list will see the 10 we should learn skills that our curriculum is relevant for the next 5 years. This list is not complete and covers some niche markets (such as mainframes). However, if you learn at least seven items in this list you will not miss it.</p>
<h2>1. One of the &#8220;Big 3&#8243; (Java, . NET &amp; PHP)</h2>
<p>Barring a radical change in the world of development (such as an asteroid falling on Redmond), most developers will need to know any of the three major systems development: Java,. NET (VB.NET or C #) or PHP. Nor enough to know the main language. As projects grow and are grabbing more functionality, we will need to know the frameworks and libraries associated with depth.</p>
<h2>2. Rich Internet Applications (RIA &#8211; Rich Internet Applications)</h2>
<p>They can love or hate, but in recent years, Flash is being used for something other than funny animations. Flash also gained additional functionality in the form of Flex and AIR. Competitors of Flash, as JavaFX and Silverlight are also improving in performance. The browsers are improving their JavaScript engine, which is emerging as a web application platform. To make things more complicated, HTML 5 is going to incorporate lots of RIA functionality, including connection to the database, thus the formal seal of the W3C to AJAX. In the near future, have experience of RIA will be a determining factor in our curriculum.</p>
<h2>3. Web Development</h2>
<p>Web development will not disappear in the future. Many developers were happy so far ignored the web, or just staying with &#8220;the basics&#8221; that gave them their framework. But companies are demanding more and more to those who really know how to work with the underlying technologies. So we should improve our knowledge of JavaScript, CSS and HTML to succeed in the next five years.</p>
<h2>4. Web Services</h2>
<p>&#8220;REST or SOAP? JSON or XML? Although the election and the answers depend on the project, it is increasingly difficult to be a developer without having to consume Web Services (even if our development is not a Web application). Even the land area used to be ODBC, COM or RPC are now moving to Web services of some kind. Developers who can not work with Web services will end up relegated to maintenance on legacy code.</p>
<h2>5. Human skills</h2>
<p>There is a trend that has occurred some time ago: the increasing visibility of IT within and outside the organization. The developers are taking more and more meetings that are not development and process for obtaining feedback from them. For example, the CFO can not change the accounting rules without working with IT to update the system. And an operations manager can not change the process of call without IT center update the CRM work-flow. Similarly, customers often need to work directly with development teams to ensure their needs are met. Will it be necessary for all developers to consider how to win friends and influence people? No. But the developers that they will do will be much more valuable to their employers &#8211; and are highly sought after in the market.</p>
<h2>6. A dynamic programming language and / or functional</h2>
<p>Languages like Ruby, Python, F # and Groovy are not yet very popular &#8211; but so are the ideas behind them. For example, the LINQ system. NET is a direct descendant of functional programming techniques. Both Ruby and Python are becoming increasingly popular in some quarters, thanks to the Rails framework and Silverlight respectively. Learn one of these languages will not only improve our curriculum, but also will expand our horizon. All great developers recommend learning at least one dynamic or functional languages to make learning new ways of thinking.</p>
<h2>7. Agile Methodologies</h2>
<p>As time passes, the ideas behind Agile become more defined and better expressed. Many organizations are adopting Agile or proofs of concept for doing Agile. Although Agile is no silver bullet to avoid failure in a project definitely has its place in many projects. Developers who have experience in working and understanding Agile environments will be increasingly in demand in the next five years.</p>
<h2>8. Domain Knowledge</h2>
<p>Hand in hand with the agile methodologies, development teams are increasingly viewed partners in the project definition. This means that developers who understand the problem domain will be able to contribute to the project in a very visible and valuable. With Agile, a developer can say &#8220;From here, we can very easily add this functionality, and you get great value,&#8221; or &#8220;Hey, this requirement is not in keeping with the pattern of use that the logs show. No matter how many developers resist the idea of knowing anything about the problem domain, it is undeniable that more and more organizations prefer (if not even require) developers to at least understand the basics of the business.</p>
<h2>9. &#8220;Hygiene&#8221; development</h2>
<p>Until a few years ago, many (if not all) organizations had no access to bug tracking systems, version control and other tools, all developers are summarized and their preferred IDE. But thanks to the creation of new integrated development environments and the explosion of free software environments of high quality, since there are almost no organizations without these tools. Developers have to know much more than just do a checkout of the code. You need to have a rigorous hygiene habits to ensure they are properly coordinated with the team. The &#8220;solitary programmers&#8221; that keep everything local, non-document changes and others will not be welcome in traditional organizations, and will be aa directly out of place in Agile environments, where you use a strong coordination between equipment to operate.</p>
<h2>10. Mobile Development</h2>
<p>During the late 1990 web development grew and gained widespread adoption, so begin to displace traditional desktop applications. In 2008, development for mobile devices eventually took off, and over the next five years will grow steadily. Of course, there are several approaches to mobile development: web applications designed to run on mobile devices, RIAs aimed at this market, and applications that run directly on the devices. No matter what path we choose, we will serve add mobile development skills to our group.</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/09/the-10-most-important-skills-for-future-programmers/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/09/the-10-most-important-skills-for-future-programmers/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/09/the-10-most-important-skills-for-future-programmers/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>FTP connection with JAVA</title>
		<link>http://www.wisecodes.com/2009/08/ftp-connection-with-java/</link>
		<comments>http://www.wisecodes.com/2009/08/ftp-connection-with-java/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 19:29:39 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[OpenSource]]></category>

		<guid isPermaLink="false">http://www.wisecodes.com/?p=806</guid>
		<description><![CDATA[Java again gives us another tool. What is FTP? FTP protocol that allows us to send or receive data from one point to another, be it a PC, server, or any other node that is connected to a network. Usually when you have a web host these accounts have FTP congratulate sending files from our pc [...]]]></description>
			<content:encoded><![CDATA[<p>Java again gives us another tool.</p>
<p><strong>What is FTP?</strong></p>
<p>FTP protocol that allows us to send or receive data from one point to another, be it a PC, server, or any other node that is connected to a network.</p>
<p>Usually when you have a web host these accounts have FTP congratulate sending files from our pc to the server that is hosting our site.</p>
<p>Investigating around I found a FTP client library very useful, I have tried it and going great. The library <strong><a href="http://jvftp.sourceforge.net/">JvFTP</a></strong><strong><a href="http://jvftp.sourceforge.net/"> Client</a></strong> provides interesting tasks, including:</p>
<ul>
<li>Uploading / downloading files</li>
<li>Uploading directories recursively</li>
<li>Concurrent data transfer</li>
<li>Data transfer mode passive / active</li>
<li>Swing components to display directories</li>
<li>Components AWTpara display directories</li>
</ul>
<p>This tool is available in <strong><a href="http://sourceforge.net/projects/jvftp/">jvftp</a></strong> and can be used in two ways, you run directly the jar, or do your own programming, including the libraries in your project.</p>
<p>If you want to program your own example here I leave a little guide on how you can do, let&#8217;s see &#8230;</p>
<p>&#8230; The first thing to do is incorporate the packages downloaded from jvftp in your project. Then you import the libraries to the class in which you make the connection:</p>
<pre class="brush: java;">
import cz.dhl.io.*;
import cz.dhl.ftp.*;
import java.io.IOException;
</pre>
<p>Now we create the connection, the connection to prepare the data before creating access the FTP site. Let&#8217;s start with the server:</p>
<pre class="brush: java;">
FtpConnect cn = FtpConnect.newConnect(&quot;ftp://ftp.domain.com&quot;);
</pre>
<p>ftp.domain.com value which is the server you are connecting. Each ftp account that include at least the server name, username and password. To log in using that account is something like this:</p>
<pre class="brush: java;">
// Username
cn.setUserName(&quot;username&quot;);

// Password
cn.setPassWord(&quot;password&quot;);
</pre>
<p>Then it creates an object of type FTP, which is responsible for rendering all the information from our FTP site.</p>
<pre class="brush: java;">
Ftp ftp1 = new Ftp();
</pre>
<p>Now the connection to the FTP site to begin processing the respective tasks</p>
<pre class="brush: java;">
ftp1.connect(cn);
</pre>
<p>A practical example to test the connection would be to show the current directory with their files:</p>
<pre class="brush: java;">
CoFile dir = new FtpFile(ftp1.pwd(), ftp1);

// Make a list of files that have the current directory
CoFile cfls[] = dir.listCoFiles();
if ( cfls != null )
        for (int n = 0; n &lt; cfls.length; n++)
                    System.out.println( cfls[n].getName() + (cfls[n].isDirectory() ? &quot;/&quot; : &quot;&quot;));
</pre>
<p>Finally, there is only close the connection.</p>
<pre class="brush: java;">
ftp1.disconnect();
</pre>
</pre>
<p>Download <a href="http://sourceforge.net/projects/jvftp/"><strong>jvftp</strong></a></p>
<p>Happy Programming!!! <img src='http://www.wisecodes.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/08/ftp-connection-with-java/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/08/ftp-connection-with-java/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/08/ftp-connection-with-java/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Print PDF with JPedal</title>
		<link>http://www.wisecodes.com/2009/08/print-pdf-with-jpedal/</link>
		<comments>http://www.wisecodes.com/2009/08/print-pdf-with-jpedal/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 16:08:43 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.wisecodes.com/?p=776</guid>
		<description><![CDATA[Researching a bit about the handling of a PDF document I found a library called JPedal for manipulating PDF documents from Java. Like other libraries I&#8217;ve seen among other iText and iReport, which are very comprehensive and allow you to do many tasks, including printing. Disadvantage that the latter is that you need to have [...]]]></description>
			<content:encoded><![CDATA[<p>Researching a bit about the handling of a PDF document I found a library called <strong><a href="http://www.jpedal.org/index.php">JPedal</a></strong> for manipulating PDF documents from Java.<br />
Like other libraries I&#8217;ve seen among other iText and iReport, which are very comprehensive and allow you to do many tasks, including printing. Disadvantage that the latter is that you need to have installed Acrobat Reader and for many users this is not possible.<br />
But even with JPedal lets you see the Acrobat Reader tools within the Java application, providing a task pane for the PDF to manipulate.</p>
<p>With PrinterJob.lookupPrintServices can get the services available and print them PrinterJob a concrete one.</p>
<pre class="brush: java;">
PrintService[] psService = PrinterJob.lookupPrintServices();
PrinterJob pjPrintJob = PrinterJob.getPrinterJob();
pjPrintJob.setPrintService(psService[0]);

// Assigns the size of the paper to A4.

Paper paper = new Paper();
paper.setSize(595, 842);
paper.setImageableArea(0, 0, 595, 842);
PageFormat pf = pjPrintJob.defaultPage();
pf.setPaper(paper);
</pre>
<p>Loads the PDF to be printed. The file is called wc_PDF.pdf printed and given format.</p>
<pre class="brush: java;">
PdfDecoder pdfD = null;
pdfD = new PdfDecoder(true);
pdfD.openPdfFile(&quot;wc_PDF.pdf&quot;);
pdfD.setPageFormat(pf);
</pre>
<p>It sends the file to print</p>
<pre class="brush: java;">
printJob.setPageable(pdfD);
printJob.print();
</pre>
<p>And to finalize the document is closed.</p>
<pre class="brush: java;">
pdf.closePdfFile();
</pre>
<p><strong><a href="http://www.jpedal.org/index.php">Download JPedal..</a></strong></p>
<p>The example would then complete as follows:</p>
<pre class="brush: java;">
import java.awt.print.Paper;
import java.awt.print.PrinterJob;
import java.awt.print.PageFormat;
import javax.print.PrintService;
import org.jpedal.PdfDecoder;

public final void wc_PrintPDF() {
    PdfDecoder pdfD = null;
    try {
        PrintService[] psService = PrinterJob.lookupPrintServices();
        PrinterJob pjPrintJob = PrinterJob.getPrinterJob();
        pjPrintJob.setPrintService(psService[0]);

        Paper paper = new Paper();
        paper.setSize(595, 842);
        paper.setImageableArea(0, 0, 595, 842);
        PageFormat pf = pjPrintJob.defaultPage();
        pf.setPaper(paper);

        pdfD = new PdfDecoder(true);
        pdfD.openPdfFile(&quot;wc_PDF.pdf&quot;);
        pdfD.setPageFormat(pf);

        pjPrintJob.setPageable(pdfD);
        pjPrintJob.print();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        pdfD.closePdfFile();
    }
}
</pre>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/08/print-pdf-with-jpedal/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/08/print-pdf-with-jpedal/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/08/print-pdf-with-jpedal/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Java: Get the IP address of a website.</title>
		<link>http://www.wisecodes.com/2009/05/java-get-the-ip-address-of-a-website/</link>
		<comments>http://www.wisecodes.com/2009/05/java-get-the-ip-address-of-a-website/#comments</comments>
		<pubDate>Mon, 25 May 2009 18:29:25 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[OpenSource]]></category>

		<guid isPermaLink="false">http://www.wisecodes.com/?p=503</guid>
		<description><![CDATA[Trouble You need to get the IP address of a website using your domain name. Solution Use the method InetAddress.getByName(String host) to library java.net.InetAddress Code /** * * @author VenuThomas */ import java.net.InetAddress; import java.net.UnknownHostException; public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Trouble</strong></p>
<p>You need to get the IP address of a website using your domain name.</p>
<p><strong>Solution</strong></p>
<p>Use the method InetAddress.getByName(String host) to library java.net.InetAddress</p>
<p><strong><em>Code</em></strong></p>
<pre class="brush: java;">
/**
 *
 * @author VenuThomas
 */
import java.net.InetAddress;
import java.net.UnknownHostException;

public class Main {

 /**
 * @param args the command line arguments
 */
 public static void main(String[] args) {
 // TODO code application logic here
 try {
 InetAddress address = InetAddress.getByName(&quot;www.google.com&quot;);

 // Output: www.google.com/74.125.45.100
 System.out.println(address);

 } catch (UnknownHostException e) {
 System.out.println(&quot;Could not find www.google.com&quot;);
 }
 }
}
</pre>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/05/java-get-the-ip-address-of-a-website/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/05/java-get-the-ip-address-of-a-website/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/05/java-get-the-ip-address-of-a-website/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java: Change To Uppercase/Lowercase A String</title>
		<link>http://www.wisecodes.com/2009/05/java-change-to-uppercaselowercase-a-string/</link>
		<comments>http://www.wisecodes.com/2009/05/java-change-to-uppercaselowercase-a-string/#comments</comments>
		<pubDate>Mon, 25 May 2009 18:15:54 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[OpenSource]]></category>

		<guid isPermaLink="false">http://www.wisecodes.com/?p=500</guid>
		<description><![CDATA[Trouble Looking for a change to case-insensitive string. Solution Use the methods toUpperCase() or toLowerCase() of class String public class Main { public static void main(String[] args) { // define the string String cad = &#34;Welcome to WiseCodes.Com&#34;; // string to uppercase // OUTPUT: WELCOME TO WISECODES.COM ... String cad_uppr = cad.toUpperCase(); System.out.println(cad_uppr); // string [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Trouble</strong></p>
<p>Looking for a change to case-insensitive string.</p>
<p><strong>Solution</strong></p>
<p>Use the methods toUpperCase() or toLowerCase() of class String</p>
<pre class="brush: java;">
public class Main {
public static void main(String[] args) {

// define the string
String cad = &quot;Welcome to WiseCodes.Com&quot;;

// string to uppercase
// OUTPUT: WELCOME TO WISECODES.COM ...
String cad_uppr = cad.toUpperCase();
System.out.println(cad_uppr);

// string to lowercase
// OUTPUT: welcome to wisecodes.com ...
String cad_lowr = cad.toLowerCase();
System.out.println(cad_lowr);

}
}
</pre>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/05/java-change-to-uppercaselowercase-a-string/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/05/java-change-to-uppercaselowercase-a-string/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/05/java-change-to-uppercaselowercase-a-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Develop JavaFX Application And Win!!</title>
		<link>http://www.wisecodes.com/2009/03/develop-javafx-application-and-win/</link>
		<comments>http://www.wisecodes.com/2009/03/develop-javafx-application-and-win/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 16:00:04 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[Prize]]></category>

		<guid isPermaLink="false">http://www.code.venuthomas.net/?p=237</guid>
		<description><![CDATA[Develop an application in JavaFX and win cool prizes !! Compete in JavaFX  coding by &#8220;JavaFX Coding Challenge&#8221;  The deadline is May 29. 1st Place: $25,000 2nd Place: $10,000 3rd Place: $5,000 Student category: Three prizes at $1,500 each to the top three applications submitted by students Deadlines Contest starts: March 23rd, 2009 Contest deadline: [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="JavaFX" src="http://blogs.sun.com/tor/resource/Javafx-logo.png" alt="" width="196" height="91" /></p>
<p>Develop an application in JavaFX and win cool prizes !!<br />
Compete in JavaFX  coding by &#8220;JavaFX Coding Challenge&#8221;  The deadline is May 29.</p>
<ul>
<li>1st Place: $25,000</li>
</ul>
<ul>
<li> 2nd Place: $10,000</li>
</ul>
<ul>
<li> 3rd Place: $5,000</li>
</ul>
<p>S<strong>tudent category: </strong>Three prizes at $1,500 each to the top three applications submitted by students</p>
<p><span style="text-decoration: underline;"><strong>Deadlines</strong></span></p>
<ul>
<li> Contest starts: March 23rd, 2009</li>
</ul>
<ul>
<li> Contest deadline: May 29th, 2009</li>
</ul>
<ul>
<li> Judging period: June 1st – June 29th, 2009</li>
</ul>
<ul>
<li> Winners announced: Week of June 29th, 2009</li>
</ul>
<h4><a href="http://javafx.com/challenge/" target="_blank">Click Here.. http://javafx.com/challenge/</a></h4>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/develop-javafx-application-and-win/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/develop-javafx-application-and-win/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/03/develop-javafx-application-and-win/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Validate: Username, Email Id, Phone No, Zip Code &amp; URL In 5 Languages(JS, C#.Net, VB.Net, JAVA &amp; PHP)</title>
		<link>http://www.wisecodes.com/2009/03/validate-username-email-id-phone-no-zip-code-url-in-5-languages/</link>
		<comments>http://www.wisecodes.com/2009/03/validate-username-email-id-phone-no-zip-code-url-in-5-languages/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 14:23:09 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[JAVASCRIPT]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Learn]]></category>

		<guid isPermaLink="false">http://www.code.venuthomas.net/?p=225</guid>
		<description><![CDATA[Validate of Username, Email Id, Phone No, Zip/Postal Code &#38; URL In Javascript, C#.Net, VB.Net, JAVA &#38; PHP ! 1. Validate username: Validate alpha numeric values 2. Validate email addresses : example@domain.com 3. Validate Phone numbers: Validate US phone number eg: 123-456-7890 4. Validate Zip/Postal Codes: Validate US Zip/Postal Code eg: 12345-6789 5. Validate Domain [...]]]></description>
			<content:encoded><![CDATA[<p>Validate of Username, Email Id, Phone No, Zip/Postal Code &amp; URL In Javascript, C#.Net, VB.Net, JAVA &amp; PHP !</p>
<p>1. Validate username: Validate alpha numeric values<br />
2. Validate email addresses : example@domain.com<br />
3. Validate Phone numbers: Validate US phone number eg: 123-456-7890<br />
4. Validate Zip/Postal Codes: Validate US Zip/Postal Code eg: 12345-6789<br />
5. Validate Domain Name eg: http://live.com</p>
<h2>Validate username: Validate alpha numeric values </h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code46'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22546"><td class="code" id="p225code46"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> is_valid_username<span style="color: #009900;">&#40;</span>str_username<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #003366; font-weight: bold;">var</span> filter <span style="color: #339933;">=</span> <span style="color: #009966; font-style: italic;">/^([a-zA-Z\s0-9]*)$/</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>filter.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>str_username<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>’Wrong username format.’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Username format is ok.'</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code47'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22547"><td class="code" id="p225code47"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text.RegularExpressions</span><span style="color: #008000;">;</span>
&nbsp;
 <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> is_valid_username<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> str_username<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Regex matchRegex <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;^[a-zA-Z0-9_]{3,16}$&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 MatchCollection matches  <span style="color: #008000;">=</span> matchRegex<span style="color: #008000;">.</span><span style="color: #0000FF;">Matches</span><span style="color: #008000;">&#40;</span>str_username<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>matches<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">==</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Wrong username format.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Wrong username format.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0600FF; font-weight: bold;">else</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Username format is ok.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Username format is ok.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code48'); return false;">View Code</a> VBNET</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22548"><td class="code" id="p225code48"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">RegularExpressions</span>
&nbsp;
<span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> is_valid_username<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> str_username <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matchRegex <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Regex<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;^[a-zA-Z0-9_]{3,16}$&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matches <span style="color: #FF8000;">As</span> MatchCollection <span style="color: #008000;">=</span> matchRegex.<span style="color: #0000FF;">Matches</span><span style="color: #000000;">&#40;</span>str_username<span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">If</span> matches.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Wrong username format.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Wrong username format.&quot;); 'In Windows Form</span>
    <span style="color: #FF8000;">Else</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Username format is ok.&quot;</span><span style="color: #000000;">&#41;</span>    <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Username format is ok.&quot;); 'In Windows Form</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code49'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22549"><td class="code" id="p225code49"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> is_valid_username
<span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> str_username<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 Pattern p<span style="color: #339933;">=</span>Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;^[A-Za-z0-9]+$&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 Matcher m<span style="color: #339933;">=</span>p.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>str_username<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">boolean</span> matchFound <span style="color: #339933;">=</span> m.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>matchFound<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Username format is ok.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000000; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Wrong username format.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code50'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22550"><td class="code" id="p225code50"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">Function</span> is_valid_username<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str_username</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^[a-z\d_]{5,20}$/i'</span><span style="color: #339933;">,</span><span style="color: #000088;">$str_username</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Username format is ok.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Wrong username format.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Validate email addresses : example@domain.com </h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code51'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22551"><td class="code" id="p225code51"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> is_valid_email<span style="color: #009900;">&#40;</span>str_email_id<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #003366; font-weight: bold;">var</span> filter <span style="color: #339933;">=</span> <span style="color: #009966; font-style: italic;">/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>filter.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>str_email_id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>’Wrong email address format.’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Email address format is ok.'</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code52'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22552"><td class="code" id="p225code52"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text.RegularExpressions</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> is_valid_email<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> email_id<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Regex matchRegex <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,5}&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 MatchCollection matches  <span style="color: #008000;">=</span> matchRegex<span style="color: #008000;">.</span><span style="color: #0000FF;">Matches</span><span style="color: #008000;">&#40;</span>email_id<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>matches<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">==</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Wrong email address format.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Wrong email address format.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0600FF; font-weight: bold;">else</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Email address format is ok.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Email address format is ok.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code53'); return false;">View Code</a> VBNET</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22553"><td class="code" id="p225code53"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">RegularExpressions</span>
&nbsp;
<span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> is_valid_email<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> email_id <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matchRegex <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Regex<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,5}&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matches <span style="color: #FF8000;">As</span> MatchCollection <span style="color: #008000;">=</span> matchRegex.<span style="color: #0000FF;">Matches</span><span style="color: #000000;">&#40;</span>email_id<span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">If</span> matches.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Wrong email address format.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Wrong email address format.&quot;); 'In Windows Form</span>
    <span style="color: #FF8000;">Else</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Email address format is ok.&quot;</span><span style="color: #000000;">&#41;</span>    <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Email address format is ok.&quot;); 'In Windows Form</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code54'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22554"><td class="code" id="p225code54"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> is_valid_email
<span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> str_email_id<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 Pattern p<span style="color: #339933;">=</span>Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[a-zA-Z]*[0-9]*@[a-zA-Z]*.[a-zA-Z]*&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 Matcher m<span style="color: #339933;">=</span>p.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>str_email_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">boolean</span> matchFound <span style="color: #339933;">=</span> m.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>matchFound<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Email address format is ok.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000000; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Wrong email address format.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code55'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22555"><td class="code" id="p225code55"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">Function</span> is_valid_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email_id</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/'</span><span style="color: #339933;">,</span><span style="color: #000088;">$email_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Email address format is ok.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Wrong email address format.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2><strong>Validate Phone numbers: Validate US phone number eg: 123-456-7890</strong></h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code56'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22556"><td class="code" id="p225code56"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> is_valid_phone_no<span style="color: #009900;">&#40;</span>str_phone_no<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #003366; font-weight: bold;">var</span> filter <span style="color: #339933;">=</span>  <span style="color: #009966; font-style: italic;">/^((\+?1-)?\d\d\d-)?\d\d\d-\d\d\d\d$/</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>filter.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>str_phone_no<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>’Wrong phone number format.’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Phone number format is ok.'</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code57'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22557"><td class="code" id="p225code57"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text.RegularExpressions</span><span style="color: #008000;">;</span>
&nbsp;
 <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> is_valid_phone_no<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> str_phone_no<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Regex matchRegex <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;\d{3}-\d{3}-\d{4}$&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 MatchCollection matches  <span style="color: #008000;">=</span> matchRegex<span style="color: #008000;">.</span><span style="color: #0000FF;">Matches</span><span style="color: #008000;">&#40;</span>str_phone_no<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>matches<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">==</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Wrong phone number format.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Wrong phone number format.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0600FF; font-weight: bold;">else</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Phone number format is ok.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Phone number format is ok.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code58'); return false;">View Code</a> VBNET</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22558"><td class="code" id="p225code58"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">RegularExpressions</span>
<span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> is_valid_phone_no<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> str_phone_no <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matchRegex <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Regex<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;\d{3}-\d{3}-\d{4}$&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matches <span style="color: #FF8000;">As</span> MatchCollection <span style="color: #008000;">=</span> matchRegex.<span style="color: #0000FF;">Matches</span><span style="color: #000000;">&#40;</span>str_phone_no<span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">If</span> matches.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Wrong phone number format.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Wrong phone number format.&quot;); 'In Windows Form</span>
    <span style="color: #FF8000;">Else</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Phone number format is ok.&quot;</span><span style="color: #000000;">&#41;</span>    <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Phone number format is ok.&quot;); 'In Windows Form</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code59'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22559"><td class="code" id="p225code59"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> is_valid_phone_no
<span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> str_phone_no<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 Pattern p<span style="color: #339933;">=</span>Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;^<span style="color: #000099; font-weight: bold;">\\</span>(?(<span style="color: #000099; font-weight: bold;">\\</span>d{3})<span style="color: #000099; font-weight: bold;">\\</span>)?[- ]?(<span style="color: #000099; font-weight: bold;">\\</span>d{3})[- ]?(<span style="color: #000099; font-weight: bold;">\\</span>d{4})$&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 Matcher m<span style="color: #339933;">=</span>p.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>str_phone_no<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">boolean</span> matchFound <span style="color: #339933;">=</span> m.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>matchFound<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Phone number format is ok.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000000; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Wrong phone number format.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code60'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22560"><td class="code" id="p225code60"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">Function</span> is_valid_phone_no<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str_phone_no</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/x'</span><span style="color: #339933;">,</span><span style="color: #000088;">$str_phone_no</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Phone number format is ok.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Wrong phone number format.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Validate Zip/Postal Codes: Validate US Zip/Postal Code eg: 12345-6789</h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code61'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22561"><td class="code" id="p225code61"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> is_valid_zip_code<span style="color: #009900;">&#40;</span>str_zip_code<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #003366; font-weight: bold;">var</span> filter <span style="color: #339933;">=</span>  <span style="color: #009966; font-style: italic;">/^\d\d\d\d\d-\d\d\d\d$/</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>filter.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>str_zip_code<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>’Wrong Zip<span style="color: #339933;">/</span>Postal Code format.’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Zip/Postal Code format is ok.'</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code62'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22562"><td class="code" id="p225code62"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text.RegularExpressions</span><span style="color: #008000;">;</span>
&nbsp;
 <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> is_valid_zip_code<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> str_zip_code<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Regex matchRegex <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;\d{5}-\d{4}$&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 MatchCollection matches  <span style="color: #008000;">=</span> matchRegex<span style="color: #008000;">.</span><span style="color: #0000FF;">Matches</span><span style="color: #008000;">&#40;</span>str_zip_code<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>matches<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">==</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Wrong Zip/Postal Code format.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Wrong Zip/Postal Code format.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0600FF; font-weight: bold;">else</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Zip/Postal Code format is ok.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Zip/Postal Code format is ok.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code63'); return false;">View Code</a> VBNET</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22563"><td class="code" id="p225code63"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">RegularExpressions</span>
<span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> is_valid_zip_code<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> str_zip_code <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matchRegex <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Regex<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;\d{5}-\d{4}$&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matches <span style="color: #FF8000;">As</span> MatchCollection <span style="color: #008000;">=</span> matchRegex.<span style="color: #0000FF;">Matches</span><span style="color: #000000;">&#40;</span>str_zip_code<span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">If</span> matches.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Wrong Zip/Postal Code format.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Wrong Zip/Postal Code format.&quot;); 'In Windows Form</span>
    <span style="color: #FF8000;">Else</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Zip/Postal Code format is ok.&quot;</span><span style="color: #000000;">&#41;</span>    <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Zip/Postal Code format is ok.&quot;); 'In Windows Form</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code64'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22564"><td class="code" id="p225code64"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> is_valid_zip_code
<span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> str_zip_code<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 Pattern p<span style="color: #339933;">=</span>Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;^(<span style="color: #000099; font-weight: bold;">\\</span>d{5})[- ]?(<span style="color: #000099; font-weight: bold;">\\</span>d{4})$&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 Matcher m<span style="color: #339933;">=</span>p.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>str_zip_code<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">boolean</span> matchFound <span style="color: #339933;">=</span> m.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>matchFound<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Zip/Postal Code format is ok.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000000; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Wrong Zip/Postal Code format.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code65'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22565"><td class="code" id="p225code65"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">Function</span> is_valid_zip_code<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str_zip_code</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^([0-9]{5})(-[0-9]{4})?$/i'</span><span style="color: #339933;">,</span><span style="color: #000088;">$str_zip_code</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Zip/Postal Code format is ok.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Wrong Zip/Postal Code format.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Validate  Domain Name eg: http://live.com</h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code66'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22566"><td class="code" id="p225code66"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> is_valid_url<span style="color: #009900;">&#40;</span>str_url<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #003366; font-weight: bold;">var</span> filter <span style="color: #339933;">=</span>   <span style="color: #009966; font-style: italic;">/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s&amp;lt;&amp;gt;\#%&quot;\,\{\}\\|\\\^\[\]`]+)?$/</span>
 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>filter.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>str_url<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>’Wrong URL format.’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'URL format is ok.'</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code67'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22567"><td class="code" id="p225code67"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text.RegularExpressions</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> is_valid_url<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> str_url<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
Regex matchRegex <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;amp;=]*)?&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 MatchCollection matches  <span style="color: #008000;">=</span> matchRegex<span style="color: #008000;">.</span><span style="color: #0000FF;">Matches</span><span style="color: #008000;">&#40;</span>str_url<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>matches<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">==</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Wrong URL format.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;Wrong URL format.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #0600FF; font-weight: bold;">else</span>
 <span style="color: #008000;">&#123;</span>
 Response<span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;URL format is ok.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// In Webserver</span>
 <span style="color: #008080; font-style: italic;">//MessageBox.Show(&quot;URL format is ok.&quot;); //In Windows Form</span>
 <span style="color: #008000;">&#125;</span>
 <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code68'); return false;">View Code</a> VBNET</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22568"><td class="code" id="p225code68"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">Imports</span> System.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">RegularExpressions</span>
&nbsp;
<span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> is_valid_url<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> str_url <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matchRegex <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> Regex<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;amp;=]*)?&quot;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">Dim</span> matches <span style="color: #FF8000;">As</span> MatchCollection <span style="color: #008000;">=</span> matchRegex.<span style="color: #0000FF;">Matches</span><span style="color: #000000;">&#40;</span>str_url<span style="color: #000000;">&#41;</span>
    <span style="color: #0600FF;">If</span> matches.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #FF8000;">Then</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Wrong URL format.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;Wrong URL format.&quot;); 'In Windows Form</span>
    <span style="color: #FF8000;">Else</span>
        Response.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;URL format is ok.&quot;</span><span style="color: #000000;">&#41;</span>    <span style="color: #008080; font-style: italic;">' In Webserver</span>
        <span style="color: #008080; font-style: italic;">'MessageBox.Show(&quot;URL format is ok.&quot;); 'In Windows Form</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code69'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22569"><td class="code" id="p225code69"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> is_valid_url
<span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> str_url<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 Pattern p<span style="color: #339933;">=</span>Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;(http|https)://([<span style="color: #000099; font-weight: bold;">\w</span>-]+<span style="color: #000099; font-weight: bold;">\.</span>)+[<span style="color: #000099; font-weight: bold;">\w</span>-]+(/[<span style="color: #000099; font-weight: bold;">\w</span>- ./?%&amp;amp;=]*)?&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 Matcher m<span style="color: #339933;">=</span>p.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>str_url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">boolean</span> matchFound <span style="color: #339933;">=</span> m.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>matchFound<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;URL format is ok.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000000; font-weight: bold;">else</span>
 <span style="color: #009900;">&#123;</span>
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Wrong URL format.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p225code70'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p22570"><td class="code" id="p225code70"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">Function</span> is_valid_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str_url</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^([0-9]{5})(-[0-9]{4})?$/i'</span><span style="color: #339933;">,</span><span style="color: #000088;">$str_url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;URL format is ok.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span>
 <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Wrong URL format.&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/validate-username-email-id-phone-no-zip-code-url-in-5-languages/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/validate-username-email-id-phone-no-zip-code-url-in-5-languages/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/03/validate-username-email-id-phone-no-zip-code-url-in-5-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile-enabled &#8220;JavaFX SDK 1.1&#8243;</title>
		<link>http://www.wisecodes.com/2009/03/mobile-enabled-javafx-sdk-11/</link>
		<comments>http://www.wisecodes.com/2009/03/mobile-enabled-javafx-sdk-11/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 19:40:52 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.code.venuthomas.net/?p=162</guid>
		<description><![CDATA[Read My Perv Post: The First &#38; Basic Overview Of JavaFX Sun Microsystems is 12 February 2009, the development environment for mobile RIA &#8220;JavaFX Mobile&#8221; released, RIA-enhanced strategies. JavaFX&#8217;s Web site, available for download. JavaFX is a scripting language &#8220;JavaFX Script&#8221;, runtime environment. Drag the Web GUI and functionality of desktop applications and browser features, [...]]]></description>
			<content:encoded><![CDATA[<p>Read My Perv Post: <a href="http://www.code.venuthomas.net/2009/03/the-first-basic-overview-of-javafx/" target="_blank">The First &amp; Basic Overview Of JavaFX</a></p>
<p>Sun Microsystems is 12 February 2009, the development environment for mobile RIA &#8220;JavaFX Mobile&#8221; released, RIA-enhanced strategies. JavaFX&#8217;s Web site, available for download.</p>
<p>JavaFX is a scripting language &#8220;JavaFX Script&#8221;, runtime environment. Drag the Web GUI and functionality of desktop applications and browser features, such as the ability to drop, to develop interactive Web applications. JavaFX Mobile is a mobile version.</p>
<p>Sun has released the &#8220;JavaFX 1.1 SDK&#8221;, the emulator &#8220;JavaFX Mobile Emulator&#8221;, including the latest version of JavaFX, JavaFX Mobile was fully supported. Developers are using it, &#8220;Java Platform Micro Edition (Java ME)&#8221; for mobile devices that operate in RIA development.</p>
<p>According to Sun, the world&#8217;s 26 million mobile phones which support Java, Java is a leading mobile platform. Sun&#8217;s Java RIA strategy aims to capitalize on a wide range of technology diffusion.</p>
<p>The Sun, JavaFX Mobile announcement and the UK Sony Ericsson, LG Electronics and Korean cell phone manufacturers and carriers such as JavaFX Moile has also said it is cooperating with the phone.</p>
<p>Sun Microsystems Inc.<br />
<a href="http://www.sun.com" target="_blank">http://www.sun.com</a></p>
<p>&#8220;JavaFX 1.1 SDK&#8221; download<br />
<a href="http://www.javafx.com/" target="_blank">http://www.javafx.com/</a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/mobile-enabled-javafx-sdk-11/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/mobile-enabled-javafx-sdk-11/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/03/mobile-enabled-javafx-sdk-11/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The First &amp; Basic Overview Of JavaFX</title>
		<link>http://www.wisecodes.com/2009/03/the-first-basic-overview-of-javafx/</link>
		<comments>http://www.wisecodes.com/2009/03/the-first-basic-overview-of-javafx/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 19:37:34 +0000</pubDate>
		<dc:creator>Venu Thomas</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.code.venuthomas.net/?p=163</guid>
		<description><![CDATA[December 2008, finally has been released JavaFX. Since 2007, it was announced at JavaOne a half years, Therefore, this release of JavaFX 1.0 was based on a series of intensive short-term and explains the JavaFX. What is JavaFX JavaFX is Sun Microsystems (Sun following the notation) is a new platform for rich client provides. Java [...]]]></description>
			<content:encoded><![CDATA[<p>December 2008, finally has been released JavaFX. Since 2007, it was announced at JavaOne a half years,  Therefore, this release of JavaFX 1.0 was based on a series of intensive short-term and explains the JavaFX.</p>
<h4>What is JavaFX</h4>
<p>JavaFX is Sun Microsystems (Sun following the notation) is a new platform for rich client provides. Java is in the name, Java is platform independent. However, technology is a Java-based.<br />
JavaFX development are done in open source. The java.net project in <a href="https://openjfx.dev.java.net/" target="_blank">OpenJFX</a>, <a href="https://openjfx-compiler.dev.java.net/" target="_blank">OpenJFX-Compiler project</a> &amp; <a href="https://scenegraph.dev.java.net/" target="_blank">SceneGraph is being</a> vigorously developed in the project. However, at present does not seem to have been the source of all.<br />
JavaFX, 2007 in San Francisco was announced at JavaOne. Initially, RIA (Rich Internet Application) is used for the side, RIA can build not just a different user interface. For example, Java&#8217;s Swing GUI&#8217;s API is only part of the application that was created using JavaFX build, it is possible.<br />
As described above for the Java JavaFX is built on technology, Java is well and good, Java API diversity can be used seamlessly.</p>
<h4>JavaFX area covered by</h4>
<p>JavaFX is a desktop PC application that operates not only cover various areas including mobile phones. JavaFX will run on Java VM. The Java VM as well as Java SE, Java ME in the CLDC (Connected Limited Device Configuration) and CDC (Connected Device Configuration) you can run. Therefore, mobile phones and smart phones, set-top box and can run JavaFX. In addition, Blu-ray players are employed by the CDC based on the BD-J, JavaFX will cover the area. CLDC does not adopt the Google Android, but the 2008 JavaOne JavaFX demo was run.<br />
Which covers various areas such JavaFX is, in each region, in a different way of creating applications. The specific language of the script to build the user interface was developed in JavaFX Script. Using JavaFX Script, Java was once boasts the &#8220;Write Once, Run Anywhere&#8221; are able to achieve again.</p>
<h4>JavaFX development history</h4>
<p>JavaFX is original, SeeBeyond&#8217;s Christopher Oliver was started as a personal project of his. JavaFX is not at that time, Form Follows Function (F3) was named.<br />
The Sun in September 2005, it acquired SeeBeyond, F3 is now Sun&#8217;s technology assets. Later, Oliver says, established in 2006 to 11 <a href="http://blogs.sun.com/chrisoliver/" target="_blank">blogs</a>, then F3 is released. Then F3 is the Java SE and Java 2D and Swing to depend on and could not work only on your desktop. However, in embedded applications in a mobile phone F3 to make this work is important. So the strategy was adopted, JavaSE was acquired companies. This is just before JavaOne 2007, and 2007 will be the month.<br />
Usually, the phone will work CLDC, JavaSE phone company for the CDC had been developed. The CDC JSR 209 Advanced Graphics and User Interface Optional Package for the J2ME Platform with Swing and Java 2D can run. Therefore, CDC and JSR 209 for embedded applications based on JavaFX was established.<br />
And, JavaOne 2007 in F3 is JavaFX is renamed and a major announcement was that.<br />
JavaOne 2007 in F3 and was originally organized the session, but that did not receive much attention.<br />
Immediately after the announcement at JavaOne, <a href="https://openjfx.dev.java.net/" target="_blank">OpenJFX</a> project is started in the JavaFX SDK was released.<br />
Were published during this operation was in JavaFX interpreter. In other words, the interpretation of the script at startup, Java transformation classes, was the flow of work to compile from. This is a drawback that would start a long time there.<br />
Therefore, prior to the compilation was done at every boot, the system was adopted by the compiler. To develop a compiler <a href="https://openjfx-compiler.dev.java.net/" target="_blank">OpenJFX-Compiler project</a> was launched in 2007, also GUI components <a href="https://scenegraph.dev.java.net/" target="_blank">SceneGraph is being</a> developed in the project. The JavaFX Desktop for desktop of the year&#8217;s preview of the SDK was released in July. Of course, is to work on a compiler.<br />
And December 4, JavaFX Desktop 1.0, including the JavaFX SDK 1.0 has been released. In addition, JavaFX SDK for applications built with JavaFX Mobile is also included in the beta.<br />
The 2007 version of the compiler and interpreter version was published in the grammar and API has been changed, and many other areas. Also, Preview SDK and some API in the official version so you must be careful to change. For these changes is summarized in the Appendix at the end of this series, please do help.</p>
<h4>NetBeans Installation</h4>
<p>JavaFX is the Web site of the following three tools can be downloaded as a single package.</p>
<ul>
<li> NetBeans IDE 6.5 for JavaFX 1.1 (NetBeans JavaFX to be incorporated into a plug-in development)</li>
<li> JavaFX 1.1 Production Suite (Plugin for Adobe Illustrator and Photoshop )</li>
<li> JavaFX 1.1 SDK (command line tools)</li>
</ul>
<p><a href="http://javafx.com/downloads/" target="_blank"><img class="alignnone size-full wp-image-164" title="JavaFX" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_02.jpg" alt="JavaFX" width="450" height="317" /></a><br />
JavaFX download page</p>
<p>Here, NetBeans IDE 6.5 for JavaFX 1.0 using JavaFX about how to develop applications. NetBeans IDE 6.5 for JavaFX is JavaFX in the NetBeans Web site or the Web allows people to download the installer from the site. The already installed NetBeans can be installed via the Update Center.</p>
<h4>Introduction to JavaFX Script</h4>
<p>Actually using JavaFX NetBeans So let&#8217;s look at the steps of application development. First Project Creation Wizard &#8220;JavaFX Script Application&#8221;, choose to create a project.</p>
<p><a href="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_03.jpg" target="_blank"><img class="alignnone size-full wp-image-165" title="javafx_03" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_03.jpg" alt="Project Creation Wizard" width="449" height="321" /></a><br />
Project Creation Wizard</p>
<p><a href="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_04.jpg" target="_blank"><img class="alignnone size-full wp-image-166" title="Project was created" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_04.jpg" alt="Project was created" width="455" height="350" /></a><br />
Project was created</p>
<p>Project was to create a simple JavaFX Script is Main.fx are included. It is particularly difficult at first just to see what you think.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p163code73'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16373"><td class="code" id="p163code73"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">thecoders_javafxapp3</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.stage.Stage</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Scene</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.text.Text</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.text.Font</span><span style="color: #339933;">;</span>
&nbsp;
Stage <span style="color: #009900;">&#123;</span>
title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Application title&quot;</span>
width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">250</span>
height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">80</span>
scene<span style="color: #339933;">:</span> Scene <span style="color: #009900;">&#123;</span>
content<span style="color: #339933;">:</span> Text <span style="color: #009900;">&#123;</span>
font <span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afont+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Font</span></a> <span style="color: #009900;">&#123;</span>
size <span style="color: #339933;">:</span> <span style="color: #cc66cc;">16</span>
<span style="color: #009900;">&#125;</span>
x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">30</span>
content<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Application content&quot;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>JavaFX Script is a window corresponding to the stage (Stage) have a concept. Also, in a single stage multiple scenes (Scene) can be defined. Around this concept is similar to Flex. In addition, the Java syntax is very different, it can be defined using a notation declared in the user interface.<br />
To debug JavaFX applications will run the project, right-click &#8220;Run Project&#8221; or selected, click the button on the toolbar. NetBeans project has a main idea, you can only run from the toolbar is set to project the main project. If you want to change the main project from the project right-click menu &#8220;Set as Main Project&#8221; is set to project the main project if you choose.</p>
<p>JavaFX should be created immediately after the window appears as follows: When you run the project. <a href="http://www.code.venuthomas.net/Code/JavaFX/Sample01/TheCoders_JavaFXApp3.html" target="_blank">Output in Web Click here..</a></p>
<p><a href="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_05.jpg" target="_blank"><img class="alignnone size-full wp-image-167" title="JavaFX" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_05.jpg" alt="JavaFX" /></a></p>
<p>JavaFX project was performed</p>
<h4>JavaFX Script Editor Features</h4>
<p>NetBeans is the JavaFX Script Editor features such as input completion and error checking script.</p>
<p><a href="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_06.jpg" target="_blank"><img class="alignnone size-full wp-image-168" title="javafx_06" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_06.jpg" alt="javafx_06" /></a></p>
<p>JavaFX Script code completion<br />
The palettes that are located on the right side of the editor area drag to paste code snippets to the editor by drop. Snippets that are registered in the palette is a simple thing, JavaFX to know and control will be available in a good clue.</p>
<p><a href="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_07.jpg" target="_blank"><img class="alignnone size-full wp-image-169" title="Palette" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_07.jpg" alt="Palette" width="383" height="421" /></a><br />
Palette</p>
<h4>JavaFX event handling</h4>
<p style="text-align: left;">As an example, with event handling and let&#8217;s create a simple JavaFX application. Creating the application of the following would change the color and the mouse to the area of the rectangle overlap. <a href="http://www.code.venuthomas.net/Code/JavaFX/Sample02/TheCoders_JavaFXApp3.html" target="_blank">In Web Click here..</a></p>
<p><a href="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_08.jpg"><img class="alignnone size-full wp-image-170" title="javafx_08" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_08.jpg" alt="javafx_08" /></a></p>
<p><strong>Mouse Over</strong></p>
<p><a href="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_09.png"><img class="alignnone size-full wp-image-171" title="javafx_09" src="http://www.wisecodes.com/wp-content/uploads/2009/03/javafx_09.png" alt="javafx_09" /></a><br />
Creating sample application</p>
<p>Source code is as follows. Rectangle is a rectangle shape to draw, onMouseEntered onMouseExited when overlapped and the shape of mouse, which describes the process to change the background color when off.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p163code74'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16374"><td class="code" id="p163code74"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.stage.Stage</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Scene</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.text.Text</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.text.Font</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.shape.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.paint.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.input.*</span><span style="color: #339933;">;</span>
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
* @author VenuThomas
*/</span>
&nbsp;
Stage <span style="color: #009900;">&#123;</span>
title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Sample Program&quot;</span>
scene<span style="color: #339933;">:</span> Scene <span style="color: #009900;">&#123;</span>
width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">350</span>
height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">175</span>
content<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>
<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arectangle+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Rectangle</span></a> <span style="color: #009900;">&#123;</span>
x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>
y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>
width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">250</span>
height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">55</span>
fill<span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acolor+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Color</span></a>.<span style="color: #006633;">BLACK</span>
onMouseEntered<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span> e<span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Amouseevent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">MouseEvent</span></a> <span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Avoid+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Void</span></a> <span style="color: #009900;">&#123;</span> var rect<span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arectangle+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Rectangle</span></a> <span style="color: #339933;">=</span> e.<span style="color: #006633;">node</span> as <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arectangle+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Rectangle</span></a><span style="color: #339933;">;</span>
rect.<span style="color: #006633;">fill</span> <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acolor+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Color</span></a>.<span style="color: #006633;">BLUE</span>
<span style="color: #009900;">&#125;</span>
onMouseExited<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span> e<span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Amouseevent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">MouseEvent</span></a> <span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Avoid+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Void</span></a> <span style="color: #009900;">&#123;</span> var rect<span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arectangle+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Rectangle</span></a> <span style="color: #339933;">=</span> e.<span style="color: #006633;">node</span> as <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arectangle+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Rectangle</span></a> <span style="color: #339933;">;</span>
rect.<span style="color: #006633;">fill</span> <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acolor+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Color</span></a>.<span style="color: #006633;">BLACK</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
Text <span style="color: #009900;">&#123;</span>
font<span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afont+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Font</span></a> <span style="color: #009900;">&#123;</span>
size<span style="color: #339933;">:</span> <span style="color: #cc66cc;">20</span>
name<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Monospaced&quot;</span>
<span style="color: #009900;">&#125;</span>
x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">60</span>,
y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">85</span>
fill<span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acolor+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Color</span></a>.<span style="color: #006633;">WHITE</span>
content<span style="color: #339933;">:</span> bind <span style="color: #0000ff;">&quot;code.venuthomas.net&quot;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h4>There are many benefits and challenges of new technology</h4>
<p>RIA platform and Microsoft&#8217;s Silverlight and Adobe&#8217;s AIR, which is crammed with powerful competitive platform, JavaFX and whether it is the mainstream is unclear. JavaFX is based on Java platform, but have to learn the new JavaFX Script must have the tools and the development is still far and have the disadvantage in comparison to other competing technologies.<br />
But JavaFX rich in Java can take advantage of existing assets, JavaVM and reliability by running on a Java platform many unique advantages. Also, NetBeans plugin for JavaFX, but there is room for much improvement in terms of function, which is open-source development tools, that can get a free development environment for developers and benefits might be true.<br />
JavaFX is still 1.1 has just been released. I look to the future trends.</p>
<p>Sun Microsystems Inc.<br />
<a href="http://www.sun.com" target="_blank">http://www.sun.com</a></p>
<p>&#8220;JavaFX 1.1 SDK&#8221; download<br />
<a href="http://www.javafx.com/" target="_blank">http://www.javafx.com/</a></p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/the-first-basic-overview-of-javafx/" target="_blank"><img src="http://www.wisecodes.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://www.wisecodes.com/2009/03/the-first-basic-overview-of-javafx/" target="_blank" title="Share on Facebook">Share on Facebook</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.wisecodes.com/2009/03/the-first-basic-overview-of-javafx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
