<?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>TheBoox(Code, Linux, Hack,Security)</title>
	<atom:link href="http://theboox.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://theboox.com</link>
	<description>Coding, Linux, Hacking Security, Learning!</description>
	<lastBuildDate>Wed, 21 Jul 2010 15:02:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>how to debug in java</title>
		<link>http://theboox.com/?p=169</link>
		<comments>http://theboox.com/?p=169#comments</comments>
		<pubDate>Wed, 21 Jul 2010 15:02:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[debug java]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=169</guid>
		<description><![CDATA[Once your Java program has compiled you may need to debug it. The  most important things    you need to do is to find out the values of variables in your code  and monitor the execution    of the code, particularly the calling of procedures and functions.
The java System.out.println <a href="http://theboox.com/?p=169" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Once your Java program has compiled you may need to debug it. The  most important things    you need to do is to find out the values of variables in your code  and monitor the execution    of the code, particularly the calling of procedures and functions.</p>
<p>The java <tt>System.out.println</tt> statement is and effective  way to debug a program.    Placing &#8220;debugging printouts&#8221; throughout the program at critical  places    to monitor the execution can be helpful. These printouts    can easily be commented out when the debugging is completed, and  later    uncommented if further bugs show up later.</p>
<p>But what to do when this becomes too tedious?  Another option is  to    use a debugger, such as <tt>jdb</tt>. We&#8217;ll go through an example  which takes you    through some basic debugging tasks.  This tutorial goes through using    the text version of the debugger.  At the completion of the tutorial    you should be comfortable enough with the different debugging  techniques.     For those students that want the debugger to be a little more visual,  there    is a further tutorial that teaches you how to integrate <tt>jdb</tt> and Emacs together    into a development tool (see the bottom of this tutorial).</p>
<ul>
<li> Say there was some problem in our factorial program and you were  pretty       sure the problem had to do with the recursion.  The debugger would       be very useful in allowing you to step through the code, and show  you the       intermediate values being generated at each recursive call.  To  get       an idea of how to do this, let&#8217;s step through the code for an  input of       4.  To run <tt>jdb</tt> on the file named <tt>fact.class</tt> with  an input       of <tt>4</tt>, type :<br />
<blockquote>
<pre>jdb fact 4
</pre>
</blockquote>
</li>
<li> You will see some output about <tt>jdb</tt> being initialized, and  then you should       see the command prompt &#8220;<tt>&gt; </tt>&#8220;</li>
<li> If you type <tt>help</tt>, you will be given a list of the  debugger       commands along with a short description of what they do.</li>
<li> The first thing to do is set a break point at the very start of  the program       so that when it is run, you can step through the application.  The       <tt>stop in</tt> and <tt>stop at</tt> commands allow you to set  breakpoints in the       program.  Type in the following to set a break point at the first       line of the main method:<br />
<blockquote>
<pre>stop in fact.main
</pre>
</blockquote>
</li>
<li> Now start the program running by typing<br />
<blockquote>
<pre>run
</pre>
</blockquote>
</li>
<li> Now the program is being run, and it is temporarily halted.  To  see       where in the code the program is halted you type<br />
<blockquote>
<pre>list
</pre>
</blockquote>
<p>It shows you the source code around the next instruction to be  executed       (indicated by the <tt>=&gt;</tt>).</li>
<li> Now we want to set a breakpoint after the preamble of the program  that       converts the input to a number.  If you type <tt>list 55</tt> you will see the code that calls the Factorial routine.  Set the  next       breakpoint by typing <tt>stop at fact:55</tt>.</li>
<li> Type <tt>cont</tt> to continue running to the breakpoint.</li>
<li> Now we want to step into the Factorial routine.  Type <tt>step</tt>.       You will see a message saying that the breakpoint for the       <tt>java.lang.ClassLoader.loadClass</tt> was hit.  This is some  auxiliary code       that you are not interested in.  Type <tt>step up</tt> to get       back to the main routine, and type <tt>step</tt> again to get  inside       the Factorial method.</li>
<li> To take a look at the variables inside the method (those that have  been set)       type <tt>locals</tt>.  You should see the value of <tt>4</tt> for the <tt>num</tt> variable passed in.</li>
<li> Type <tt>step</tt> again, and type in <tt>locals</tt>.  This       time you should see the values for both <tt>num</tt> and <tt>calc</tt>.         The last instruction set the local variable calc to 0, so now it  appears       in the list.  You can see that by typing in the <tt>list</tt> command.</li>
<li> Keep stepping through the code looking at the variables after each  recursive       call.  You will see the value of <tt>num</tt> being decremented  each       iteration.  Keep doing this until finally you step into the line  of       code that sets the return value to 1 (<tt>calc</tt> <tt>= 1;</tt>).  Again, the        <tt>list</tt> command will help you keep an eye on where in the  code you are.        Step over that line of code and look at the locals now: <tt>calc</tt> has       changed to <tt>1</tt>.</li>
<li> At this point it is worth noting that the <tt>up</tt> and <tt>down</tt> commands allow you to go up and down the call stack to look at the  values       of the local variables in the methods that called the current one.         For instance, typing <tt>up</tt> and <tt>locals</tt> will       show you the previous iteration of the Factorial recursion (with  num =       2).  Don&#8217;t forget to type <tt>down</tt> to return the stack       frame to the bottom of the calling stack.</li>
<li> Continue to type <tt>step</tt> and type <tt>locals</tt> to watch  the value       of <tt>calc</tt> grow (factorially) as each recursive call  returns.</li>
<li> Finally you will return to the main procedure.  You will know this       by the output of:<br />
<blockquote>
<pre>Breakpoint hit: fact.main (fact:55)
</pre>
</blockquote>
<p>At this point we just want the program to run to completion, so       simply type <tt>cont</tt>.  The program will print the output       of 24 to the screen, and the program/debugger will quit.</li>
<li> Run the program a couple more times and try to play with the other  commands.        If you type <tt>man jdb</tt> from the Unix prompt, you will be  presented       with a little more detail about how the commands work.</li>
</ul>
<h2>Test Your Debugging Skills</h2>
<p>Now it&#8217;s time to try your hand at debugging some code.  We will  now    look at the <tt>fib.java</tt> program which produces the desired  Fibonacci    number using the same recursive method as the last program.  However,  there    are two errors in the program.  The first is a bug that prevents the    program from properly compiling, and the other is a logic error in  the    code.</p>
<ul>
<li> Try to compile the Fibonnaci program:<br />
<blockquote>
<pre>javac -g fib.java
</pre>
</blockquote>
</li>
<li> You will receive an error message describing an error at line 15  pertaining       to fact not being declared.  Open up the program with your  favourite editor and go       to line 15.  In Pico, you can find out what line you are on by  pressing <tt>Ctrl-C</tt> in the editor.  The message indicated that there is a problem with       this declaration.  Do you see the problem?  Fix the error and       save the changes.  In case you can&#8217;t figure out the error, the  answer appears       at the bottom of this document.</li>
<li> Now compile the program and run the program by typing <tt>java fib  0</tt></li>
<li> Run the program with an input of 0 and 1.  So far so good.  Now       run the program with an input of 4.  You will see an unending  streak       of errors, with no indication of where the error is.  Press <tt>Ctrl-C</tt> to kill the program (it may take a few seconds).</li>
<li> Now it&#8217;s time to play detective.  Load up the debugger and step  through       the code for the calculation of the Fibonacci number (just like  you did       last time), and see if you can narrow down the problem.  There is       only 1 tiny bug in the actual code.  Once again, there is a hint  that       appears at the bottom of the tutorial, but you should be able to  solve       the problem on your own.</li>
<li> Make the change to the code and recompile and test the change.   Does       your program produce an output of <tt>8</tt> for in input of <tt>6</tt>?</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=169</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>db2 save output to file</title>
		<link>http://theboox.com/?p=166</link>
		<comments>http://theboox.com/?p=166#comments</comments>
		<pubDate>Mon, 12 Jul 2010 23:02:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[db2]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=166</guid>
		<description><![CDATA[here is the command to save output to file
db2 -r out.txt
more help type:  ? options  inside the db2 console
]]></description>
			<content:encoded><![CDATA[<p><strong>here is the command to save output to file</strong></p>
<p><strong><span style="color: #ff0000;">db2 -r out.txt</span></strong></p>
<p><strong>more help type:  <span style="color: #ff0000;">? options </span> inside the db2 console</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=166</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>find and copy file in linux</title>
		<link>http://theboox.com/?p=164</link>
		<comments>http://theboox.com/?p=164#comments</comments>
		<pubDate>Sat, 03 Jul 2010 06:26:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux command]]></category>
		<category><![CDATA[find command]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=164</guid>
		<description><![CDATA[find all the mp3 file in the current directory and copy them to /home/user/song directory
find ./ -iname \*.mp3  cp {}  /home/user/song \;
 
]]></description>
			<content:encoded><![CDATA[<p>find all the mp3 file in the current directory and copy them to /home/user/song directory</p>
<p><strong><span style="color: #ff0000;">find</span> ./ -iname \*.mp3  cp <span style="color: #ff0000;">{} </span> /home/user/song \;</strong></p>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=164</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to prove Eculidean algorithm</title>
		<link>http://theboox.com/?p=160</link>
		<comments>http://theboox.com/?p=160#comments</comments>
		<pubDate>Sun, 27 Jun 2010 03:04:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Abstract Algebra]]></category>
		<category><![CDATA[Eculidean algorithm]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=160</guid>
		<description><![CDATA[a, b in Z, and p is prime
if p &#124; ab
=&#62; p &#124; a or p &#124; b
proof by contradiction:
assume p is not divided by a and p is not divided by b
p &#124; ab =&#62;  gcd(p, a) = 1  =&#62;  xp + ya = 1  such that there exists x, y in Z(Eculidan algorithm)
since <a href="http://theboox.com/?p=160" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>a, b in Z, and p is prime</p>
<p>if p | ab</p>
<p>=&gt; p | a or p | b</p>
<p>proof by contradiction:</p>
<p>assume p is not divided by a and p is not divided by b</p>
<p>p | ab =&gt;  gcd(p, a) = 1  =&gt;  xp + ya = 1  such that there exists x, y in Z(Eculidan algorithm)</p>
<p>since xp + ya = 1 =&gt; b(xp + ya) = b  =&gt;  bxp + bya = b</p>
<p>since a | ab = &gt; p | bya  and p | bxp</p>
<p>=&gt; p | (bxp + bya)   =&gt; p | b</p>
<p>that contradict to our assumption</p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=160</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pareto Optimal</title>
		<link>http://theboox.com/?p=157</link>
		<comments>http://theboox.com/?p=157#comments</comments>
		<pubDate>Sun, 27 Jun 2010 02:52:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Economic]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=157</guid>
		<description><![CDATA[A Pareto Optimal outcome is one such that on-one could be made better off without making someone else worst off.
]]></description>
			<content:encoded><![CDATA[<p><strong>A <span style="color: #ff0000;">Pareto Optimal</span> outcome is one such that on-one could be made better off without making someone else worst off.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=157</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to run batch file on db2</title>
		<link>http://theboox.com/?p=155</link>
		<comments>http://theboox.com/?p=155#comments</comments>
		<pubDate>Sat, 12 Jun 2010 21:57:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[db2]]></category>
		<category><![CDATA[db2 batch file]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=155</guid>
		<description><![CDATA[just type
db2 -f mybatch.txt
]]></description>
			<content:encoded><![CDATA[<p>just type</p>
<p>db2 -f mybatch.txt</p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=155</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to list all table from db2</title>
		<link>http://theboox.com/?p=152</link>
		<comments>http://theboox.com/?p=152#comments</comments>
		<pubDate>Sat, 12 Jun 2010 21:33:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[db2]]></category>
		<category><![CDATA[db2 list table]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=152</guid>
		<description><![CDATA[// list all tables from db2
db2=&#62; list tables for all
// list table tb1
db2=&#62; list tables for scheme tb1
]]></description>
			<content:encoded><![CDATA[<p>// list all tables from db2</p>
<p>db2=&gt; list tables for all</p>
<p>// list table tb1</p>
<p>db2=&gt; list tables for scheme tb1</p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=152</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to prove a ring is subring?</title>
		<link>http://theboox.com/?p=149</link>
		<comments>http://theboox.com/?p=149#comments</comments>
		<pubDate>Sat, 12 Jun 2010 00:41:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Abstract Algebra]]></category>
		<category><![CDATA[proof subring]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=149</guid>
		<description><![CDATA[example:
how to prove 3Z is subring of Z (Z is integer)
we only need to prove 3Z is closed under subtraction and multiplication.
subtraction =&#62; 0 and additive inverse in the 3Z.
let a, b in 3Z.
if a &#8211; b in 3Z then
let a = b, =&#62;  b + (-b)  = in 3Z
=&#62; 0 in 3Z and additive <a href="http://theboox.com/?p=149" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>example:</p>
<p>how to prove 3Z is subring of Z (Z is integer)</p>
<p>we only need to prove 3Z is closed under subtraction and multiplication.</p>
<p>subtraction =&gt; 0 and additive inverse in the 3Z.</p>
<p>let a, b in 3Z.</p>
<p>if a &#8211; b in 3Z then</p>
<p>let a = b, =&gt;  b + (-b)  = in 3Z</p>
<p>=&gt; 0 in 3Z and additive inverse -b in 3Z</p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=149</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Existence of Factor Rings</title>
		<link>http://theboox.com/?p=147</link>
		<comments>http://theboox.com/?p=147#comments</comments>
		<pubDate>Sat, 12 Jun 2010 00:28:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Abstract Algebra]]></category>
		<category><![CDATA[coset]]></category>
		<category><![CDATA[ring]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=147</guid>
		<description><![CDATA[let R be the ring, and A be the subring of R. The set of cosets
{r + A &#124; r in R} is a ring under the operations
(r + A) + (s + A) = r + s + A and
(r + A)*(s + A) = rs + A if and only if A is <a href="http://theboox.com/?p=147" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>let <strong>R</strong> be the ring, and A be the subring of R. The set of cosets<br />
{r + <strong>A</strong> | r in R} is a ring under the operations<br />
(r + <strong>A</strong>) + (s + <strong>A</strong>) = r + s + <strong>A</strong> and<br />
(r + <strong>A</strong>)*(s + <strong>A</strong>) = rs + <strong>A</strong> if and only if A is an ideal of <strong>R</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=147</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Abstract Algebra: what is Ideal?</title>
		<link>http://theboox.com/?p=144</link>
		<comments>http://theboox.com/?p=144#comments</comments>
		<pubDate>Mon, 31 May 2010 05:06:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Abstract Algebra]]></category>

		<guid isPermaLink="false">http://theboox.com/?p=144</guid>
		<description><![CDATA[Ideal is defined by:
if R is a Ring and I is subring of R, then
if r in I, and x in R then
r*x in I and x*r both in I
example of Ideal:
let R = Z, I = 2Z
r in Z
x in 2Z
then r*x = z*2Z = 2*Z
x*r = 2Z*Z = 2*Z
hence  2Z is an Ideal
]]></description>
			<content:encoded><![CDATA[<p><strong>Ideal </strong>is defined by:</p>
<p>if R is a Ring and I is subring of R, then</p>
<p>if r in I, and x in R then</p>
<p>r*x in I and x*r both in I</p>
<p>example of Ideal:</p>
<p>let R = Z, I = 2Z</p>
<p>r in Z</p>
<p>x in 2Z</p>
<p>then r*x = z*2Z = 2*Z</p>
<p>x*r = 2Z*Z = 2*Z</p>
<p>hence  2Z is an Ideal<p class="error"><strong>[ad]</strong> Empty ad slot (#1)!</p></p>
]]></content:encoded>
			<wfw:commentRss>http://theboox.com/?feed=rss2&amp;p=144</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
