<?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/"
	>

<channel>
	<title>Mahacode Free Source Code</title>
	<atom:link href="http://www.mahacode.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mahacode.com</link>
	<description>Free Source Code, Java, JSP, Java Script, ASP, VB, PHP, SQL and Entertainment</description>
	<pubDate>Tue, 04 Aug 2009 14:35:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Redundancy Checker</title>
		<link>http://www.mahacode.com/archives/22152/redundancy-checker.html</link>
		<comments>http://www.mahacode.com/archives/22152/redundancy-checker.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 14:35:56 +0000</pubDate>
		<dc:creator>viper</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Collections Data Structure]]></category>

		<category><![CDATA[Custom List]]></category>

		<category><![CDATA[Custom List laquo Collections Data Structure laquo Java]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Redundancy Checker]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22152/redundancy-checker.html</guid>
		<description><![CDATA[

  





/*
&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Code&#160;by&#160;David&#160;Beuze.&#160;No&#160;rights&#160;reserved&#160;:)&#160;-&#160;2006
&#160;*
&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;contact:&#160;smerpy@gmail.com
&#160;*/

/*
&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;This&#160;code&#160;snippet&#160;takes&#160;a&#160;list&#160;of&#160;objects&#160;and&#160;checks&#160;for&#160;any&#160;redundancy&#160;in&#160;the&#160;list.
&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;In&#160;this&#160;example&#160;I&#8217;ve&#160;taken&#160;a&#160;list&#160;of&#160;Integer,&#160;but&#160;it&#160;can&#160;be&#160;generalized&#160;to&#160;any&#160;kind
&#160;*&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;of&#160;object.
&#160;*/

/*Output:
&#160;*&#160;
&#160;*&#160;Oh&#160;no!&#160;The&#160;value&#160;1&#160;is&#160;redundant.
&#160;*&#160;
&#160;*&#160;*/


import&#160;java.util.Arrays;
import&#160;java.util.List;
import&#160;java.util.ListIterator;

public&#160;class&#160;RedundancyChecker&#160;{

&#160;&#160;public&#160;static&#160;void&#160;main(String[]&#160;a)&#160;{
&#160;&#160;&#160;&#160;new&#160;RedundancyChecker();
&#160;&#160;}

&#160;&#160;public&#160;RedundancyChecker()&#160;{

&#160;&#160;&#160;&#160;Integer[]&#160;array&#160;=&#160;new&#160;Integer[5];&#160;//&#160;Create&#160;and
&#160;&#160;&#160;&#160;//&#160;array&#160;of
&#160;&#160;&#160;&#160;//&#160;Integer
&#160;&#160;&#160;&#160;Integer&#160;i0&#160;=&#160;new&#160;Integer(0);
&#160;&#160;&#160;&#160;array[0]&#160;=&#160;i0;
&#160;&#160;&#160;&#160;Integer&#160;i1&#160;=&#160;new&#160;Integer(1);&#160;//&#160;&#60;&#8212;&#8212;&#8211;
&#160;&#160;&#160;&#160;array[1]&#160;=&#160;i1;&#160;//&#160;&#124;
&#160;&#160;&#160;&#160;Integer&#160;i2&#160;=&#160;new&#160;Integer(2);&#160;//&#160;&#124;&#8212;&#160;redundant
&#160;&#160;&#160;&#160;//&#160;values
&#160;&#160;&#160;&#160;array[2]&#160;=&#160;i2;&#160;//&#160;&#124;
&#160;&#160;&#160;&#160;Integer&#160;i3&#160;=&#160;new&#160;Integer(1);&#160;//&#160;&#60;&#8212;&#8212;&#8211;
&#160;&#160;&#160;&#160;array[3]&#160;=&#160;i3;
&#160;&#160;&#160;&#160;Integer&#160;i4&#160;=&#160;new&#160;Integer(4);
&#160;&#160;&#160;&#160;array[4]&#160;=&#160;i4;

&#160;&#160;&#160;&#160;//&#160;transform&#160;the&#160;array&#160;into&#160;a&#160;List
&#160;&#160;&#160;&#160;List&#160;l&#160;=&#160;Arrays.asList(array);

&#160;&#160;&#160;&#160;//&#160;Check&#160;the&#160;List
&#160;&#160;&#160;&#160;checkForRedundancy(l);
&#160;&#160;}

&#160;&#160;public&#160;boolean&#160;checkForRedundancy(List&#160;l)&#160;{
&#160;&#160;&#160;&#160;ListIterator&#160;li1&#160;=&#160;l.listIterator();&#160;//&#160;Make&#160;a
&#160;&#160;&#160;&#160;//&#160;general
&#160;&#160;&#160;&#160;//&#160;ListIterator
&#160;&#160;&#160;&#160;//&#160;on&#160;the&#160;list

&#160;&#160;&#160;&#160;while&#160;(li1.hasNext())&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;Store&#160;the&#160;value&#160;of&#160;the&#160;actual&#160;first&#160;checked
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;element&#160;of&#160;the&#160;List,
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;it&#160;needs&#160;to&#160;be&#160;stored&#160;because&#160;it&#160;calls&#160;the
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;.next(),&#160;which&#160;we&#160;can&#160;call&#160;only&#160;once&#160;per&#160;loop
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;in&#160;order&#160;to&#160;sweep&#160;the&#160;whole&#160;list.
&#160;&#160;&#160;&#160;&#160;&#160;int&#160;check1&#160;=&#160;((Integer)&#160;li1.next()).intValue();

&#160;&#160;&#160;&#160;&#160;&#160;//&#160;Make&#160;a&#160;second&#160;ListIterator&#160;that&#160;will&#160;start
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;with&#160;the&#160;element&#160;that&#160;is&#160;just&#160;after&#160;the
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;actual&#160;first&#160;checked&#160;one,
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;in&#160;order&#160;to&#160;avoid&#160;checking&#160;several&#160;times&#160;the
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;same&#160;elements.
&#160;&#160;&#160;&#160;&#160;&#160;ListIterator&#160;li2&#160;=&#160;l.listIterator(li1.nextIndex()&#160;+&#160;1);

&#160;&#160;&#160;&#160;&#160;&#160;while&#160;(li2.hasNext())&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;Store&#160;the&#160;following&#160;elements&#160;one&#160;by
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;one&#160;and&#160;check&#160;to&#160;see&#160;if&#160;they&#160;match
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;the&#160;actual&#160;one.
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;check2&#160;=&#160;((Integer)&#160;li2.next()).intValue();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;(check1&#160;==&#160;check2)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.out.println(&#34;Oh&#160;no!&#160;The&#160;value&#160;&#34;&#160;+&#160;check1&#160;+&#160;&#34;&#160;is&#160;redundant.&#34;);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;true;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;The&#160;.next()&#160;method&#160;has&#160;already&#160;been&#160;called&#160;at
&#160;&#160;&#160;&#160;&#160;&#160;//&#160;the&#160;beginning&#160;of&#160;the&#160;loop.
&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;return&#160;false;
&#160;&#160;}
}
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22152/redundancy-checker.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using the TRANSLATE() Function: to encode and decode</title>
		<link>http://www.mahacode.com/archives/22151/using-the-translate-function-to-encode-and-decode.html</link>
		<comments>http://www.mahacode.com/archives/22151/using-the-translate-function-to-encode-and-decode.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 14:05:10 +0000</pubDate>
		<dc:creator>user</dc:creator>
		
		<category><![CDATA[Char Functions]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Oracle PL / SQL]]></category>

		<category><![CDATA[to encode and decode]]></category>

		<category><![CDATA[Translate]]></category>

		<category><![CDATA[Translate laquo Char Functions laquo Oracle PL  SQL]]></category>

		<category><![CDATA[Using the TRANSLATE Function]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22151/using-the-translate-function-to-encode-and-decode.html</guid>
		<description><![CDATA[

  



SQL&#62;
SQL&#62;&#160;&#8211;Using&#160;the&#160;TRANSLATE()&#160;Function
SQL&#62;
SQL&#62;&#160;&#8211;TRANSLATE(x,&#160;from_string,&#160;to_string)&#160;to&#160;convert&#160;the&#160;occurrences&#160;of&#160;characters&#160;in&#160;from_string&#160;found&#160;in&#160;x&#160;to&#160;corresponding&#160;characters&#160;in&#160;to_string.
SQL&#62;
SQL&#62;&#160;&#8211;TRANSLATE():&#160;shift&#160;each&#160;character&#160;in&#160;the&#160;string&#160;SECRET&#160;MESSAGE:&#160;MEET&#160;ME&#160;IN&#160;THE&#160;PARK&#160;by&#160;four&#160;places&#160;to&#160;the&#160;right:&#160;A&#160;becomes&#160;E,&#160;B&#160;becomes&#160;F
SQL&#62;
SQL&#62;&#160;SELECT&#160;TRANSLATE(&#8216;SECRET&#160;MESSAGE:&#160;MEET&#160;ME&#160;IN&#160;THE&#160;PARK&#8216;,
&#160;&#160;2&#160;&#160;&#160;&#160;&#160;&#8216;ABCDEFGHIJKLMNOPQRSTUVWXYZ&#8216;,
&#160;&#160;3&#160;&#160;&#160;&#160;&#160;&#8216;EFGHIJKLMNOPQRSTUVWXYZABCD&#8216;)&#160;FROM&#160;dual;

TRANSLATE(&#8216;SECRETMESSAGE:MEETMEINTH
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
WIGVIX&#160;QIWWEKI:&#160;QIIX&#160;QI&#160;MR&#160;XLI&#160;TEVO

SQL&#62;
SQL&#62;&#160;&#8211;select&#160;translate(&#8216;www.java2s.com&#8216;,&#8217;wjavscom&#8216;,&#8217;abced123&#8216;)&#160;from&#160;dual;
SQL&#62;
SQL&#62;

&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22151/using-the-translate-function-to-encode-and-decode.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Currency: getInstance(Locale loc)</title>
		<link>http://www.mahacode.com/archives/22150/currency-getinstancelocale-loc.html</link>
		<comments>http://www.mahacode.com/archives/22150/currency-getinstancelocale-loc.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 13:35:11 +0000</pubDate>
		<dc:creator>login</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Currency]]></category>

		<category><![CDATA[Currency laquo javautil laquo Java by API]]></category>

		<category><![CDATA[getInstanceLocale loc]]></category>

		<category><![CDATA[Java by API]]></category>

		<category><![CDATA[java.util]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22150/currency-getinstancelocale-loc.html</guid>
		<description><![CDATA[

  



/*
&#160;*&#160;Output:&#160;
Symbol:&#160;$
Default&#160;fractional&#160;digits:&#160;2
&#160;*/

import&#160;java.util.Currency;
import&#160;java.util.Locale;

public&#160;class&#160;MainClass&#160;{
&#160;&#160;public&#160;static&#160;void&#160;main(String&#160;args[])&#160;{
&#160;&#160;&#160;&#160;Currency&#160;c;

&#160;&#160;&#160;&#160;c&#160;=&#160;Currency.getInstance(Locale.US);

&#160;&#160;&#160;&#160;System.out.println(&#34;Symbol:&#160;&#34;&#160;+&#160;c.getSymbol());
&#160;&#160;&#160;&#160;System.out.println(&#34;Default&#160;fractional&#160;digits:&#160;&#34;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;+&#160;c.getDefaultFractionDigits());
&#160;&#160;}
}


&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22150/currency-getinstancelocale-loc.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Assign value to global variable</title>
		<link>http://www.mahacode.com/archives/22149/assign-value-to-global-variable.html</link>
		<comments>http://www.mahacode.com/archives/22149/assign-value-to-global-variable.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 13:05:11 +0000</pubDate>
		<dc:creator>viper</dc:creator>
		
		<category><![CDATA[Assign value to global variable]]></category>

		<category><![CDATA[C]]></category>

		<category><![CDATA[C / ANSI-C]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Language Basics]]></category>

		<category><![CDATA[Variable Scope]]></category>

		<category><![CDATA[Variable Scope laquo Language Basics laquo C  ANSI]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22149/assign-value-to-global-variable.html</guid>
		<description><![CDATA[

  



#include&#160;&#60;stdio.h&#62;

int&#160;count;

int&#160;main(void)
{
&#160;&#160;extern&#160;int&#160;count;&#160;/*&#160;this&#160;refers&#160;to&#160;global&#160;count&#160;*/

&#160;&#160;count&#160;=&#160;10;
&#160;&#160;printf(&#34;%d&#34;,&#160;count);

&#160;&#160;return&#160;0;
}


&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22149/assign-value-to-global-variable.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Copy vector and list</title>
		<link>http://www.mahacode.com/archives/22148/copy-vector-and-list.html</link>
		<comments>http://www.mahacode.com/archives/22148/copy-vector-and-list.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 12:35:10 +0000</pubDate>
		<dc:creator>username</dc:creator>
		
		<category><![CDATA[C]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[copy]]></category>

		<category><![CDATA[copy laquo STL Algorithms Modifying sequence operations laquo C]]></category>

		<category><![CDATA[Copy vector and list]]></category>

		<category><![CDATA[STL Algorithms Modifying sequence operations]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22148/copy-vector-and-list.html</guid>
		<description><![CDATA[

  


&#160;
&#160;

/*&#160;The&#160;following&#160;code&#160;example&#160;is&#160;taken&#160;from&#160;the&#160;book
&#160;*&#160;&#34;The&#160;C++&#160;Standard&#160;Library&#160;-&#160;A&#160;Tutorial&#160;and&#160;Reference&#34;
&#160;*&#160;by&#160;Nicolai&#160;M.&#160;Josuttis,&#160;Addison-Wesley,&#160;1999
&#160;*
&#160;*&#160;(C)&#160;Copyright&#160;Nicolai&#160;M.&#160;Josuttis&#160;1999.
&#160;*&#160;Permission&#160;to&#160;copy,&#160;use,&#160;modify,&#160;sell&#160;and&#160;distribute&#160;this&#160;software
&#160;*&#160;is&#160;granted&#160;provided&#160;this&#160;copyright&#160;notice&#160;appears&#160;in&#160;all&#160;copies.
&#160;*&#160;This&#160;software&#160;is&#160;provided&#160;&#34;as&#160;is&#34;&#160;without&#160;express&#160;or&#160;implied
&#160;*&#160;warranty,&#160;and&#160;with&#160;no&#160;claim&#160;as&#160;to&#160;its&#160;suitability&#160;for&#160;any&#160;purpose.
&#160;*/
#include&#160;&#60;iostream&#62;
#include&#160;&#60;vector&#62;
#include&#160;&#60;list&#62;
#include&#160;&#60;deque&#62;
#include&#160;&#60;algorithm&#62;
using&#160;namespace&#160;std;

int&#160;main()
{
&#160;&#160;&#160;&#160;list&#60;int&#62;&#160;&#160;&#160;coll1;
&#160;&#160;&#160;&#160;vector&#60;int&#62;&#160;coll2;
&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;//&#160;insert&#160;elements&#160;from&#160;1&#160;to&#160;9
&#160;&#160;&#160;&#160;for&#160;(int&#160;i=1;&#160;i&#60;=9;&#160;++i)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;coll1.push_back(i);
&#160;&#160;&#160;&#160;}

&#160;&#160;&#160;&#160;//&#160;resize&#160;destination&#160;to&#160;have&#160;enough&#160;room&#160;for&#160;the&#160;overwriting&#160;algorithm
&#160;&#160;&#160;&#160;coll2.resize&#160;(coll1.size());

&#160;&#160;&#160;&#160;/*&#160;copy&#160;elements&#160;from&#160;first&#160;into&#160;second&#160;collection
&#160;&#160;&#160;&#160;&#160;*&#160;-&#160;overwrites&#160;existing&#160;elements&#160;in&#160;destination
&#160;&#160;&#160;&#160;&#160;*/
&#160;&#160;&#160;&#160;copy&#160;(coll1.begin(),&#160;coll1.end(),&#160;&#160;&#160;&#160;&#160;//&#160;source
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;coll2.begin());&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;destination

&#160;&#160;&#160;&#160;/*&#160;create&#160;third&#160;collection&#160;with&#160;enough&#160;room
&#160;&#160;&#160;&#160;&#160;*&#160;-&#160;initial&#160;size&#160;is&#160;passed&#160;as&#160;parameter
&#160;&#160;&#160;&#160;&#160;*/
&#160;&#160;&#160;&#160;deque&#60;int&#62;&#160;coll3(coll1.size());

&#160;&#160;&#160;&#160;//&#160;copy&#160;elements&#160;from&#160;first&#160;into&#160;third&#160;collection
&#160;&#160;&#160;&#160;copy&#160;(coll1.begin(),&#160;coll1.end(),&#160;&#160;&#160;&#160;&#160;//&#160;source
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;coll3.begin());&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;destination
}

&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22148/copy-vector-and-list.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>JFrame: setDefaultCloseOperation(int option)</title>
		<link>http://www.mahacode.com/archives/22147/jframe-setdefaultcloseoperationint-option.html</link>
		<comments>http://www.mahacode.com/archives/22147/jframe-setdefaultcloseoperationint-option.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 12:05:16 +0000</pubDate>
		<dc:creator>root</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Java by API]]></category>

		<category><![CDATA[javax.swing]]></category>

		<category><![CDATA[JFrame]]></category>

		<category><![CDATA[JFrame laquo javaxswing laquo Java by API]]></category>

		<category><![CDATA[setDefaultCloseOperationint option]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22147/jframe-setdefaultcloseoperationint-option.html</guid>
		<description><![CDATA[

  



/*
&#160;*&#160;Output:
&#160;*&#160;&#160;
&#160;*/

import&#160;java.awt.Color;
import&#160;java.awt.Dimension;
import&#160;java.awt.Font;
import&#160;java.awt.Graphics;

import&#160;javax.swing.JFrame;
import&#160;javax.swing.JPanel;

public&#160;class&#160;MainClass&#160;extends&#160;JPanel&#160;{

&#160;&#160;public&#160;void&#160;paint(Graphics&#160;g)&#160;{
&#160;&#160;&#160;&#160;Dimension&#160;d&#160;=&#160;this.getPreferredSize();
&#160;&#160;&#160;&#160;int&#160;fontSize&#160;=&#160;20;

&#160;&#160;&#160;&#160;g.setFont(new&#160;Font(&#34;TimesRoman&#34;,&#160;Font.PLAIN,&#160;fontSize));
&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;g.setColor(Color.red);
&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;g.drawString(&#34;www.java2s.com&#34;,&#160;10,&#160;20);
&#160;&#160;}

&#160;&#160;public&#160;static&#160;void&#160;main(String[]&#160;args)&#160;{
&#160;&#160;&#160;&#160;JFrame&#160;frame&#160;=&#160;new&#160;JFrame();
&#160;&#160;&#160;&#160;frame.getContentPane().add(new&#160;MainClass());

&#160;&#160;&#160;&#160;frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
&#160;&#160;&#160;&#160;frame.setSize(200,200);
&#160;&#160;&#160;&#160;frame.setVisible(true);
&#160;&#160;}
}

&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22147/jframe-setdefaultcloseoperationint-option.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>System.out.printf(&#8217;%c&#8217;, char ch )</title>
		<link>http://www.mahacode.com/archives/22146/systemoutprintfc-char-ch.html</link>
		<comments>http://www.mahacode.com/archives/22146/systemoutprintfc-char-ch.html#comments</comments>
		<pubDate>Tue, 04 Aug 2009 11:35:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[char ch]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Java by API]]></category>

		<category><![CDATA[java.lang]]></category>

		<category><![CDATA[System.out.printf]]></category>

		<category><![CDATA[Systemoutprintf laquo javalang laquo Java by API]]></category>

		<category><![CDATA[Systemoutprintfc]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22146/systemoutprintfc-char-ch.html</guid>
		<description><![CDATA[

  




/**
&#160;Output:

&#160;char&#160;value&#160;is&#160;a
&#160;
&#160;*&#160;*/

public&#160;class&#160;MainClass&#160;{
&#160;&#160;public&#160;static&#160;void&#160;main(String&#160;args[])&#160;throws&#160;Exception&#160;{

&#160;&#160;&#160;&#160;//char&#160;value&#160;is&#160;a
&#160;&#160;&#160;&#160;System.out.printf(&#34;char&#160;value&#160;is&#160;%c\n&#34;,&#160;&#8216;a&#8217;&#160;);

&#160;&#160;}
}

&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22146/systemoutprintfc-char-ch.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Use swap_ranges to swap elements in one container with corresponding elements in another container</title>
		<link>http://www.mahacode.com/archives/22145/use-swap_ranges-to-swap-elements-in-one-container-with-corresponding-elements-in-another-container.html</link>
		<comments>http://www.mahacode.com/archives/22145/use-swap_ranges-to-swap-elements-in-one-container-with-corresponding-elements-in-another-container.html#comments</comments>
		<pubDate>Mon, 03 Aug 2009 23:33:04 +0000</pubDate>
		<dc:creator>tomahawk</dc:creator>
		
		<category><![CDATA[C]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[STL Algorithms Modifying sequence operations]]></category>

		<category><![CDATA[swapranges laquo STL Algorithms Modifying sequence operations laquo C]]></category>

		<category><![CDATA[swap_ranges]]></category>

		<category><![CDATA[Use swapranges to swap elements in one container with corresponding elements in another container]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22145/use-swap_ranges-to-swap-elements-in-one-container-with-corresponding-elements-in-another-container.html</guid>
		<description><![CDATA[

  


&#160;
&#160;

/*&#160;The&#160;following&#160;code&#160;example&#160;is&#160;taken&#160;from&#160;the&#160;book
&#160;*&#160;&#34;The&#160;C++&#160;Standard&#160;Library&#160;-&#160;A&#160;Tutorial&#160;and&#160;Reference&#34;
&#160;*&#160;by&#160;Nicolai&#160;M.&#160;Josuttis,&#160;Addison-Wesley,&#160;1999
&#160;*
&#160;*&#160;(C)&#160;Copyright&#160;Nicolai&#160;M.&#160;Josuttis&#160;1999.
&#160;*&#160;Permission&#160;to&#160;copy,&#160;use,&#160;modify,&#160;sell&#160;and&#160;distribute&#160;this&#160;software
&#160;*&#160;is&#160;granted&#160;provided&#160;this&#160;copyright&#160;notice&#160;appears&#160;in&#160;all&#160;copies.
&#160;*&#160;This&#160;software&#160;is&#160;provided&#160;&#34;as&#160;is&#34;&#160;without&#160;express&#160;or&#160;implied
&#160;*&#160;warranty,&#160;and&#160;with&#160;no&#160;claim&#160;as&#160;to&#160;its&#160;suitability&#160;for&#160;any&#160;purpose.
&#160;*/

#include&#160;&#60;iostream&#62;
#include&#160;&#60;vector&#62;
#include&#160;&#60;deque&#62;
#include&#160;&#60;list&#62;
#include&#160;&#60;set&#62;
#include&#160;&#60;map&#62;
#include&#160;&#60;string&#62;
#include&#160;&#60;algorithm&#62;
#include&#160;&#60;iterator&#62;
#include&#160;&#60;functional&#62;
#include&#160;&#60;numeric&#62;

/*&#160;PRINT_ELEMENTS()
&#160;*&#160;-&#160;prints&#160;optional&#160;C-string&#160;optcstr&#160;followed&#160;by
&#160;*&#160;-&#160;all&#160;elements&#160;of&#160;the&#160;collection&#160;coll
&#160;*&#160;-&#160;separated&#160;by&#160;spaces
&#160;*/
template&#160;&#60;class&#160;T&#62;
inline&#160;void&#160;PRINT_ELEMENTS&#160;(const&#160;T&#38;&#160;coll,&#160;const&#160;char*&#160;optcstr=&#34;&#34;)
{
&#160;&#160;&#160;&#160;typename&#160;T::const_iterator&#160;pos;

&#160;&#160;&#160;&#160;std::cout&#160;&#60;&#60;&#160;optcstr;
&#160;&#160;&#160;&#160;for&#160;(pos=coll.begin();&#160;pos!=coll.end();&#160;++pos)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;std::cout&#160;&#60;&#60;&#160;*pos&#160;&#60;&#60;&#160;&#8216;&#160;&#8217;;
&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;std::cout&#160;&#60;&#60;&#160;std::endl;
}

/*&#160;INSERT_ELEMENTS&#160;(collection,&#160;first,&#160;last)
&#160;*&#160;-&#160;fill&#160;values&#160;from&#160;first&#160;to&#160;last&#160;into&#160;the&#160;collection
&#160;*&#160;-&#160;NOTE:&#160;NO&#160;half-open&#160;range
&#160;*/
template&#160;&#60;class&#160;T&#62;
inline&#160;void&#160;INSERT_ELEMENTS&#160;(T&#38;&#160;coll,&#160;int&#160;first,&#160;int&#160;last)
{
&#160;&#160;&#160;&#160;for&#160;(int&#160;i=first;&#160;i&#60;=last;&#160;++i)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;coll.insert(coll.end(),i);
&#160;&#160;&#160;&#160;}
}

using&#160;namespace&#160;std;

int&#160;main()&#160;{
&#160;&#160;&#160;&#160;vector&#60;int&#62;&#160;coll1;
&#160;&#160;&#160;&#160;deque&#60;int&#62;&#160;coll2;

&#160;&#160;&#160;&#160;INSERT_ELEMENTS(coll1,1,9);
&#160;&#160;&#160;&#160;INSERT_ELEMENTS(coll2,11,23);

&#160;&#160;&#160;&#160;PRINT_ELEMENTS(coll1,&#34;coll1:&#160;&#34;);
&#160;&#160;&#160;&#160;PRINT_ELEMENTS(coll2,&#34;coll2:&#160;&#34;);

&#160;&#160;&#160;&#160;//&#160;swap&#160;elements&#160;of&#160;coll1&#160;with&#160;corresponding&#160;elements&#160;of&#160;coll2
&#160;&#160;&#160;&#160;deque&#60;int&#62;::iterator&#160;pos;
&#160;&#160;&#160;&#160;pos&#160;=&#160;swap_ranges&#160;(coll1.begin(),&#160;coll1.end(),&#160;&#160;//&#160;first&#160;range
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;coll2.begin());&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;second&#160;range

&#160;&#160;&#160;&#160;PRINT_ELEMENTS(coll1,&#34;\ncoll1:&#160;&#34;);
&#160;&#160;&#160;&#160;PRINT_ELEMENTS(coll2,&#34;coll2:&#160;&#34;);
&#160;&#160;&#160;&#160;if&#160;(pos&#160;!=&#160;coll2.end())&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cout&#160;&#60;&#60;&#160;&#34;first&#160;element&#160;not&#160;modified:&#160;&#34;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;&#60;&#160;*pos&#160;&#60;&#60;&#160;endl;
&#160;&#160;&#160;&#160;}
}

/*&#160;
coll1:&#160;1&#160;2&#160;3&#160;4&#160;5&#160;6&#160;7&#160;8&#160;9
coll2:&#160;11&#160;12&#160;13&#160;14&#160;15&#160;16&#160;17&#160;18&#160;19&#160;20&#160;21&#160;22&#160;23

coll1:&#160;11&#160;12&#160;13&#160;14&#160;15&#160;16&#160;17&#160;18&#160;19
coll2:&#160;1&#160;2&#160;3&#160;4&#160;5&#160;6&#160;7&#160;8&#160;9&#160;20&#160;21&#160;22&#160;23
first&#160;element&#160;not&#160;modified:&#160;20

&#160;*/&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22145/use-swap_ranges-to-swap-elements-in-one-container-with-corresponding-elements-in-another-container.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>JSplitPane: addHierarchyListener(HierarchyListener l)</title>
		<link>http://www.mahacode.com/archives/22144/jsplitpane-addhierarchylistenerhierarchylistener-l.html</link>
		<comments>http://www.mahacode.com/archives/22144/jsplitpane-addhierarchylistenerhierarchylistener-l.html#comments</comments>
		<pubDate>Mon, 03 Aug 2009 23:10:47 +0000</pubDate>
		<dc:creator>root</dc:creator>
		
		<category><![CDATA[addHierarchyListenerHierarchyListener l]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Java by API]]></category>

		<category><![CDATA[javax.swing]]></category>

		<category><![CDATA[JSplitPane]]></category>

		<category><![CDATA[JSplitPane laquo javaxswing laquo Java by API]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22144/jsplitpane-addhierarchylistenerhierarchylistener-l.html</guid>
		<description><![CDATA[

  




import&#160;java.awt.BorderLayout;
import&#160;java.awt.event.ActionEvent;
import&#160;java.awt.event.ActionListener;
import&#160;java.awt.event.HierarchyEvent;
import&#160;java.awt.event.HierarchyListener;

import&#160;javax.swing.JButton;
import&#160;javax.swing.JComponent;
import&#160;javax.swing.JFrame;
import&#160;javax.swing.JSplitPane;

public&#160;class&#160;MainClass&#160;{
&#160;&#160;public&#160;static&#160;void&#160;main(String&#160;args[])&#160;throws&#160;Exception&#160;{
&#160;&#160;&#160;&#160;JFrame&#160;vFrame&#160;=&#160;new&#160;JFrame(&#34;Vertical&#160;Split&#34;);
&#160;&#160;&#160;&#160;vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
&#160;&#160;&#160;&#160;JComponent&#160;leftButton&#160;=&#160;new&#160;JButton(&#34;Left&#34;);
&#160;&#160;&#160;&#160;JComponent&#160;rightButton&#160;=&#160;new&#160;JButton(&#34;Right&#34;);
&#160;&#160;&#160;&#160;final&#160;JSplitPane&#160;splitPane&#160;=&#160;new&#160;JSplitPane(JSplitPane.VERTICAL_SPLIT);
&#160;&#160;&#160;&#160;splitPane.setOneTouchExpandable(true);
&#160;&#160;&#160;&#160;splitPane.setLeftComponent(leftButton);
&#160;&#160;&#160;&#160;splitPane.setRightComponent(rightButton);
&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;ActionListener&#160;oneActionListener&#160;=&#160;new&#160;ActionListener()&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;public&#160;void&#160;actionPerformed(ActionEvent&#160;event)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;splitPane.resetToPreferredSizes();
&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;};
&#160;&#160;&#160;&#160;((JButton)&#160;rightButton).addActionListener(oneActionListener);
&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;ActionListener&#160;anotherActionListener&#160;=&#160;new&#160;ActionListener()&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;public&#160;void&#160;actionPerformed(ActionEvent&#160;event)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;splitPane.setDividerLocation(10);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;splitPane.setContinuousLayout(true);
&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;};
&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;((JButton)&#160;leftButton).addActionListener(anotherActionListener);

&#160;&#160;&#160;&#160;HierarchyListener&#160;hierarchyListener&#160;=&#160;new&#160;HierarchyListener()&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;public&#160;void&#160;hierarchyChanged(HierarchyEvent&#160;e)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long&#160;flags&#160;=&#160;e.getChangeFlags();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;((flags&#160;&#38;&#160;HierarchyEvent.SHOWING_CHANGED)&#160;==&#160;HierarchyEvent.SHOWING_CHANGED)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;splitPane.setDividerLocation(.75);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;};
&#160;&#160;&#160;&#160;splitPane.addHierarchyListener(hierarchyListener);

&#160;&#160;&#160;&#160;vFrame.add(splitPane,&#160;BorderLayout.CENTER);
&#160;&#160;&#160;&#160;vFrame.setSize(300,&#160;150);
&#160;&#160;&#160;&#160;vFrame.setVisible(true);
&#160;&#160;}

}

&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22144/jsplitpane-addhierarchylistenerhierarchylistener-l.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Data Dictionary Scope</title>
		<link>http://www.mahacode.com/archives/22143/data-dictionary-scope.html</link>
		<comments>http://www.mahacode.com/archives/22143/data-dictionary-scope.html#comments</comments>
		<pubDate>Mon, 03 Aug 2009 22:40:16 +0000</pubDate>
		<dc:creator>tomahawk</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Data Dictionary Scope]]></category>

		<category><![CDATA[DBATables laquo System Tables Views laquo Oracle PL  SQL]]></category>

		<category><![CDATA[DBA_Tables]]></category>

		<category><![CDATA[Oracle PL / SQL]]></category>

		<category><![CDATA[System Tables Views]]></category>

		<guid isPermaLink="false">http://www.mahacode.com/archives/22143/data-dictionary-scope.html</guid>
		<description><![CDATA[

  


&#160;
SQL&#62;
SQL&#62;
SQL&#62;&#160;select&#160;owner,&#160;table_name,&#160;tablespace_name
&#160;&#160;2&#160;&#160;from&#160;dba_tables
&#160;&#160;3&#160;&#160;where&#160;owner&#160;in&#160;(&#8216;SCOTT&#8216;,&#160;&#8217;HR&#8217;)&#160;and&#160;rownum&#160;&#60;&#160;50
&#160;&#160;4&#160;&#160;order&#160;by&#160;owner,&#160;tablespace_name,&#160;table_name;

OWNER&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;TABLE_NAME&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;TABLESPACE_NAME
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#160;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#160;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
HR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DEPARTMENTS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USERS
HR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;EMPLOYEES&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USERS
HR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;JOBS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USERS
HR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;JOB_HISTORY&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USERS
HR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;LOCATIONS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USERS
HR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;REGIONS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;USERS
HR&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;COUNTRIES

7&#160;rows&#160;selected.

SQL&#62;

&#160;

  
   

]]></description>
		<wfw:commentRss>http://www.mahacode.com/archives/22143/data-dictionary-scope.html/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
