<?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>Andr&#233; L. S. &#187; Tutorial</title>
	<atom:link href="http://www.andrels.com/wp-en_US/index.php/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andrels.com/wp-en_US</link>
	<description>Softwares Development, Technology and Games</description>
	<lastBuildDate>Wed, 08 Feb 2012 12:39:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A easy way to compile many objects in Oracle database</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2012/01/a-easy-way-to-compile-many-objects-in-oracle-database/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2012/01/a-easy-way-to-compile-many-objects-in-oracle-database/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 22:42:47 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Quick tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[PLSql]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=233</guid>
		<description><![CDATA[When compiles an object that is referenced by many others, they stay invalidated until Oracle compile they again and sometimes<a href="http://www.andrels.com/wp-en_US/index.php/2012/01/a-easy-way-to-compile-many-objects-in-oracle-database/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>When compiles an object that is referenced by many others, they stay invalidated until Oracle compile they again and sometimes it fails.</p>
<p>So, here&#8217;s a tip to compile several invalid packages, procedures and/or functions and fix this.</p>
<p>There is a command to compile all invalid objects under an user, the command is:</p>
<p>&lt;pre class=&#8221;brush:sql&#8221;&gt;exec dbms_ultility.compile_schema(&amp;lt;USER&amp;gt;);&lt;/pre&gt;</p>
<p>Replace  &amp;lt;USER&amp;gt; for &lt;i&gt;user&lt;/i&gt;, or for user name where invalid objects are.</p>
<p>This command is slow and not compiles objects invalidated by coding error. To find which are invalid you need runs the query below:</p>
<p>&lt;pre class=&#8221;brush:sql&#8221;&gt;<br />
select object_name<br />
from all_objects<br />
where status = &#8216;INVALID&#8217;<br />
&lt;/pre&gt;</p>
<p>Invalid objects will be listed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2012/01/a-easy-way-to-compile-many-objects-in-oracle-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharing 3G connection from Android to PCs and laptop through USB cable</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2011/10/sharing-3g-connection-from-android-to-pcs-and-laptop-through-usb-cable/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2011/10/sharing-3g-connection-from-android-to-pcs-and-laptop-through-usb-cable/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 03:19:36 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Operational Systems]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[3g]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=203</guid>
		<description><![CDATA[Froyo, version 2.2 of Android, comes with application that allow you to share your 3G connection to anothers Wi-fi devices,<a href="http://www.andrels.com/wp-en_US/index.php/2011/10/sharing-3g-connection-from-android-to-pcs-and-laptop-through-usb-cable/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Froyo, version 2.2 of Android, comes with application that allow you to share your 3G connection to anothers Wi-fi devices, but, if you don&#8217;t have a Wi-fi network card in your computer, this application have not usability.</p>
<p style="text-align: justify;"><a href="https://market.android.com/details?id=com.proxoid&amp;feature=search_result" target="_blank">ProxoId</a>, free application available in <a href="https://market.android.com/" target="_blank">Android Marketing</a>, allows you to share connection from your Android  only using USB cable.</p>
<p style="text-align: justify;">It needs a stand alone program and Android drivers running in your PC/laptop to work.</p>
<p style="text-align: justify;">The driver and stand alone program can be found in a ZIP file for Windows 32 bits  <a href="http://www.baroukh.com/proxoid/proxoid-adb.zip" target="_blank">here</a>  and Windows 64 bits <a href="http://www.baroukh.com/proxoid/proxoid-adb64.zip">here</a>. If you&#8217;ve already installed manufacturer driver (from CD), skip to <strong>Finding your smartphone</strong> section.</p>
<h5 style="text-align: justify;">*Texts of images bellow are in Brazilian Portuguese</h5>
<p style="text-align: justify;"><span class="Apple-style-span" style="font-size: 20px; font-weight: bold;">Installing drivers</span></p>
<p style="text-align: justify;">Uncompress ZIP file and connect your Android to PC. The new hardware wizard will be shown.</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-397" title="assistente" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img1.png" alt="" width="503" height="390" /></p>
<p style="text-align: justify;">Choose &#8220;No, not this time&#8221; and click in &#8220;Next&#8221;. In following screen, choose&#8221;Install from a list or specific location&#8221;. Click &#8220;Next&#8221;.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-398" title="img2" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img2.png" alt="" width="503" height="390" /></p>
<p style="text-align: justify;">Enable the options &#8220;Search for the best driver in these locations&#8221; and &#8220;Include this location in the search&#8221;, then click in &#8220;Browse&#8221;.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-399" title="img3" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img3.png" alt="" width="503" height="390" /></p>
<p style="text-align: justify;">Go to directory where you have uncompressed the ZIP file &gt; &#8220;usb_driver&#8221; &gt; &#8220;x86&#8243;, like image bellow.</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-400" title="img4" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img4.png" alt="" width="325" height="318" /></p>
<p style="text-align: justify;">Click in &#8220;OK&#8221;, &#8220;Next&#8221; and follow next steps until complete the installation.</p>
<h2>Finding your smartphone</h2>
<p style="text-align: justify;">Make sure your Android is connected to computer. Open the directory &#8220;proxoid-adb&#8221; and run &#8220;check.bat&#8221;. A screen with number of your device, like this below, should be displayed.</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-401" title="img5" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img5.png" alt="" width="500" height="206" /></p>
<p style="text-align: justify;">If don&#8217;t, try to desconnect and connect your smartphone again or try to reinstall the drivers.</p>
<h2>Configuring ProxoId</h2>
<p style="text-align: justify;">Configuration screen is opened when ProxoId runs:</p>
<p style="text-align: justify;">&#8220;Start/Stop ProxoId&#8221; &#8211; Control service to share the connection;<br />
&#8220;Port&#8221; &#8211; Port number to proxy<br />
&#8220;User-Agent Filter&#8221; &#8211; Mask to User-Agent (Browser).</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-402" title="proxoid" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img6.png" alt="" width="235" height="350" /></p>
<h2>Configuring Browser</h2>
<h4>Internet Explorer and Google Chrome</h4>
<p>Open &#8220;Start&#8221; menu &gt; &#8220;Control Panel&#8221; and &#8220;Internet Options&#8221;. Click in tab &#8220;Connections&#8221; and in &#8220;LAN Settings&#8221;.</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-403" title="img7" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img7.png" alt="" width="363" height="450" /></p>
<p style="text-align: justify;">In &#8220;Address&#8221;, type &#8220;localhost&#8221; and, in &#8220;Port&#8221;,  type same value marked in application.</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-406" title="img10" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img10.png" alt="" width="384" height="338" /></p>
<h4>FireFox</h4>
<p style="text-align: justify;">Open Firefox, clique in menu &#8220;Options&#8221;. Choose tab &#8220;Advanced&#8221; &gt; &#8220;Network&#8221; and click in button &#8220;Settings&#8230;&#8221;.</p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-404" title="img8" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img8.png" alt="" width="450" height="416" /></p>
<p style="text-align: justify;">Enable &#8220;Manual proxy configuration&#8221; option.</p>
<p style="text-align: justify;">In &#8220;HTTP&#8221;, type &#8220;localhost&#8221; and, in &#8220;Port&#8221;, type same value marked in application.</p>
<p style="text-align: center;"><img class="aligncenter" title="img9" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/10/img9.png" alt="" width="376" height="400" /></p>
<h2>Sharring the connection</h2>
<p style="text-align: justify;">Enable &#8220;Start/Stop ProxoId&#8221; in your Android.</p>
<p style="text-align: justify;">At computer, run &#8220;start-tunnel.bat&#8221; in &#8220;proxoid-adb&#8221; directory.</p>
<p style="text-align: justify;">That&#8217;s it! While application is enabled and  &#8221;start-tunnel.bat&#8221; is running, your computer will use your Android to connect at internet!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2011/10/sharing-3g-connection-from-android-to-pcs-and-laptop-through-usb-cable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Playstation 3 wireless  joystick in PC</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2011/09/using-playstation-3-wireless-joystick-in-pc/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2011/09/using-playstation-3-wireless-joystick-in-pc/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 14:32:23 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[joystick]]></category>
		<category><![CDATA[pc]]></category>
		<category><![CDATA[playstation 3]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=198</guid>
		<description><![CDATA[How you know, is not possible to use Playstation 3 wireless joystick like PC joystick with defaults drivers, but there<a href="http://www.andrels.com/wp-en_US/index.php/2011/09/using-playstation-3-wireless-joystick-in-pc/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>How you know, is not possible to use Playstation 3 wireless joystick like PC joystick with defaults drivers, but there is a custom driver that allow to PC&#8217;s bluetooth adapter find a PS 3 joystick.</p>
<h4>Requirement:</h4>
<ul>
<li>Bluetooth adapter (if your PC/notebook don&#8217;t have it);</li>
<li>PS3 USB cable;</li>
<li>.NET Framework 4 &#8211; Can be downloaded from <a href="http://www.microsoft.com/download/en/details.aspx?id=17851">here</a>;</li>
<li>Operational System Windows XP, Vista or 7 (seven).</li>
</ul>
<p>You need to download the custom driver from <a href="http://www.motioninjoy.com" target="_blank">Motionin Joy&#8217;s</a> site to<br />
<a href="http://www.xinputer.com/download/MotioninJoy_060004_x86_signed.zip">Windows XP, Windows Vista and Windows 7 (32 bits)</a> or <a href="http://www.xinputer.com/download/MotioninJoy_060004_amd64_signed.zip">Windows XP, Windows Vista e Windows 7 (64 bits)</a>.</p>
<p>Extract ZIP file and run the &#8220;.exe&#8221;. Follow installation steps and run &#8220;DS3 Tool&#8221;, or click Start Menu > Programs > MotioninJoy > DS3 Tool.</p>
<p>Screen below will be shown:<br />
<img class="aligncenter size-full wp-image-373" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/09/tela1.jpg" alt="" width="500" height="398" /></p>
<p>Connect the joystick in to PC using USB cable. Click menu &#8220;Driver Manager&#8221;, select the device and click in button &#8220;Install all&#8221;.<br />
<img class="aligncenter size-full wp-image-374" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/09/tela2.jpg" alt="" width="549" height="437" /></p>
<p>After installation (may take 1 minute), click in menu &#8220;Profiles&#8221;.</p>
<p>The joystick should appear in list (circle). Select the option &#8220;Playstation 2 (POV, Joysticks, Analog Trigger)&#8221;, &#8220;Custom&#8221; and number of joystick (for us &#8220;1&#8243;).</p>
<p><img class="aligncenter size-full wp-image-375" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/09/tela3.jpg" alt="" width="549" height="437" /></p>
<p>To finish, click menu &#8220;Bluetooth Pair&#8221;, select the joystick in list &#8220;Dual Shock 3&#8243; and click in button &#8220;Pair Now&#8221;.</p>
<p><img class="aligncenter size-full wp-image-377" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/09/tela4.jpg" alt="" width="549" height="437" /></p>
<p>It&#8217;s done! When MAC address apear where is &#8220;Have Paired to&#8221; you can disconnect USB and use joystick normally through Bluetooth.</p>
<p>Enjoy! <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2011/09/using-playstation-3-wireless-joystick-in-pc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android 2.2 &#8211; How to install apps directly in SD card</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2011/09/android-2-2-how-to-install-apps-directly-in-sd-card/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2011/09/android-2-2-how-to-install-apps-directly-in-sd-card/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 21:51:17 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=194</guid>
		<description><![CDATA[ome Android smartphones have low capacity internal memory and not allow you to install many apps. At Android 2.2 there<a href="http://www.andrels.com/wp-en_US/index.php/2011/09/android-2-2-how-to-install-apps-directly-in-sd-card/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/09/android_full.png" class="alignleft" width="233" height="265" />ome Android smartphones have low capacity internal memory and not allow you to install many apps.</p>
<p>At Android 2.2 there is a possibility migrate the apps to SD card after instalation, but some applications not allow to do this.</p>
<p>Looking for a fix to solve this problem in my Motorola Droid, I found a way to install apps directly in SD card, like show in <a href="http://www.mundozoom.com.br/android-instalar-aplicativos-no-cartao-sd.html" target="_blank">Mundo Zoom</a>, and not need <i>root</i>.</p>
<p>Download ZIP file from <a href="http://developer.android.com/sdk/index.html" target="_blank">Android SDK</a> and extract. Browse to folder &#8220;<b>android-sdk-windows\platform-tools</b>&#8220;.</p>
<p>Set your Android to debug mode. Don&#8217;t you know? <b>&#8220;Settings&#8221; &gt; &#8220;Applications&#8221; &gt; &#8220;Development&#8221;</b> and enable &#8220;USB debugging&#8221; option.</p>
<p>Connect your smartphone in USB and enable &#8220;Charge Only&#8221; on USB Connection Management.</p>
<p>Click in Start Menu, Run. Type &#8220;cmd&#8221; e press Enter to open command prompt.</p>
<p>With command prompt and Windows Explorer opened, click and drag file &#8220;adb.exe&#8221; to prompt window, after, insert a space and type &#8220;shell&#8221;. Press Enter.</p>
<p><img alt="" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2011/09/ss1.jpg" class="aligncenter" width="540" height="386" /></p>
<p>The &#8220;$&#8221; simbol and cursor should appear. Now type &#8220;<b>pm setInstallLocation 2</b>&#8221; and press Enter</p>
<p>This command sets partition &#8220;2&#8243; (SD Card) as default to install applications.</p>
<p>Done! That`s all you need for apps to be installed directly in your SD card</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2011/09/android-2-2-how-to-install-apps-directly-in-sd-card/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Epson Stylus CX5600 on Ubuntu 10.04</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2011/08/how-to-install-epson-stylus-cx5600-on-ubuntu-10-04/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2011/08/how-to-install-epson-stylus-cx5600-on-ubuntu-10-04/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 02:43:19 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Devices]]></category>
		<category><![CDATA[Operational Systems]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[avasys]]></category>
		<category><![CDATA[epson]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sane]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=178</guid>
		<description><![CDATA[I&#8217;ve found many tutorials about this topic, but only one, found in Luis Gallardo&#8217;s blog, worked for me. Luis&#8217;s tutorial<a href="http://www.andrels.com/wp-en_US/index.php/2011/08/how-to-install-epson-stylus-cx5600-on-ubuntu-10-04/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve found many tutorials about this topic, but only one, found in <a href="http://lgallardo.com/en/2009/12/05/escaner-multifuncional-epson-stylus-cx5600-en-linux/">Luis Gallardo&#8217;s blog</a>, worked for me.</p>
<p>Luis&#8217;s tutorial explain how to install on Ubuntu 9.10, so some steps are not necessary. I&#8217;ll show necessary steps to install on Ubuntu 10.04.</p>
<p>You need to download drivers from Avasys site. Go to this <a href="http://www.avasys.jp/lx-bin2/linux_e/spc/DL1.do">link</a>, scroll down the page, choose &#8220;<em>Epson Stylus CX4300/</em><wbr><em>CX4400/</em><wbr><em>CX4450/</em><wbr><em>CX5500/</em><wbr><em>CX5600/</em><wbr><em>DX4400/</em><wbr><em>DX4450</em>&#8220;, &#8220;<em>Ubuntu</em>&#8221; and version &#8220;<em>10.04</em>&#8220;, click &#8220;Next&#8221;.</p>
<p>Now, download &#8220;<strong>iscan-data_1.9.0-1_all.deb</strong>&#8220;, &#8220;<strong>iscan_2.26.4-2.ltdl7_i386.deb</strong>&#8221; and &#8220;<strong>iscan-plugin-cx4400_2.1.3-1_i386.deb</strong>&#8220;. After, run commands:</p>
<pre class="brush:bash">sudo dpkg -i iscan-data_1.9.0-1_all.deb
sudo dpkg -i iscan_2.26.4-2.ltdl7_i386.deb
sudo dpkg -i iscan-plugin-cx4400_2.1.3-1_i386.deb</pre>
<p>Make sure the scanner is connected and turned on and run command</p>
<pre class="brush:bash">lsusb</pre>
<p>Should appear a list of devices connected to the USB ports, like this:</p>
<pre class="brush:bash">Bus 003 Device 004: ID 04b8:083f Seiko Epson Corp. Stylus DX4450
Bus 003 Device 003: ID 04fc:05d8 Sunplus Technology Co., Ltd
Bus 003 Device 002: ID 04f3:0216 Elan Microelectronics Corp.
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 18e3:9101 Fitipower Integrated Technology Inc
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub</pre>
<p>The first line (&#8220;<em>Bus 003 Device 004: ID 04b8:083f Seiko Epson Corp. Stylus DX4450</em>&#8220;) means the scanner was detected on address 003:004.</p>
<p>These steps are enough for the scanner be detected for XSane, but only <strong>root</strong> can to use.</p>
<p>To fix this &#8220;little&#8221; problem, edit file <em>/lib/udev/rules.d/40-libsane.rules</em> and add the following lines:</p>
<pre class="brush:text"># Epson CX5600
ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="083f", MODE="0664", GROUP="saned", ENV{libsane_matched}="yes"</pre>
<p>Turn off and turn on your scanner. To see if the problem was fixed, run command <em>lsusb</em> again. The output should be like this:</p>
<pre class="brush:bash">Bus 003 Device 004: ID 04b8:083f Seiko Epson Corp. Stylus DX4450</pre>
<p>Note the number of &#8220;Bus&#8221; and &#8220;Device&#8221;, with them run command</p>
<pre class="brush:bash">ls -l /dev/bus/usb/&lt;BUS&gt;/&lt;DEVICE&gt;</pre>
<p>Replace &lt;BUS&gt; and &lt;DEVICE&gt; by respective numbers:</p>
<pre class="brush:bash">ls -l /dev/bus/usb/003/004</pre>
<p>You will see something like</p>
<pre class="brush:bash">crw-rw-r--+ 1 root saned 189, 129 2011-07-01 14:01 /dev/bus/usb/003/004</pre>
<p>Now you can to use your scanner with any user owned to group <strong>saned</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2011/08/how-to-install-epson-stylus-cx5600-on-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to read and write CLOB fields</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2011/05/how-to-read-and-write-clob-fields/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2011/05/how-to-read-and-write-clob-fields/#comments</comments>
		<pubDate>Fri, 20 May 2011 16:39:34 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[blob]]></category>
		<category><![CDATA[clob]]></category>
		<category><![CDATA[data base]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=167</guid>
		<description><![CDATA[The Character Large Object (or CLOB) is a commonly found in databases and used to store high quantity of characters.<a href="http://www.andrels.com/wp-en_US/index.php/2011/05/how-to-read-and-write-clob-fields/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>The Character Large Object (or CLOB) is a commonly found in databases and used to store high quantity of characters.</p>
<p>At MySQL, for example, this field is called MEMO.</p>
<h4>Writing CLOB field</h4>
<p>The method <em>setAsciiStream</em> of <em>PreparedStatement</em> allow to pass data to a CLOB.</p>
<pre class="brush:sql">ps.setAsciiStream(bindPosition, inputStream, textLength);</pre>
<p><strong>bindPosition</strong> &#8211; Position in PreparedStatment&#8217;s CLOB field.<br />
<strong>inputStream</strong> &#8211; Used to pass data.<br />
<strong>textLength</strong> &#8211; Data (text) length.</p>
<p><strong>Full code:</strong></p>
<pre class="brush:java">String sql = "INSERT INTO TABLE (text) VALUES(?)";
		try{
			String txt = readTxtFile();
			ByteArrayInputStream bais = new ByteArrayInputStream(txt.getBytes());

			PreparedStatement ps = conexao.prepareStatement(sql);
			//CLOB is '?' at first position
			ps.setAsciiStream(1, bais, txt.length());

			ps.execute();

			ps.close();
		}catch (Exception e) {
			e.printStackTrace();
		}</pre>
<h4>Retrieving CLOB data</h4>
<p>We&#8217;re using SELECT clause, this clause returns a ResultSet to fetch data and, calling getClob method, passing column name or your position in the query, it give to you a Clob object.</p>
<pre class="brush:sql">rs.getClob("xml");</pre>
<p><strong>Full code:</strong></p>
<pre class="brush:java">String sql = "SELECT xml FROM TEST";
		try{
			PreparedStatement ps = conexao.prepareStatement(sql);
			ResultSet rs = ps.executeQuery();

			while(rs.next()){
				Clob clob = rs.getClob("xml");
				BufferedReader reader = new BufferedReader(clob.getCharacterStream());
				StringBuffer strBuf = new StringBuffer();

				String linha = null;
				while((linha = reader.readLine()) != null){
					strBuf.append(linha);
//Character.LINE_SEPARATOR insert break line
					strBuf.append((char)Character.LINE_SEPARATOR);
				}

				System.out.println("=========== CLOB ===========");
				System.out.println(strBuf.toString());
			}

			rs.close();
			ps.close();
		}catch (Exception e) {
			e.printStackTrace();
		}</pre>
<p>That&#8217;s it! Easy and painless <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Download full code <a href="http://www.andrels.com/wp-pt_BR/wp-content/plugins/download-monitor/download.php?id=6">here</a></p>
<p>To write a BLOB see this <a href="http://www.andrels.com/wp-en_US/index.php/2010/02/saving-files-in-blob-table-column-of-a-data-base/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">tutorial</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2011/05/how-to-read-and-write-clob-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix for &#8220;JDK not found&#8221; error for Android SDK at Windows 7 x64</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2010/12/fix-for-jdk-not-found-error-for-android-sdk-at-windows-7-x64/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2010/12/fix-for-jdk-not-found-error-for-android-sdk-at-windows-7-x64/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 22:29:32 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[64 bits]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=156</guid>
		<description><![CDATA[If you&#8217;re trying to install Android SDK on Windows 64 bits and is receiving the error message &#8220;JDK not found&#8221;,<a href="http://www.andrels.com/wp-en_US/index.php/2010/12/fix-for-jdk-not-found-error-for-android-sdk-at-windows-7-x64/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re trying to install Android SDK on Windows 64 bits and is receiving the error message &#8220;JDK not found&#8221;, the solution found by <a href="http://www.eighthourlunch.com/node/161">http://www.eighthourlunch.com/node/161</a>, basicaly insert some entries at Windows registry, after this, the Google Android SDK will found your JDK instalation.</p>
<p>The .REG file are available <a href="http://www.andrels.com/wp-en_US/wp-content/plugins/download-monitor/download.php?id=5" title="Downloaded 1215 times">here</a> .</p>
<p>Before run file, open it with notepad and change path &#8220;C:\\Program Files\\Java\\jdk1.6.0_23&#8243; to your JDK directory, and the path &#8220;C:\\Program Files\\Java\\jre6&#8243; to your JRE directory.</p>
<p>This fix has worked for me. <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2010/12/fix-for-jdk-not-found-error-for-android-sdk-at-windows-7-x64/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Solving problems with removal of the external HD in Windows 7</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2010/05/solving-problems-with-removal-of-the-external-hd-in-windows-7/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2010/05/solving-problems-with-removal-of-the-external-hd-in-windows-7/#comments</comments>
		<pubDate>Tue, 11 May 2010 02:26:41 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Operational Systems]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[hd]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=126</guid>
		<description><![CDATA[Some times I had problems when disconnected my external HD using Windows&#8217; s Removal Device Assistant, the most frequently was<a href="http://www.andrels.com/wp-en_US/index.php/2010/05/solving-problems-with-removal-of-the-external-hd-in-windows-7/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>Some times I had problems when disconnected my external HD using Windows&#8217; s Removal Device Assistant, the most frequently was &#8220;This device is currently in use. Close any programs or windows that&#8230;&#8221;. This message appeared even with all programs closed.</p>
<p>After checked Windows settings, process and services, I noticed that the problem was in service &#8220;Windows Media Player Network Sharing Service&#8221;, forcing me to stop it before remove the device.</p>
<p>But still, this solution not is right, then I found the most right:</p>
<p>The service &#8220;Windows Media Player Network Sharing Service&#8221; is responsible to share your media files (musics and videos) in your network or in the internet (like your name sounded. <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). This is default setting in Windows 7, to disable it&#8230;</p>
<p>Click in Start menu, type &#8220;Network and sharing center&#8221; and select the application. Like show in the image</p>
<p>Click &#8220;Choose homegroup and sharing options&#8221;</p>
<p><img class="aligncenter size-full wp-image-130" title="start" src="http://www.andrels.com/wp-en_US/wp-content/uploads/2010/05/start.png" alt="" width="348" height="500" /></p>
<p>Clique na opção &#8220;Escolher opções de grupo doméstico e de  compartilhamento&#8221;</p>
<p><img class="aligncenter size-full wp-image-129" title="nsc" src="http://www.andrels.com/wp-en_US/wp-content/uploads/2010/05/nsc.png" alt="" width="450" height="387" /></p>
<p>Now click on &#8220;Choose media streaming options&#8230;&#8221;</p>
<p><img class="aligncenter size-full wp-image-133" title="cmso" src="http://www.andrels.com/wp-en_US/wp-content/uploads/2010/05/cmso.png" alt="" width="450" height="283" /></p>
<p>Change option of item &#8220;Media programs on this PC and remote conections&#8230;&#8221; to &#8220;Blocked&#8221;.</p>
<p><img class="aligncenter size-full wp-image-131" title="blk" src="http://www.andrels.com/wp-en_US/wp-content/uploads/2010/05/blk.png" alt="" width="450" height="154" /></p>
<p>Finish! From now you can remove your external hard drive or other removable storage devices without problems.</p>
<p> <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2010/05/solving-problems-with-removal-of-the-external-hd-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling Windows Media Player bar in Windows 7 taskbar</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2010/04/enabling-windows-media-player-bar-in-windows-7-taskbar/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2010/04/enabling-windows-media-player-bar-in-windows-7-taskbar/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 18:14:40 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Operational Systems]]></category>
		<category><![CDATA[Softwares]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[taskbar]]></category>
		<category><![CDATA[toolbar]]></category>
		<category><![CDATA[windows 7]]></category>
		<category><![CDATA[windows media player]]></category>
		<category><![CDATA[windows vista]]></category>
		<category><![CDATA[wmpband.dll]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=122</guid>
		<description><![CDATA[Unfortunately Windows Media Player 12,  already installed with Windows 7, has no support to minimize as toolbar in the taskbar.<a href="http://www.andrels.com/wp-en_US/index.php/2010/04/enabling-windows-media-player-bar-in-windows-7-taskbar/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;" dir="ltr">Unfortunately Windows Media Player 12,  already installed with Windows 7, has no support to minimize as toolbar in the taskbar. To enable this bar, just need copy a file from Windows Media Player for Windows Vista. Now I will show how do this:</div>
<p style="text-align: justify;"><strong>1. </strong>You will need of a dll called wmpband.dll, that come with Windows Vista. If you not own it, download <a class="downloadlink" href="http://www.andrels.com/wp-en_US/wp-content/plugins/download-monitor/download.php?id=4" title=" downloaded 557 times" >here (557)</a> (this ZIP contains 32 and 64 bits versions);</p>
<p style="text-align: justify;"><strong>2.</strong> Copy the file (32 or 64 bits, depends your Windows) to Windows Media Players installation directory, in my case &#8220;<strong>C:\Program Files\Windows Media Player</strong>&#8220;;</p>
<p style="text-align: justify;"><strong>3. </strong>Now check if &#8220;<strong>Windows Media Player Network Sharing Service</strong>&#8220;<strong> </strong>service is stopped. To do this, click in Start and, in the search box, type &#8220;Services&#8221; and click in the respective list item. Look for service and stop it, if running.</p>
<p style="text-align: justify;"><strong>4.</strong> Open the Command Prompt with administrator privileges. Star &gt; All Programs &gt; Accessories &gt; right click in &#8220;Command Prompt&#8221; and click &#8220;Run as Administrator&#8221;.</p>
<p style="text-align: justify;"><strong>5. </strong>Type command <strong>regsvr32</strong> &#8220;<strong>C:\Program Files\Windows  Media  Player\wmpband.dll</strong>&#8220;, replace the path of the directory where the dll is.</p>
<p style="text-align: justify;"><strong>6. </strong>Open Windows Media Player and minimize it. Then right click in the taskbar &gt; Toolbars &gt; select Windows Media Player.<a href="http://www.andrels.com/wp-en_US/wp-content/uploads/2010/04/ljbp.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="aligncenter size-medium wp-image-123" title="ljbp" src="http://www.andrels.com/wp-en_US/wp-content/uploads/2010/04/ljbp-300x174.png" alt="" width="300" height="174" /></a></p>
<p style="text-align: justify;"><strong> </strong><strong>6. </strong>Abra o Windows Media Player e então o minimize-o. Depois clique com o  botão direito na barra de tarefas &gt; Barra de Ferramentas &gt; Windows  Media Player.</p>
<p style="text-align: justify;"><strong>7.</strong> And <em>voilá</em>. <img class="alignnone" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2010/04/45454561.png" alt="" width="321" height="45" /></p>
<p style="text-align: justify;">Microsoft should  have kept this feature natively, I know people who use this resource, I inclusive.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 580px; width: 1px; height: 1px; overflow: hidden;">
<div dir="ltr">
<div id="tts_button" class=" " style="display: block;" title="Ouvir esta tradução"><object id="tts_flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="18" height="18" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://www.gstatic.com/translate/sound_player.swf" /><param name="flashvars" value="sound_name=&amp;sound_name_cb=_TTSSoundFile" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.gstatic.com/translate/sound_player.swf" /><embed id="tts_flash" type="application/x-shockwave-flash" width="18" height="18" src="http://www.gstatic.com/translate/sound_player.swf" allowscriptaccess="always" wmode="transparent" flashvars="sound_name=&amp;sound_name_cb=_TTSSoundFile" data="http://www.gstatic.com/translate/sound_player.swf"></embed></object></div>
<p><span id="result_box" class="short_text"><span style="background-color: #ffffff;" title="nativamente">natively</span></span></p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2010/04/enabling-windows-media-player-bar-in-windows-7-taskbar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting up internet access through proxy server</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2010/03/setting-up-internet-access-through-proxy-server/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2010/03/setting-up-internet-access-through-proxy-server/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 01:54:22 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Quick tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=116</guid>
		<description><![CDATA[Today I had a trouble in my workplace when a client application, running through a terminal (DOS prompt), not reach<a href="http://www.andrels.com/wp-en_US/index.php/2010/03/setting-up-internet-access-through-proxy-server/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>Today I had a trouble in my workplace when a client application, running through a terminal (DOS prompt), not reach the server hosted in the internet, this is because the company where I work use proxy.</p>
<p>After some tries I found two solutions to solve my access problem: first was pass as <em>Java</em> parameters the proxy&#8217;s configurations.</p>
<pre class="brush:shell">$ java -Dhttp.proxyHost=serv -Dhttp.proxyPort=port -Dhttp.proxyUser=user -Dhttp.proxyPassword=pass  ClassJava
</pre>
<p><strong>-Dhttp.proxyHost</strong> = IP or host name of server proxy<br />
<strong>-Dhttp.proxyPort</strong> = Proxy port<br />
<strong>-Dhttp.proxyUser</strong> = User<br />
<strong>-Dhttp.proxyPassword</strong> = Password</p>
<p>This way the class <em>ClassJava</em> will have access to internet through proxy server.</p>
<p>Another way, was insert the settings in own class:</p>
<pre class="brush:java">public static void main(String[] args){
...
System.getProperties().put("proxySet", "true");
System.getProperties().put("http.proxyHost", "serv");
System.getProperties().put("http.proxyPort", "port");
System.getProperties().put("http.proxyUser", "user");
System.getProperties().put("http.proxyPassword", "password");
...
}
</pre>
<p><strong>proxySet</strong> = Connect, or not, through proxy server<br />
<strong>http.proxyHost</strong> = IP or host name of server proxy<br />
<strong>http.proxyPortt</strong> = Proxy port<br />
<strong>http.proxyUse</strong> = User<br />
<strong>http.proxyPassword</strong> = Password</p>
<p>Using this resource you can set your application to access the internet through proxy server.</p>
<p>I hope help you.  Bye! <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2010/03/setting-up-internet-access-through-proxy-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating transparent and shaped windows using Java Swing/AWT</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2010/03/creating-transparent-and-shaped-windows-using-java-swingawt/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2010/03/creating-transparent-and-shaped-windows-using-java-swingawt/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 02:28:58 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[awt]]></category>
		<category><![CDATA[jframe]]></category>
		<category><![CDATA[swing]]></category>
		<category><![CDATA[transparency]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=107</guid>
		<description><![CDATA[The Java AWT offer various possibilities about window manipulation. Today I&#8217;ll talk about two possibilities using class AWTUtilities. Building a<a href="http://www.andrels.com/wp-en_US/index.php/2010/03/creating-transparent-and-shaped-windows-using-java-swingawt/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>The Java AWT offer various possibilities about window manipulation. Today I&#8217;ll talk about two possibilities using class AWTUtilities.</p>
<h3><strong>Building a transparent window</strong></h3>
<p>To make a <strong>Window</strong> (JFrame, JDialog &#8230;) with alpha effect, you should invoke the method <strong>AWTUtilities.setWindowOpacity</strong>. This method parameters are: the window to apply transparency and transparency degree, that can be between 0 (zero) and 1, being 0 invisible and 1 totally visible.</p>
<pre class="brush:java">JFrame  window = new JFrame("My Window");

//70% of transparency
AWTUtilities.setWindowOpacity(window, .7f);
window.setSize(800,600);
window.setVisible(true);
</pre>
<p>The result will be:<a href="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2010/03/2.jpg"><img class="aligncenter size-full wp-image-174" title="2" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2010/03/2.jpg" alt="" width="480" height="368" /></a></p>
<h3><strong>Changing window shape</strong></h3>
<p>To change the window shape you should use the method <strong>AWTUtilities.setWindowShape</strong>. This method parameters are: window that will be changed and the new shape (java.awt.Shape) of the window.</p>
<p>The most efficiently form to use is to implement the method <em>componentResized()</em>, cause you may recompute the window and components size</p>
<p>Here I&#8217;ll use a triangle with 70% of transparency.</p>
<pre class="brush:java">final JFrame  window = new JFrame("My Window");

try {
	//Add the ComponentListener to implement componentResized method
	window.addComponentListener(new ComponentAdapter(){
		@Override
		//building componentResized
		public void componentResized(ComponentEvent e) {
			int[] x = {0,400,800}; //Pontos X do polígono
			int[] y = {600,0,600}; //Pontos Y do polígono

			//Triangle with 800 w x 600 h
			Shape shape = new Polygon(x, y, 3);

			AWTUtilities.setWindowShape(window, shape);

			//70% of transparency
			AWTUtilities.setWindowOpacity(window, 0.7f);
		}
	});
} catch (SecurityException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
} catch (IllegalArgumentException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}

window.setUndecorated(true); //removing title bar
window.setSize(800,600);
window.setVisible(true);
</pre>
<p>Notice that the method <strong><em>setUndecorated( )</em></strong> was invoked with <em>true</em> as value. This method are responsible by hide the title bar (one with icon and the maximize, minimize and close buttons).  This is really necessary, because with title bar visible the window are not be shaped.</p>
<p>The result:<a href="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2010/03/1.jpg"><img class="aligncenter size-full wp-image-175" title="1" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2010/03/1.jpg" alt="" width="480" height="365" /></a></p>
<p>I hope you enjoy&#8230; <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2010/03/creating-transparent-and-shaped-windows-using-java-swingawt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Saving files in BLOB table column of a data base</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2010/02/saving-files-in-blob-table-column-of-a-data-base/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2010/02/saving-files-in-blob-table-column-of-a-data-base/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 00:46:06 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Quick tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[blob]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=102</guid>
		<description><![CDATA[To insert a file, is it in any format, you need call the method setBinaryStream, implemented by PreparedStatement. PreparedStatemente.setBinaryStream(int index,<a href="http://www.andrels.com/wp-en_US/index.php/2010/02/saving-files-in-blob-table-column-of-a-data-base/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>To insert a file, is it in any format, you need call the method <i>setBinaryStream</i>, implemented by PreparedStatement.</p>
<pre class="brush:java">
PreparedStatemente.setBinaryStream(int index, Inputstream is, int length);
</pre>
<p>In sample, we set a table called <i>FILE</i>that contains <b>BLOB</b> column called <i>BIN</i>.</p>
<pre class="brush:java">
//Normal connection, as any JDBC connection
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@&lt;IP&gt;:&lt;PORT&gt;:&lt;SID&gt;","&lt;USER&gt;","&lt;PASSWORD&gt;");

//Reading the file and retrieving an InputStream
File file= new File("&lt;COMPLETE_FILE_PATH&gt;");
FileInputStream fis = new FileInputStream(file);

//Preparing statement
PreparedStatement ps = conn.prepareStatement("INSERT INTO FILE(bin) VALUES(?)");

//Passing InputStream and file length
ps.setBinaryStream(1, fis, (int)file.length());

ps.execute();

ps.close();
conn.close();
</pre>
<p>I used Oracle 8i to execute this sample. I haven&#8217;t a MySQL/PostgreSQL/MS SQL Server in my dispose, then you&#8217;ll responsible for testing in this data bases and send me the results, OK <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Thanks! Until next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2010/02/saving-files-in-blob-table-column-of-a-data-base/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Retrieving an Oracle cursor in Java</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2010/01/retieving-an-oracle-cursor-in-java/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2010/01/retieving-an-oracle-cursor-in-java/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 16:22:32 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=99</guid>
		<description><![CDATA[Many people come here looking for one way to retrieve cursors of Oracle procedures in Java. To them, I&#8217;ve here<a href="http://www.andrels.com/wp-en_US/index.php/2010/01/retieving-an-oracle-cursor-in-java/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>Many people come here looking for one way to retrieve cursors of Oracle <i>procedures</i> in Java. To them, I&#8217;ve here are a tutorial showing how to do this.</p>
<p>To retrieve the cursor you should declare him how a <i>REF CURSOR</i> in <i>Package spec</i>.</p>
<pre class="brush:sql">  --Creating the REF CURSOR type
  type g_cursor is ref cursor;
</pre>
<p>In both, <i>spec</i> and <i>body</i>, you need declare an <i>out REF CURSOR</i> variable in procedure signature, how cited above.</p>
<pre class="brush:sql">  procedure PRO_RETURN_CARS(
    i_id     in     tbl_car.car_id%type,
    o_cursor in out g_cursor);
</pre>
<p>The cursor must be opened in <i>procedure&#8217;s body</i> to return, this way:</p>
<pre class="brush:sql">
open o_cursor for
          select car_id, company, model, color, hp, price
          from tbl_car
          where car_id = i_id;
</pre>
<p>The complete <i>Package</i>:</p>
<pre class="brush:sql">create or replace package PAC_CURSOR is
  --Creating REF CURSOR type
  type g_cursor is ref cursor;

  --Procedure that return the cursor
  procedure PRO_RETURN_CARS(
    i_id     in     tbl_car.car_id%type,
    o_cursor in out g_cursor); -- Our cursor

end PAC_CURSOR;
/

create or replace package body PAC_CURSOR is
  procedure PRO_RETURN_CARS(
    i_id     in     tbl_car.car_id%type,
    o_cursor in out g_cursor) is

       begin
        --Opening the cursor to return matched rows
        open o_cursor for
          select car_id, company, model, color, hp, price
          from tbl_car
          where car_id = i_id;

  end PRO_RETURN_CARS;

end PAC_CURSOR;
</pre>
<p>We have Oracle side ready, now we need create Java call</p>
<p>How the cursors are being returned by a <i>procedure</i>, we&#8217;ll used a <i>java.sql.CallableStatement</i> instance.</p>
<pre class="brush:java">
CallableStatement cs = conn.prepareCall("{call PAC_CURSOR.PRO_RETURN_CARS(?,?)}");
</pre>
<p>The <i>registerOutParameter</i> will obtain <i>oracle.jdbc.OracleTypes.CURSOR</i> type and return a <i>java.sql.ResultSet</i> instance. We can iterate the <i>ResultSet</i> like a common <i>Iterator</i>.<br />
Each row column returned by <i>SELECT</i> will be represented how a map, using correspondent getter. For example, we will call <i>getString(&lt;column name&gt;)</i> method when value of column is a <i>varchar</i>, <i>getDate(&lt;column name&gt;)</i> when is a date and etc.</p>
<p>The complete code will be like this:</p>
<pre class="brush:java">
//Calling Oracle procedure
CallableStatement cs = conn.prepareCall("{call PAC_CURSOR.PRO_RETURN_CARS(?,?)}");

//Defining type of return
cs.registerOutParameter("o_cursor", OracleTypes.CURSOR);
cs.setLong("i_id", id);

cs.execute();//Running the call

//Retrieving the cursor as ResultSet
ResultSet rs = (ResultSet)cs.getObject("o_cursor");

//Iterating the returned rows
while(rs.next()){
	//Getting column values
	System.out.println("ID: " + rs.getLong("car_id"));
	System.out.println("Manufacturer: " + rs.getString("company"));
	System.out.println("Model: " + rs.getString("model"));
	System.out.println("Color: " + rs.getString("color"));
	System.out.println("HP: " + rs.getString("hp"));
	System.out.println("Price: " + rs.getFloat("price"));
}
</pre>
<p>In the end you will get any value returned in a <i>SELECT</i> clause.</p>
<p>See ya!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2010/01/retieving-an-oracle-cursor-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating &#8216;EXE&#8217; to start your Java applications</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2009/10/generating-exe-to-start-your-java-applications/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2009/10/generating-exe-to-start-your-java-applications/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 23:52:08 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[exe]]></category>
		<category><![CDATA[jsmooth]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=89</guid>
		<description><![CDATA[Many developers need, or have needed, distribute their Java applications so that Windows users could start them naturally, not running<a href="http://www.andrels.com/wp-en_US/index.php/2009/10/generating-exe-to-start-your-java-applications/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>Many developers need, or have needed, distribute their Java applications so that Windows users could start them naturally, not running <em>java -jar &lt;jar file&gt;</em> command or batch (.BAT) file.</p>
<p>I&#8217;ve been there too, then I found a easy and with many resources solution: <a href="http://jsmooth.sourceforge.net/" target="_blank">JSmooth</a></p>
<p>This software allow you &#8220;transform&#8221; your JAR file in an executable (EXE), but, of course, will need the JVM already installed and running.</p>
<p>Here I only have mentioned the settings that I consider important, then let&#8217;s go!</p>
<hr />Download JSmooth in <a href="http://sourceforge.net/projects/jsmooth/files/" target="_blank">http://sourceforge.net/projects/jsmooth/files/</a>;</p>
<p>After install (or unzip, this depends of file that you have downloaded) run him;</p>
<p>In the side menu, click in &#8220;Skeleton&#8221;;</p>
<p style="text-align: center;"><a href="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/1.jpg"><img class="size-full wp-image-119 aligncenter" title="1" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/1.jpg" alt="1" width="524" height="364" /></a></p>
<p>In the &#8220;Skeleton Selection&#8221; screen you need define how application will be run, select &#8220;Window Wrapper&#8221;.</p>
<p>In &#8220;Skeleton Properties&#8221;, you need define a message when user have no JVM installed (&#8220;Message&#8221; field) and where can be downloaded (&#8220;URL&#8221; field).</p>
<p>The &#8220;Launch java app in the exe process&#8221; field define if JAR file will be executed in same process of EXE (only the executable process will be displayed in Windows Task Manager), otherwise the <em>javaw.exe</em> will be displayed too.</p>
<p>The &#8220;Single Instance&#8221; field define if more than one instance can be opened.</p>
<p>&#8220;Debug Console&#8221; open the EXE from prompt window, displaying possibles outputs.</p>
<p>Now click in &#8220;Executable&#8221;</p>
<p style="text-align: center;"><a href="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/2.jpg"><img class="aligncenter size-full wp-image-120" title="2" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/2.jpg" alt="2" width="524" height="364" /></a></p>
<p>In &#8220;Executable Setting&#8221; you inform where EXE will be builded (&#8220;Executable Binary&#8221; field), the EXE&#8217;s icon (&#8220;Executable Icon&#8221; filed) and what will be the application execution directory.</p>
<p>Click in &#8220;Application&#8221;</p>
<p style="text-align: center;"><a href="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/3.jpg"><img class="aligncenter size-full wp-image-121" title="3" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/3.jpg" alt="3" width="524" height="364" /></a></p>
<p>First, click in the icon <img class="size-full wp-image-125 alignnone" title="7" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/7.jpg" alt="7" width="50" height="27" /> and select JAR that contains the main class.</p>
<p>After, select the main class in the field &#8220;Main Class&#8221; clicking in button <img class="alignnone size-full wp-image-126" title="8" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/8.jpg" alt="8" width="39" height="20" />.</p>
<p>In the field &#8220;Application arguments&#8221; you can inform necessaries parameters for your main class.</p>
<p>&#8220;Embedded JAR&#8221; field allows you to aggregate your JAR file in EXE file, in other words, only EXE file will be necessarie, because the JAR will be uncompressed by EXE in each execution.</p>
<p>Now click in &#8220;JVM Selection&#8221;.</p>
<p style="text-align: center;"><a href="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/4.jpg"><img class="aligncenter size-full wp-image-122" title="4" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/4.jpg" alt="4" width="524" height="364" /></a></p>
<p>Here you can define the minimum and maximum version of JVM that your application support.</p>
<p>The &#8220;JVM Serach Sequence&#8221; inform the seek order of <em>javaw.exe</em> file, in this case, he search in resgistry first, after in JAVA_HOME enviroment and so.</p>
<p>Click in &#8220;JVM Configuration&#8221;.</p>
<p style="text-align: center;"><a href="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/5.jpg"><img class="aligncenter size-full wp-image-123" title="5" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/5.jpg" alt="5" width="524" height="364" /></a></p>
<p>Here the maximum and minimum memory available for your application can be configured, as the options that can passed to JVM.</p>
<p>Until here we only have configured the JSmooth. To build the EXE file click in button <img class="size-full wp-image-124 alignnone" title="6" src="http://www.andrels.com/wp-pt_BR/wp-content/uploads/2009/10/6.jpg" alt="6" width="32" height="30" />. If you don&#8217;t have saved the project, a new window will open to choose the place to save. Done it, the EXE file will be create in directory mentioned in &#8220;Executable Binary&#8221; field of &#8220;Executable&#8221; screen.</p>
<p>Now just execute the EXE file and your application will be run!</p>
<p style="text-align: left;">
<p>To more information visit <a href="http://jsmooth.sourceforge.net/" target="_blank">http://jsmooth.sourceforge.net/</a></p>
<p style="text-align: left;">
<p style="text-align: left;">I hope you enjoyed, feel free to comment!</p>
<p style="text-align: left;">Until next! <img src='http://www.andrels.com/wp-en_US/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2009/10/generating-exe-to-start-your-java-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrieving objects collection from Oracle procedure</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2009/09/retrieving-objects-collection-from-oracle-procedure/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2009/09/retrieving-objects-collection-from-oracle-procedure/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 22:25:07 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[collection]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=79</guid>
		<description><![CDATA[As I&#8217;ve promised in post &#8220;Learn to pass a Java Object as Oracle Procedure parameter&#8220;, I&#8217;ll show how retrieve object<a href="http://www.andrels.com/wp-en_US/index.php/2009/09/retrieving-objects-collection-from-oracle-procedure/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;ve promised in post &#8220;<a href="http://www.andrels.com/wp-en_US/index.php/2009/06/learn-to-pass-a-java-object-as-oracle-procedure-parameter#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Learn to pass a Java Object as Oracle Procedure parameter</a>&#8220;, I&#8217;ll show how retrieve object that have a collection of objects as attribute through of an <a href="http://www.oracle.com/">Oracle</a> procedure. Is highly recommended to read <a href="http://www.andrels.com/wp-en_US/index.php/2009/06/learn-to-pass-a-java-object-as-oracle-procedure-parameter#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">previous post</a>.</p>
<p>For this tutorial, we&#8217;ll need create the table TBL_CLASS and add your primary key as foreign key in TBL_USER table.</p>
<pre class="brush:sql">--num class is PK and desc_class description
create table TBL_CLASS (num_class number, desc_class varchar(100));
alter table TBL_CLASS add primary key(num_class);

alter table TBL_USER add num_class number;
alter table TBL_USER add constraint FK_CLASS foreign key(num_class) references tbl_class(num_class);</pre>
<p>Now we need to include the new types:</p>
<pre class="brush:sql">create or replace type class_type as object (num_class number, desc_class varchar2(100), users arr_users);
/
create or replace type arr_class as table of class_type;
/</pre>
<p>The <em>class_type</em> type will be the Java Object. Notice that in your signature was included the <em>arr_users</em> type, that will be our collection of <em>user_type</em> (read <a href="http://www.andrels.com/wp-en_US/index.php/2009/06/learn-to-pass-a-java-object-as-oracle-procedure-parameter#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">previous post</a> for more information), the <em>arr_class</em> type will be the <em>class_type</em> collection.</p>
<p>Now we&#8217;ll include the procedure that returns our  <em>class_type</em> collection.</p>
<pre class="brush:sql">procedure pro_select_class(clas in class_type, class_return in out arr_class)is
  class_ref_cur ref_cur;
  --class_type array
  classes arr_class := arr_class();

  begin
    open class_ref_cur for
      select cast(
                multiset(
                  select num_class,
                         desc_class,
                         (select cast(
                                  multiset(
                                    select user_name,
                                           height,
                                           b_date
                                    from tbl_user
                                    --JOIN with TBL_USER
                                    where tbl_user.num_class = tbl_class.num_class
                                  ) as arr_users)
                          from dual) users
                  from tbl_class
                  --Using num_class attribute of in parameter
                  where num_class = clas.num_class) as arr_class
      ) classes
    from dual;

    --including the return in array
    fetch class_ref_cur into classes;
    --transferring arrar to variable out
    class_return := classes;
end pro_select_class;</pre>
<p>Notice that procedure receive <em>class_type</em> as parameter in and returns <em>arr_class</em> type.</p>
<p>Separating code charge back and set up our objects, we have:</p>
<pre class="brush:sql">
--Mount return
select cast(
        multiset(

          --Will returns the objects class_type and your attributes
          select num_class,
                 desc_class,

                 --Populate user_type collection
                 (select cast(
                          multiset(
                            select user_name,
                                   height,
                                   b_date
                            from tbl_user
                            where tbl_user.num_class = tbl_class.num_class
                          ) as arr_users)

                  from dual) users

          from tbl_class
          where num_class = clas.num_class) as arr_class
) classes
from dual;
</pre>
<p>Oracle objects done, now the Java code!</p>
<p>We&#8217;ll create the object that will be interpreted by the Oracle. Called TypeClass:</p>
<pre class="brush:java">
public class TypeClass implements SQLData{
	public static final String ORACLE_OBJECT_NAME = "CLASS_TYPE"; //Type name in Oracle
	public static final String ORACLE_CLASS_ARRAY_NAME = "ARR_CLASS"; //Array name in Oracle

        //Attibutes of TBL_CLASS table
	private Long number;
	private String desc;
	private Array users; //This will be user_type collection (or TypeUser in Java)

	public String getSQLTypeName() throws SQLException {
		return ORACLE_OBJECT_NAME;
	}

	public void readSQL(SQLInput stream, String typeName) throws SQLException {
		setNumber(stream.readLong());
		setDesc(stream.readString());
		setUsers(stream.readArray());//Used by JDBC driver to read the collection
	}

	public void writeSQL(SQLOutput stream) throws SQLException {
		stream.writeLong(getNumber());
		stream.writeString(getDesc());
		stream.writeArray(getUsers());//Used by JDBC driver to write the collection
	}
	//Getters and setters omitted
}
</pre>
<p>We need to map types interpreted in request, this way:</p>
<pre class="brush:java">
Map<String, Class<?>> typeMaps = connection.getTypeMap();
typeMaps.put(TypeUser.ORACLE_OBJECT_NAME, TypeUser.class);
typeMaps.put(TypeClass.ORACLE_OBJECT_NAME, TypeClass.class);
</pre>
<p>We need to map the <em>arrays</em> too:</p>
<pre class="brush:java">
typeMaps.put(TypeClass.ORACLE_CLASS_ARRAY_NAME, TypeClass[].class);//returned by procedure
typeMaps.put(TypeUser.ORACLE_USER_ARRAY_NAME, TypeUser[].class);//returned by class_type collection
</pre>
<p>For request, we do:</p>
<pre class="brush:java">
cs = conn.prepareCall("{call PAC_BEAN.PRO_SELECT_CLASS(?,?)}");
//registering out type, that will be a TypeClass array
cs.registerOutParameter("class_return", OracleTypes.ARRAY, TypeClass.ORACLE_CLASS_ARRAY_NAME);

//passing parameter object
cs.setObject("clas", classQry);

cs.execute();
//retrieving and looping the TypeClass array
Object[] array = (Object[])cs.getArray("class_return").getArray();

for(Object obj : array){
	TypeClass objClass = ((TypeClass)obj);

	System.out.println("Description: "+objClass.getDesc());

        //Here we obtains user_type(TypeUser) array returned by query.
	Object[] userArray = (Object[])objClass.getUsers().getArray();
	for(Object user : userArray){
		System.out.println("\tName: " + ((TypeUser)user).getName());
		System.out.println("\tHeight: " + ((TypeUser)user).getHeight());
		System.out.println("\tBirth: " + sdf.format(((TypeUser)user).getBirth())+ "\r\n");
	}
}
</pre>
<p>In the end you&#8217;ll have a <a href="http://www.j2ee.me/j2se/1.4.2/docs/api/java/sql/class-use/Array.html" target="_blank">java.sql.Array</a> of TypeUser in getUsers() attribute of TypeClass.</p>
<p>Here I fulfilled my promise. Download the source code of this sample (with previous post sample too) <a href="http://www.andrels.com/wp-en_US/wp-content/plugins/download-monitor/download.php?id=3" title="Downloaded 216 times">here</a>.</p>
<p>Until next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2009/09/retrieving-objects-collection-from-oracle-procedure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Taking Screen Shots with Java</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2009/09/taking-screen-shots-with-java/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2009/09/taking-screen-shots-with-java/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 14:38:40 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[awt]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=75</guid>
		<description><![CDATA[Here I&#8217;ll show how to implements a class to take Screen shots. I thinking about the complexity of a class<a href="http://www.andrels.com/wp-en_US/index.php/2009/09/taking-screen-shots-with-java/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>Here I&#8217;ll show how to implements a class to take Screen shots.</p>
<p>I thinking about the complexity of a class that takes screen shots and store the files in hard disk and, asking to &#8220;uncle G&#8221;, I fonded the class <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html" target="_blank">Robot</a>, that provide <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html#createScreenCapture(java.awt.Rectangle)" target="_blank">createScreenCapture</a> method.</p>
<p>Now I&#8217;ll show how to implement this functionality:</p>
<pre class="brush:java">Robot robot = new Robot();
//Setting the rectangle that mark capture area. In this case, will be all screen..
Rectangle rect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());

BufferedImage img = robot.createScreenCapture(rect);</pre>
<p>Here we defined capture area and obtained a <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/BufferedImage.html" target="_blank">BufferedImage</a>, our image. Now, we needed to persist in hard disk.</p>
<pre class="brush:java">//Capturing the ImageWriter and ImageWriterParam
ImageWriter writer = ImageIO.getImageWritersByFormatName("jpeg").next();
ImageWriteParam iwp = writer.getDefaultWriteParam();

//Setting compression mode and the image quality
iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
iwp.setCompressionQuality(1);

//Persisting the image
writer.setOutput(new FileImageOutputStream(arquivo));

IIOImage iioimage = new IIOImage(img, null, null);

writer.write(null, iioimage, iwp);
writer.dispose();</pre>
<p>We captured the <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/ImageWriter.html" target="_blank">ImageWriter</a> and <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/ImageWriteParam.html" target="_blank">ImageWriterParam</a> to set the compression method and the image quality.</p>
<p>In line <strong>07</strong> we defined the image quality as 1, where the value can be between 0 (zero), more compression and less quality and 1 (one), less compression and more quality. Then we have kept the file in HD.</p>
<p>We&#8217;ve done! Simple, isn&#8217;t?</p>
<p>Download this sample <a href="http://www.andrels.com/wp-en_US/wp-content/plugins/download-monitor/download.php?id=2" title="Downloaded 138 times">here</a>.</p>
<p>See ya!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2009/09/taking-screen-shots-with-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inserting padding into a JLabel</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2009/08/inserting-padding-into-a-jlabel/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2009/08/inserting-padding-into-a-jlabel/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 15:07:38 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Quick tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=63</guid>
		<description><![CDATA[To insert padding into a JLabel we should use an EmptyBorder, where the attribute &#8216;width&#8217; will be our padding. Like<a href="http://www.andrels.com/wp-en_US/index.php/2009/08/inserting-padding-into-a-jlabel/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>To insert padding into a JLabel we should use an EmptyBorder, where the attribute &#8216;width&#8217; will be our padding. Like this:</p>
<pre class="brush:java">...
JLabel jLabel = new JLabel("My JLabel");
//Border used as padding
Border paddingBorder = BorderFactory.createEmptyBorder(10,10,10,10);

jLabel.setBorder(BorderFactory.createCompoundBorder(border,paddingBorder));
...</pre>
<p>Here, the JLabel contains a padding with 10 pixels in top, right, bottom and left, respectively.</p>
<p><img class="aligncenter size-full wp-image-64" title="0" src="http://www.andrels.com/wp-en_US/wp-content/uploads/2009/08/0.jpg" alt="0" width="300" height="100" /></p>
<p>If you want to put border around the JLabel, you can use a CompoundBorder, setting Border and EmptyBorder (padding):</p>
<pre class="brush:java">...
JLabel jLabel = new JLabel("Meu JLabel");
//Border used as padding
Border paddingBorder = BorderFactory.createEmptyBorder(10,10,10,10);
//JLabel will be involved for this border
Border border = BorderFactory.createLineBorder(Color.BLUE);

jLabel.setBorder(BorderFactory.createCompoundBorder(border,paddingBorder));
...</pre>
<p><img src="http://www.andrels.com/wp-en_US/wp-content/uploads/2009/08/1.jpg" alt="1" title="1" width="300" height="100" class="aligncenter size-full wp-image-65" /></p>
<p>Download the source code of this sample <a href="http://www.andrels.com/wp-en_US/wp-content/plugins/download-monitor/download.php?id=1" title="Downloaded 275 times">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2009/08/inserting-padding-into-a-jlabel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iBatis tutorial, learning the basic</title>
		<link>http://www.andrels.com/wp-en_US/index.php/2009/07/ibatis-tutorial-learning-the-basic/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.andrels.com/wp-en_US/index.php/2009/07/ibatis-tutorial-learning-the-basic/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 20:09:57 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[ibatis]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.andrels.com/wp-en_US/?p=56</guid>
		<description><![CDATA[When we talk about the persistence framework, we think in Hibernate/JPA. Recently I was presented to iBatis, a framework that<a href="http://www.andrels.com/wp-en_US/index.php/2009/07/ibatis-tutorial-learning-the-basic/" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p>When we talk about the persistence framework, we think in Hibernate/JPA. Recently I was presented to iBatis, a framework that so easy to install, to configure and to use. You can download it in your sponsor site, <a href="http://www.apache.org" target="_blank">Apache</a>, clicking <a href="http://ibatis.apache.org/javadownloads.cgi" target="_blank">here</a>.</p>
<p><em><strong>Setting iBatis</strong></em></p>
<p>Unlike another frameworks, to configure iBatis you need only one XML file, called <em>SqlMapConfig</em>.</p>
<p>The mains sections of XML are:</p>
<pre class="brush: xml">&lt;properties resource="tuto/ibatis/config/SqlMap.properties"/&gt;</pre>
<p>This code is optional and specifies the .properties file that&#8217;ll be used to declare variables used in configuration. </p>
<pre class="brush: xml">&lt;typeAlias alias="car" type="tuto.ibatis.beans.Car"/&gt;</pre>
<p>Defines the JavaBean used and your alias. You can set much lines, depending of modeling complexity.<br />
In example, we&#8217;ll Car bean below:</p>
<pre class="brush:java">public class Car {
	private Long carId;
	private String company;
	private String model;
	private String color;
	private Integer	hp;
	private Float price;

	//Setters and getters omitted
}</pre>
<pre class="brush: xml">&lt;transactionManager type="JDBC"&gt;
    &lt;dataSource type="SIMPLE"&gt;
        &lt;property name="JDBC.Driver" value="${driver}"/&gt;
        &lt;property name="JDBC.ConnectionURL" value="${url}"/&gt;
        &lt;property name="JDBC.Username" value="${username}"/&gt;
        &lt;property name="JDBC.Password" value="${password}"/&gt;
    &lt;/dataSource&gt;
&lt;/transactionManager&gt;</pre>
<p>Parameters used in database connection. The variables ${driver}, ${url}, ${username} and ${password} are defined in .properties file in section <i>properties</i>. If you prefer, can put the values directly in fields.</p>
<p>See the complete file:</p>
<pre class="brush: xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
        "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"&gt;

&lt;sqlMapConfig&gt;
    &lt;properties resource="tuto/ibatis/config/SqlMap.properties"/&gt;

    &lt;settings
        cacheModelsEnabled="true"
        enhancementEnabled="true"
        lazyLoadingEnabled="true"
        maxRequests="32"
        maxSessions="10"
        maxTransactions="5"
        useStatementNamespaces="false" /&gt;

    &lt;typeAlias alias="car" type="tuto.ibatis.beans.Car"/&gt;

    &lt;transactionManager type="JDBC"&gt;
        &lt;dataSource type="SIMPLE"&gt;
            &lt;property name="JDBC.Driver" value="${driver}"/&gt;
            &lt;property name="JDBC.ConnectionURL" value="${url}"/&gt;
            &lt;property name="JDBC.Username" value="${username}"/&gt;
            &lt;property name="JDBC.Password" value="${password}"/&gt;
        &lt;/dataSource&gt;
    &lt;/transactionManager&gt;

    &lt;sqlMap resource="tuto/ibatis/sqlmaps/CarSqlMap.xml"/&gt;
&lt;/sqlMapConfig&gt;</pre>
<p>The <em>properties</em> have this content:</p>
<pre class="brush:plain">driver=oracle.jdbc.OracleDriver
url=jdbc:oracle:thin:@&lt;host&gt;:&lt;porta&gt;:&lt;sid&gt;
username=&lt;login&gt;
password=&lt;senha&gt;</pre>
<p>Next you need to configure the <i>SqlMap</i>. This XML contains the querys used in application and your name need be equals described in <i>sqlMap</i> section of <i>SqlMapConfig</i>, in our case will be <i>CarSqlMap.xml</i></p>
<p>In example only we will see utilization of tags select, insert, update and delete.</p>
<pre class="brush:xml">&lt;select id="getCars" resultClass="tuto.ibatis.beans.Car"
	parameterClass="java.lang.Long"&gt;
    SELECT COMPANY  as company,
           MODEL    as model,
           COLOR    as color,
           HP       as hp,
           PRICE    as price
    FROM TBL_CAR
    WHERE CAR_ID = #var#
&lt;/select&gt;</pre>
<p>Execute the <i>select</i> statement can return a single object or one collection of objects, the type is same of <i>resultClass</i> attribute, o <i>parameterClass</i> is the type sent to execute the <i>query</i> and the <i>id</i> is the query identification call.</p>
<p>We will use the SqlMap below:</p>
<pre class="brush:xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
	"http://ibatis.apache.org/dtd/sql-map-2.dtd"&gt;

&lt;sqlMap namespace="Car"&gt;
    &lt;select id="getCars" resultClass="tuto.ibatis.beans.Car"
    parameterClass="java.lang.Long"&gt;
        SELECT COMPANY  as company,
               MODEL    as model,
               COLOR    as color,
               HP       as hp,
               PRICE    as price
        FROM TBL_CAR
        WHERE CAR_ID = #var#
    &lt;/select&gt;

    &lt;insert id="addCar" parameterClass="tuto.ibatis.beans.Car"&gt;
        INSERT INTO TBL_CAR (CAR_ID, COMPANY, MODEL, COLOR, HP, PRICE)
        VALUES (#carId#, #company#, #model#, #color#, #hp#, #price#)
    &lt;/insert&gt;

    &lt;delete id="delCar" parameterClass="java.lang.Long"&gt;
        DELETE FROM TBL_CAR WHERE CAR_ID = #var#
    &lt;/delete&gt;

    &lt;update id="updCar" parameterClass="tuto.ibatis.beans.Car"&gt;
        UPDATE TBL_CAR
          SET COMPANY = #company#,
              MODEL = #model#,
              COLOR = #color#,
              HP = #hp#,
              PRICE = #price#
        WHERE CAR_ID = #carId#
    &lt;/update&gt;
&lt;/sqlMap&gt;</pre>
<p>Data base connection configured, now we will implements the singleton class the will used as <i>SqlMapClient</i>, called OracleMapConfig.</p>
<pre class="brush:java">package tuto.ibatis.connection;

import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class OracleMapConfig {
	private static final SqlMapClient sqlMapClient;

	static{
		try{
			//Defining path of SqlMapConfig and creating reader
			String res = "tuto/ibatis/config/SqlMapConfig.xml";
			Reader reader = Resources.getResourceAsReader(res);

			//Retrieving the client to SqlMap
			sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader);
		} catch(Exception e){
			e.printStackTrace();
			throw new RuntimeException(e);
		}
	}

	//Method used to retrieve the client
	public static SqlMapClient getSqlMapClient(){
		return sqlMapClient;
	}
}</pre>
<p>The client is responsible  for execute the querys configured in SqlMap and return the results.</p>
<p><em><strong>Executing Querys and treating the return</strong></em></p>
<p>To call any query is too simple, only execute the correspondent method of client class.</p>
<p>The <em>select</em> can be called this way:</p>
<pre class="brush:java">OracleMapConfig.getSqlMapClient().queryForObject("&lt;id&gt;", &lt;parâmetro&gt;);</pre>
<p>The<i>id</i> need be equals of <i>id</i> specified in <b>SqlMap</b></p>
<p>Only one line is return in code above, to get all lines change to <em>queryForList</em>, this way:</p>
<pre class="brush:java">OracleMapConfig.getSqlMapClient().queryForList("&lt;id&gt;", &lt;parâmetro&gt;);</pre>
<p>Will be returned a <i>Collection</i> containing the objects;</p>
<p><strong>Select</strong></p>
<pre class="brush:java">try{
	Car car = (Car)OracleMapConfig.getSqlMapClient().queryForObject("getCars",
		new Long(readKeyboard()));

	System.out.println("Company: "+car.getCompany());
	System.out.println("Model: "+car.getModel());
	System.out.println("Color: "+car.getColor());
	System.out.println("HP: "+car.getHp());
	System.out.println("Price: "+car.getPrice());
}catch (Exception e) {
	e.printStackTrace();
}</pre>
<p>The <i>id</i> &#8220;getCars&#8221; are defined in select attributes of <em>SqlMap</em>, providing one Long type and retrieving a Car type, both defined in line &lt;select id=&#8221;<span style="color: #0000ff;">getCars</span>&#8221; resultClass=&#8221;<span style="color: #0000ff;">tuto.ibatis.beans.Car</span>&#8221; parameterClass=&#8221;<span style="color: #0000ff;">java.lang.Long</span>&#8220;&gt;.</p>
<p><strong>Insert</strong></p>
<pre class="brush:java">try{
	OracleMapConfig.getSqlMapClient().insert("addCar", newCar);
}catch (Exception e) {
	e.printStackTrace();
}</pre>
<p>Now we will provide as parameter a Car type, &lt;insert id=&#8221;<span style="color: #0000ff;">addCar</span>&#8221; parameterClass=&#8221;<span style="color: #0000ff;">tuto.ibatis.beans.Car</span>&#8220;&gt;, and call the methods using sharp (#), this way:</p>
<pre class="brush:plain">INSERT INTO TBL_CAR (CAR_ID, COMPANY, MODEL, COLOR, HP, PRICE)
VALUES (#carId#, #company#, #model#, #color#, #hp#, #price#)</pre>
<p><strong>Delete</strong></p>
<pre class="brush:java">try{
	int lines = OracleMapConfig.getSqlMapClient().delete("delCar",
		new Long(readKeyboard()));

	System.out.println(lines + " lines deleted");
}catch (Exception e) {
	e.printStackTrace();
}</pre>
<p>The method <em>delete</em> of <i>client</i> return a type int, this represents the number of rows deleted.</p>
<p><strong>Update</strong></p>
<pre class="brush:java">try{
	int lines = OracleMapConfig.getSqlMapClient().update("updCar", car);

	System.out.println(lines + " cars updated");
}catch (Exception e) {
	e.printStackTrace();
}</pre>
<p>Update return a type int, this represents the number of rows affected by update.</p>
<p>How you see, with only three XML and three classes we built a simple storage management and price consulting system.</p>
<p>You can download the source code of this tutorial clicking <a href="../wordpress_external/downloads/TutoIbatis.zip#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">here</a>.</p>
<p>Until next post!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andrels.com/wp-en_US/index.php/2009/07/ibatis-tutorial-learning-the-basic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

