<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-34310462</atom:id><lastBuildDate>Mon, 30 Sep 2024 13:26:43 +0000</lastBuildDate><category>Java</category><category>MySQL</category><category>AntiVirus</category><category>Networking</category><category>firefox</category><title>HowTo For Idiots</title><description>From Idiot To Expert!!</description><link>http://idiot-howto.blogspot.com/</link><managingEditor>noreply@blogger.com (Unknown)</managingEditor><generator>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-3879167329097062638</guid><pubDate>Tue, 10 Mar 2009 05:17:00 +0000</pubDate><atom:updated>2009-03-16T23:48:02.091-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AntiVirus</category><category domain="http://www.blogger.com/atom/ns#">firefox</category><title>Quick Tip: Firefox exception 0xc000000d at location 0x7817EF67</title><description>If your firefox shows this error: &lt;span style=&quot;font-weight:bold;&quot;&gt;THE EXCEPTION UNKNOWN SOFTWARE EXCEPTION (0xc000000d) OCCURED IN THE APPLICATION AT LOCATION 0x7817EF67&lt;/span&gt; and you&#39;ve tried to restart the application, but the problem still exists, try this solution.&lt;br /&gt;&lt;span class=&quot;fullpost&quot;&gt;&lt;br /&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;It will happen when you&#39;ve AVG in your system and the &lt;span style=&quot;font-weight:bold;&quot;&gt;Link Scanner&lt;/span&gt; is enabled. The only solution until it&#39;s fixed by Mozilla or AVG, is disabling the AVG&#39;s Link Scanner. Here&#39;s how:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Close your firefox&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Right click on AVG tray icon, then select &lt;span style=&quot;font-weight:bold;&quot;&gt;Open AVG User Interface&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Double click on &lt;span style=&quot;font-weight:bold;&quot;&gt;LinkScanner&lt;/span&gt; Component or from the menu &lt;span style=&quot;font-weight:bold;&quot;&gt;Components&gt;&gt;LinkScanner&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Deselect on &lt;span style=&quot;font-weight:bold;&quot;&gt;Enable AVG Search Shield (need web browser restart)&lt;/span&gt; checkbox&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Run your firefox and try to browse the sites which the browser usually crash.&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;</description><link>http://idiot-howto.blogspot.com/2009/03/firefox-exception-0xc000000d-0x7817ef67.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-8303817620483328698</guid><pubDate>Tue, 02 Sep 2008 08:10:00 +0000</pubDate><atom:updated>2008-09-02T01:14:22.794-07:00</atom:updated><title>New Backup/Restore Statement in MySQL 6.0</title><description>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;Finally, what I&#39;ve been waiting for long time is currently in progress !&lt;br/&gt;New backup and restore syntax is available in MySQL begin from version 6.0.5. (it&#39;s still in alpha state at the time I write this post)&lt;span class=&quot;fullpost&quot;&gt;&lt;br/&gt;&lt;br/&gt;This syntax is use just like ordinary DDL/DML SQL syntax, so you wouldn&#39;t need to run external application eg. mysqldump anymore. The best of it, is the backup process won&#39;t block any client accesses, or vice versa. They can now work concurrently, except for the DDL syntax.&lt;br/&gt;&lt;br/&gt;The syntax is so simple:&lt;br/&gt;&lt;pre class=&#39;programlisting&#39;&gt;BACKUP DATABASE [DATABASE] TO [PATH];&lt;br/&gt;RESTORE FROM [PATH];&lt;/pre&gt;&lt;br/&gt;For example, to backup,&lt;br/&gt;&lt;pre class=&#39;programlisting&#39;&gt;BACKUP DATABASE mycompanydatase TO &#39;/home/staff/backup/backupfile.dat&#39;;&lt;br/&gt;&lt;/pre&gt;to restore,&lt;br/&gt;&lt;pre class=&#39;programlisting&#39;&gt;RESTORE FROM &#39;/home/staff/backup/backupfile.dat&#39;;&lt;/pre&gt;&lt;br/&gt;For more information about new BACKUP/RESTORE syntax in MySQL 6.0, see the &lt;a href=&#39;http://dev.mysql.com/doc/refman/6.0/en/backup-database-restore.html&#39;&gt;documentation&lt;/a&gt;.&lt;br/&gt;BACKUP/RESTORE using MySQL &amp;lt; 6.0 still need external tools. See my &lt;a href=&#39;http://idiot-howto.blogspot.com/2008/05/backup-mysql-database-from-java-part-1_29.html&#39;&gt;tutorial about Backup MySQL Data Using Java&lt;/a&gt;.&lt;br/&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://idiot-howto.blogspot.com/2008/09/mysql-new-backup-restore-syntax.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-5303693271631569212</guid><pubDate>Thu, 31 Jul 2008 09:29:00 +0000</pubDate><atom:updated>2009-03-16T23:47:34.956-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>Dealing With MySQL Cast() Limitation</title><description>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;If your application depends on data type of your database, you will notice that mysql cast() function has limitation that can&#39;t cast to specific datatype, like tinyint, smallint, mediumint, bigint, etc.&lt;br/&gt;&lt;br/&gt;There is simple (dumb and idiot) workaround you can do to overcome this situation. Let&#39;s try it out.&lt;span class=&quot;fullpost&quot;&gt;&lt;br/&gt;&lt;br/&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;Create a table with 5 column.&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;CREATE TABLE datatype_test (&lt;br/&gt;  tiny_int tinyint(4),&lt;br/&gt;  small_int smallint(6),&lt;br/&gt;  medium_int mediumint(9),&lt;br/&gt;  _int int(11),&lt;br/&gt;  big_int bigint(20)&lt;br/&gt;);&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;br/&gt;Populate each column with value of 10.&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;INSERT datatype_test (&lt;br/&gt;  tiny_int,&lt;br/&gt;  small_int,&lt;br/&gt;  medium_int,&lt;br/&gt;  _int,&lt;br/&gt;  big_int&lt;br/&gt;)&lt;br/&gt;values (10,10,10,10,10);&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;br/&gt;Now, let&#39;s try with a simple query.&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;select     (d.tiny_int*1) as tiny,&lt;br/&gt;           (d.small_int*1) as small,&lt;br/&gt;           (d.medium_int*1) as `medium`,&lt;br/&gt;           (d._int*1) as regular,&lt;br/&gt;           (d.big_int*1) as big&lt;br/&gt;from       datatype_test d;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;br/&gt;When you multiply the columns with any number, the result data type is not same as the original data type. You can check it using this Java snippet:&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;import java.sql.*;&lt;br/&gt;&lt;br/&gt;public class datatype_test {&lt;br/&gt;    public Connection cn;&lt;br/&gt;    public PreparedStatement st;&lt;br/&gt;    public ResultSet rs;&lt;br/&gt;    &lt;br/&gt;    public static void main(String[] a) throws Exception {&lt;br/&gt;        new datatype_test();&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    public datatype_test() throws Exception {&lt;br/&gt;        connect();&lt;br/&gt;        &lt;br/&gt;        showcase1();&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    private void connect() throws Exception {&lt;br/&gt;        Class.forName(&quot;com.mysql.jdbc.Driver&quot;);&lt;br/&gt;        &lt;br/&gt;        String url = &quot;jdbc:mysql://localhost/test&quot;;            &lt;br/&gt;        cn=DriverManager.getConnection(url,&quot;user&quot;,&quot;password&quot;);&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    private void showcase1() throws Exception {&lt;br/&gt;        st = cn.prepareStatement(&lt;br/&gt;                &quot;select  (d.tiny_int*1) as tiny, &quot; +&lt;br/&gt;                &quot;        (d.small_int*1) as small, &quot; +&lt;br/&gt;                &quot;        (d.medium_int*1) as `medium`, &quot; +&lt;br/&gt;                &quot;        (d._int*1) as regular, &quot; +&lt;br/&gt;                &quot;        (d.big_int*1) as big &quot; +&lt;br/&gt;                &quot;from    datatype_test d;&quot;);&lt;br/&gt;&lt;br/&gt;        if (st.execute()) {&lt;br/&gt;            rs = st.getResultSet();&lt;br/&gt;            rs.next();&lt;br/&gt;            &lt;br/&gt;            ResultSetMetaData rsmt = rs.getMetaData();&lt;br/&gt;            int cols = rsmt.getColumnCount();&lt;br/&gt;            &lt;br/&gt;            for (int i=1;i&amp;lt;=cols;i++) {&lt;br/&gt;                System.out.println(rsmt.getColumnLabel(i) + &quot; = &quot; +&lt;br/&gt;                                   rsmt.getColumnTypeName(i));&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;        &lt;br/&gt;        rs.close();&lt;br/&gt;        st.close();&lt;br/&gt;    }&lt;br/&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;When you run it, the result will looks like this:&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;tiny = BIGINT&lt;br/&gt;small = BIGINT&lt;br/&gt;medium = BIGINT&lt;br/&gt;regular = BIGINT&lt;br/&gt;big = BIGINT&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;br/&gt;That&#39;s the problem. Let&#39;s do something with this. While MySQL cast() has limitation, why not make our own cast function.&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;CREATE FUNCTION x_cast_to_tinyint(number bigint) RETURNS tinyint&lt;br/&gt;BEGIN&lt;br/&gt;    return number;&lt;br/&gt;END&lt;br/&gt;&lt;br/&gt;CREATE FUNCTION x_cast_to_smallint(number bigint) RETURNS smallint&lt;br/&gt;BEGIN&lt;br/&gt;    return number;&lt;br/&gt;END&lt;br/&gt;&lt;br/&gt;CREATE FUNCTION x_cast_to_mediumint(number bigint) RETURNS mediumint&lt;br/&gt;BEGIN&lt;br/&gt;    return number;&lt;br/&gt;END&lt;br/&gt;&lt;br/&gt;CREATE FUNCTION x_cast_to_int(number bigint) RETURNS int&lt;br/&gt;BEGIN&lt;br/&gt;    return number;&lt;br/&gt;END&lt;br/&gt;&lt;br/&gt;CREATE FUNCTION x_cast_to_bigint(number bigint) RETURNS bigint&lt;br/&gt;BEGIN&lt;br/&gt;    return number;&lt;br/&gt;END&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;br/&gt;Now we already have our cast function, we should alter our query.&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;select   x_cast_to_tinyint(d.tiny_int*1) as tiny,&lt;br/&gt;         x_cast_to_smallint(d.small_int*1) as small,&lt;br/&gt;         x_cast_to_mediumint(d.medium_int*1) as `medium`,&lt;br/&gt;         x_cast_to_int(d._int*1) as regular,&lt;br/&gt;         x_cast_to_bigint(d.big_int*1) as big&lt;br/&gt;from     datatype_test d;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;&lt;br/&gt;Let&#39;s compare the two queries with our Java snippet:&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;import java.sql.*;&lt;br/&gt;&lt;br/&gt;public class datatype_test {&lt;br/&gt;    public Connection cn;&lt;br/&gt;    public PreparedStatement st;&lt;br/&gt;    public ResultSet rs;&lt;br/&gt;    &lt;br/&gt;    public static void main(String[] a) throws Exception {&lt;br/&gt;        new datatype_test();&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    public datatype_test() throws Exception {&lt;br/&gt;        connect();&lt;br/&gt;        &lt;br/&gt;        showcase1();&lt;br/&gt;        System.out.println();&lt;br/&gt;        showcase2();&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    private void connect() throws Exception {&lt;br/&gt;        Class.forName(&quot;com.mysql.jdbc.Driver&quot;);&lt;br/&gt;        &lt;br/&gt;        String url = &quot;jdbc:mysql://localhost/test&quot;;            &lt;br/&gt;        cn=DriverManager.getConnection(url,&quot;user&quot;,&quot;password&quot;);&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    private void showcase1() throws Exception {&lt;br/&gt;        st = cn.prepareStatement(&lt;br/&gt;                &quot;select  (d.tiny_int*1) as tiny, &quot; +&lt;br/&gt;                &quot;        (d.small_int*1) as small, &quot; +&lt;br/&gt;                &quot;        (d.medium_int*1) as `medium`, &quot; +&lt;br/&gt;                &quot;        (d._int*1) as regular, &quot; +&lt;br/&gt;                &quot;        (d.big_int*1) as big &quot; +&lt;br/&gt;                &quot;from    datatype_test d;&quot;);&lt;br/&gt;&lt;br/&gt;        if (st.execute()) {&lt;br/&gt;            rs = st.getResultSet();&lt;br/&gt;            rs.next();&lt;br/&gt;            &lt;br/&gt;            ResultSetMetaData rsmt = rs.getMetaData();&lt;br/&gt;            int cols = rsmt.getColumnCount();&lt;br/&gt;            &lt;br/&gt;            System.out.println(&quot;Without Cast&quot;);&lt;br/&gt;            &lt;br/&gt;            for (int i=1;i&amp;lt;=cols;i++) {&lt;br/&gt;                System.out.println(rsmt.getColumnLabel(i) + &quot; = &quot; + &lt;br/&gt;                                   rsmt.getColumnTypeName(i));&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;        &lt;br/&gt;        rs.close();&lt;br/&gt;        st.close();&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;    private void showcase2() throws Exception {&lt;br/&gt;        st = cn.prepareStatement(&lt;br/&gt;                &quot;select  x_cast_to_tinyint(d.tiny_int*1) as tiny, &quot; +&lt;br/&gt;                &quot;        x_cast_to_smallint(d.small_int*1) as small, &quot; +&lt;br/&gt;                &quot;        x_cast_to_mediumint(d.medium_int*1) as `medium`, &quot; +&lt;br/&gt;                &quot;        x_cast_to_int(d._int*1) as regular, &quot; +&lt;br/&gt;                &quot;        x_cast_to_bigint(d.big_int*1) as big &quot; +&lt;br/&gt;                &quot;from    datatype_test d;&quot;);&lt;br/&gt;&lt;br/&gt;        if (st.execute()) {&lt;br/&gt;            rs = st.getResultSet();&lt;br/&gt;            rs.next();&lt;br/&gt;            &lt;br/&gt;            ResultSetMetaData rsmt = rs.getMetaData();&lt;br/&gt;            int cols = rsmt.getColumnCount();&lt;br/&gt;            &lt;br/&gt;            System.out.println(&quot;With Cast&quot;);&lt;br/&gt;            &lt;br/&gt;            for (int i=1;i&amp;lt;=cols;i++) {&lt;br/&gt;                System.out.println(rsmt.getColumnLabel(i) + &quot; = &quot; + &lt;br/&gt;                                   rsmt.getColumnTypeName(i));&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;        &lt;br/&gt;        rs.close();&lt;br/&gt;        st.close();&lt;br/&gt;    }&lt;br/&gt;}&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;The result is:&lt;br/&gt;&lt;code&gt;Without Cast&lt;br/&gt;tiny = BIGINT&lt;br/&gt;small = BIGINT&lt;br/&gt;medium = BIGINT&lt;br/&gt;regular = BIGINT&lt;br/&gt;big = BIGINT&lt;br/&gt;&lt;br/&gt;With Cast&lt;br/&gt;tiny = TINYINT&lt;br/&gt;small = SMALLINT&lt;br/&gt;medium = MEDIUMINT&lt;br/&gt;regular = INTEGER&lt;br/&gt;big = BIGINT&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://idiot-howto.blogspot.com/2008/07/mysql-cast-limitation.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-1262521868860624530</guid><pubDate>Thu, 17 Jul 2008 06:26:00 +0000</pubDate><atom:updated>2009-03-16T23:47:13.669-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Java ByteCode Manipulation</title><description>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;&lt;center&gt;&lt;table bgcolor=&#39;#ffffcc&#39;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style=&#39;font-weight: bold;&#39;&gt;WARNING - Contents of this file are for educational purposes only. It is strongly suggested that you do not use this knowledge for illegal purposes!&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;&lt;br/&gt;&lt;br/&gt;&lt;span class=&#39;fullpost&#39;&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;There are two ways to modify the compiled java code (assume you don&#39;t have the source or have loss it):&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;&lt;li&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Decompile all dependent file, make any modification to .java files created, then recompile.&lt;/span&gt;&lt;br/&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Easy to manage your modification.&lt;/li&gt;&lt;br/&gt;&lt;li&gt;You don&#39;t have to decompile them next time you want to modify again.&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Hard/Impossible to do that on obfuscated file.&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;&lt;/li&gt;&lt;br/&gt;&lt;li&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Make any modification directly to .class file.&lt;/span&gt;&lt;br/&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;It&#39;s so easy to do on obfuscated file.&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;You have to learn about bytecode.&lt;/li&gt;&lt;br/&gt;&lt;li&gt;It will be hard at beginning.&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;The method I will be discuss right now is option (b), handling .class file directly.&lt;br/&gt;Now let&#39;s we begin with simple example.&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&#39;font-size: 130%;&#39;&gt;&lt;pre&gt;&lt;code&gt;public class bytecode1 {&lt;br /&gt; public static void main(String[] a) {&lt;br&gt;  System.out.println(&quot;Hello Worlf&quot;);&lt;br /&gt;  System.out.println(&quot;Hello Worlf&quot;);&lt;br /&gt;  System.out.println(&quot;Hello Worlf&quot;);&lt;br /&gt; }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;Save it with the name bytecode1.java, then compile it, you will got bytecode1.class. Now you may run it, by executing: &lt;i&gt;java bytecode1&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;See the result? I&#39;ve made typo mistake, it should display &quot;Hello World&quot;, not &quot;Hello Worlf&quot;.&lt;br/&gt;It&#39;s too easy, isn&#39;t it? You can just use any hex editor to replace the &quot;f&quot; to &quot;d&quot;. But how if I want only one &quot;Hello World&quot; line displayed? Can hex editor handling it? maybe yes, maybe no. I don&#39;t want to think about it while there are more elegant way to do it.&lt;br/&gt;&lt;br/&gt;The tools I use are &lt;a href=&#39;http://bcel.sourceforge.net/&#39;&gt;BCEL&lt;/a&gt; and &lt;a href=&#39;http://bcel.sourceforge.net/cck.html&#39;&gt;CCK&lt;/a&gt;. Both of them are quite old version, but still usable. So download it, and run CCK. Select Menu &lt;b&gt;File&amp;gt;Open&lt;/b&gt;, then click &lt;b&gt;Choose File ...&lt;/b&gt;. Open &lt;b&gt;bytecode1.class&lt;/b&gt; file.&lt;br/&gt;&lt;center&gt;&lt;img src=&#39;http://lh4.ggpht.com/weiliangCDT/SH7Q3tBvUiI/AAAAAAAAAB4/Ia-8NBHzW58/%5BUNSET%5D.jpg&#39; alt=&#39;java bytecode&#39;/&gt;&lt;/center&gt;&lt;br/&gt;From menu above, select &lt;i&gt;Code&lt;/i&gt; from &lt;i&gt;main&lt;/i&gt; methods. The right side panel will display content of main method.&lt;br/&gt;&lt;center&gt;&lt;img src=&#39;http://lh4.ggpht.com/weiliangCDT/SH7SMUDUs9I/AAAAAAAAAB8/RjBm34yeuSE/%5BUNSET%5D.jpg&#39; alt=&#39;java bytecode&#39;/&gt;&lt;/center&gt;&lt;br/&gt;You see the pattern? System.out.println is consist of getstatic, ldc, and invokevirtual.&lt;br/&gt;&lt;center&gt;&lt;img src=&#39;http://lh3.ggpht.com/weiliangCDT/SH7cOrF26EI/AAAAAAAAACA/yhwtpl4cPbc/%5BUNSET%5D.jpg&#39; alt=&#39;java bytecode&#39;/&gt;&lt;/center&gt;&lt;br/&gt;So what I&#39;m going to do now is remove two System.out.println routines. This should be tricky, when you are trying to remove getstatic routine, it will say &quot;cannot remove...still has targeter&quot;.&lt;br/&gt;&lt;br/&gt;If you select &quot;Line Numbers&quot; from left panel, it will show you dependencies from source code to bytecode. Remove the coresponding line where you want to remove the code.&lt;br/&gt;&lt;br/&gt;Assume I want to remove the last two System.out.println routines (The first won&#39;t removed), that is with offset 8 to 21, so in the &quot;Line Numbers&quot; section, I will remove source index 4 and 5 that link to the offset 8-21.&lt;br/&gt;&lt;center&gt;&lt;img src=&#39;http://lh6.ggpht.com/weiliangCDT/SH7gFomJJeI/AAAAAAAAACQ/GxFfngD9Brg/%5BUNSET%5D.jpg&#39; alt=&#39;java bytecode&#39;/&gt;&lt;/center&gt;&lt;br/&gt;if you done that, go back to Code, and then delete offset 8-21.&lt;br/&gt;&lt;center&gt;&lt;img src=&#39;http://lh6.ggpht.com/weiliangCDT/SH7gOqQx7BI/AAAAAAAAACU/rQCuV6enlhg/%5BUNSET%5D.jpg&#39; alt=&#39;java bytecode&#39;/&gt;&lt;/center&gt;&lt;br/&gt;Done. save it with &lt;b&gt;File&amp;gt;Save&lt;/b&gt; Menu.&lt;br/&gt;&lt;br/&gt;That&#39;s enough for today, I will cover another technique next time.&lt;br/&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://idiot-howto.blogspot.com/2008/07/java-bytecode-edit.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/weiliangCDT/SH7Q3tBvUiI/AAAAAAAAAB4/Ia-8NBHzW58/s72-c/%5BUNSET%5D.jpg" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-6230183296635623615</guid><pubDate>Thu, 26 Jun 2008 05:38:00 +0000</pubDate><atom:updated>2009-03-16T23:46:57.497-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>Backup MySQL Database From Java Part 3</title><description>&lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;This is the last part of MySQL Database Backup from Java tutorial series.&lt;br /&gt;&lt;br /&gt;In &lt;a href=&quot;http://idiot-howto.blogspot.com/2008/05/backup-mysql-database-from-java-part-2.html&quot;&gt;previous post&lt;/a&gt;, already discussed about how to get the backup streams from Process Object to String variable. What are we going to do now is, saving the variable to a file. You should consider about compressing the output file if your data is somewhat like enterprise one.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fullpost&quot;&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;To compress the file, there is &lt;a href=&quot;http://java.sun.com/javase/6/docs/api/java/util/zip/ZipOutputStream.html&quot;&gt;ZipOutputStream&lt;/a&gt; class to utilize it.&lt;br /&gt;&lt;br /&gt;You need to call &lt;b&gt;setMethod()&lt;/b&gt; function to define what will you do with the stream. One of the option available is &lt;b&gt;ZipOutputStream.DEFLATED&lt;/b&gt;, meaning you will compress the stream, another is &lt;b&gt;ZipOutputStream.&lt;/b&gt;&lt;b&gt;STORED&lt;/b&gt;, meaning you just store the stream without compress.&lt;br /&gt;&lt;br /&gt;Another function to call if you choose &lt;b&gt;DEFLATED&lt;/b&gt; method is &lt;b&gt;setLevel()&lt;/b&gt;, which is setting the compression level. The value range from 0 (&lt;b&gt;Deflater.NO_COMPRESSION&lt;/b&gt;) to 9 (&lt;b&gt;Deflater.BEST_COMPRESSION&lt;/b&gt;).&lt;br /&gt;&lt;br /&gt;It will looks like:&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;byte[] data = getData().getBytes();&lt;br /&gt;byte[] routine = getRoutine().getBytes();&lt;br /&gt;File filedst = new File(&quot;example file.zip&quot;);&lt;br /&gt;&lt;br /&gt;FileOutputStream dest = new FileOutputStream(filedst);&lt;br /&gt;ZipOutputStream zip = new ZipOutputStream(&lt;br /&gt;                           new BufferedOutputStream(dest));&lt;br /&gt;zip.setMethod(ZipOutputStream.DEFLATED);&lt;br /&gt;zip.setLevel(Deflater.BEST_COMPRESSION);&lt;br /&gt;&lt;br /&gt;zip.putNextEntry(new ZipEntry(&quot;data.sql&quot;));&lt;br /&gt;zip.write(data);&lt;br /&gt;&lt;br /&gt;zip.putNextEntry(new ZipEntry(&quot;routine.sql&quot;));&lt;br /&gt;zip.write(routine);&lt;br /&gt;&lt;br /&gt;zip.close();&lt;br /&gt;dest.close();&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style=&quot;font-weight: bold; font-style: italic;&quot;&gt;Explanation:&lt;/span&gt;&lt;br /&gt;First, we collect all the data needed, see &lt;a href=&quot;http://idiot-howto.blogspot.com/2008/05/backup-mysql-database-from-java-part-2.html&quot;&gt;previous post&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;byte[] data = getData().getBytes();&lt;br /&gt;byte[] routine = getRoutine().getBytes();&lt;br /&gt;File filedst = new File(&quot;example file.zip&quot;);&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;Initiating the file stream and the zip stream&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;FileOutputStream dest = new FileOutputStream(filedst);&lt;br /&gt;ZipOutputStream zip = new ZipOutputStream(&lt;br /&gt;                           new BufferedOutputStream(dest));&lt;br /&gt;zip.setMethod(ZipOutputStream.DEFLATED);&lt;br /&gt;zip.setLevel(Deflater.BEST_COMPRESSION);&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;Write the file&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;zip.putNextEntry(new ZipEntry(&quot;data.sql&quot;));&lt;br /&gt;zip.write(data);&lt;br /&gt;&lt;br /&gt;zip.putNextEntry(new ZipEntry(&quot;routine.sql&quot;));&lt;br /&gt;zip.write(routine);&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;Close the stream.&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;zip.close();&lt;br /&gt;dest.close();&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/span&gt;</description><link>http://idiot-howto.blogspot.com/2008/06/mysql-backup-database-java.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-8013081981492952687</guid><pubDate>Thu, 29 May 2008 09:35:00 +0000</pubDate><atom:updated>2009-03-16T23:46:44.328-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>Backup MySQL Database From Java Part 2</title><description>&lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;div style=&quot;&quot;&gt;After we know how to &lt;a href=&quot;http://idiot-howto.blogspot.com/2008/05/backup-mysql-database-from-java-part-1_29.html&quot;&gt;separate the backup process between data, stored routine, and trigger&lt;/a&gt;, next thing to do is implementing them in Java.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fullpost&quot;&gt;Consider the following code:&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&#39;font-size: 130%;&#39;&gt;&lt;pre&gt;&lt;code&gt;private int BUFFER = 10485760;&lt;br /&gt;&lt;br /&gt; private String getData(String host, String port, String user, &lt;br /&gt;                        String password, String db) throws Exception {&lt;br /&gt;  Process run = Runtime.getRuntime().exec(&lt;br /&gt;                       &quot;mysqldump --host=&quot; + host + &quot; --port=&quot; + port + &lt;br /&gt;                       &quot; --user=&quot; + user + &quot; --password=&quot; + password + &lt;br /&gt;                       &quot; --compact --complete-insert --extended-insert &quot; +&lt;br /&gt;                       &quot;--skip-comments --skip-triggers &quot; + db);&lt;br /&gt;  InputStream in = run.getInputStream();&lt;br /&gt;  BufferedReader br = new BufferedReader(new InputStreamReader(in));&lt;br /&gt;  &lt;br /&gt;  StringBuffer temp = new StringBuffer();&lt;br /&gt;  &lt;br /&gt;  int count;&lt;br /&gt;  char[] cbuf = new char[BUFFER];&lt;br /&gt;  &lt;br /&gt;  while ((count = br.read(cbuf, 0, BUFFER)) != -1)&lt;br /&gt;   temp.append(cbuf, 0, count);&lt;br /&gt;  &lt;br /&gt;  br.close();&lt;br /&gt;  in.close();&lt;br /&gt;  &lt;br /&gt;  return temp.toString();&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; private String getRoutine(String host, String port, String user, &lt;br /&gt;                           String password, String db) throws Exception {&lt;br /&gt;  Process run = Runtime.getRuntime().exec(&lt;br /&gt;                       &quot;mysqldump --host=&quot; + host + &quot; --port=&quot; + port + &lt;br /&gt;                       &quot; --user=&quot; + user + &quot; --password=&quot; + password + &lt;br /&gt;                       &quot; --compact --skip-comments --no-create-info &quot; +&lt;br /&gt;                       &quot;--no-data --routines &quot; + db);&lt;br /&gt;  InputStream in = run.getInputStream();&lt;br /&gt;  BufferedReader br = new BufferedReader(new InputStreamReader(in));&lt;br /&gt;  &lt;br /&gt;  StringBuffer temp = new StringBuffer();&lt;br /&gt;  &lt;br /&gt;  int count;&lt;br /&gt;  char[] cbuf = new char[BUFFER];&lt;br /&gt;  &lt;br /&gt;  while ((count = br.read(cbuf, 0, BUFFER)) != -1)&lt;br /&gt;   temp.append(cbuf, 0, count);&lt;br /&gt;  &lt;br /&gt;  br.close();&lt;br /&gt;  in.close();&lt;br /&gt;  &lt;br /&gt;  return temp.toString();&lt;br /&gt; }&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;Now we have two functions, one for dumping only data, the other dumping stored routines and trigger. Both of them will return String variable, that is your backup.&lt;br /&gt;&lt;br /&gt;Please note the BUFFER variable, you may customized for your need. Just remember, the bigger value, consumes more heaps but decrease loops. The smaller value, consumes less heaps but increase loops.&lt;br /&gt;&lt;br /&gt;The next step is &lt;a href=&quot;http://idiot-howto.blogspot.com/2008/06/mysql-backup-database-java.html&quot;&gt;how to store&lt;/a&gt; them.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://idiot-howto.blogspot.com/2008/05/backup-mysql-database-from-java-part-2.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-5561501385354000073</guid><pubDate>Thu, 29 May 2008 08:52:00 +0000</pubDate><atom:updated>2009-03-16T23:46:25.218-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>Backup MySQL Database From Java Part 1</title><description>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;&lt;div style=&#39;&#39;&gt;&lt;div style=&#39;&#39;&gt;Nothing new with this topic because it has been asked and answered so many times in forums and mailing-lists, but still it&#39;s a quite hot topic.&lt;br/&gt;&lt;br/&gt;The backup method I&#39;m using in this blog entry is using &lt;b&gt;mysqldump&lt;/b&gt; utility that bundled with MySQL download. &lt;span class=&quot;fullpost&quot;&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;Mysqldump has several useful argument that we can make to customize our backup files, such as dumping data, triggers, stored routines in separate files.&lt;br/&gt;&lt;br/&gt;For example, backing-up data only should be,&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&#39;font-size: 130%;&#39;&gt;&lt;code&gt;mysqldump --host=myserver --port=3306 --user=william --password=secret &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_compact&#39;&gt;--compact&lt;/a&gt; &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_skip-comments&#39;&gt;--skip-comments&lt;/a&gt; --complete-insert &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_extended-insert&#39;&gt;--extended-insert&lt;/a&gt; --skip-triggers mydata&lt;/code&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;and backing-up stored routine and triggers should be,&lt;br/&gt;&lt;blockquote&gt;&lt;span style=&#39;font-size: 130%;&#39;&gt;&lt;code&gt;mysqldump --host=myserver --port=3306 --user=william --password=secret &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_compact&#39;&gt;--compact&lt;/a&gt; &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_skip-comments&#39;&gt;--skip-comments&lt;/a&gt; &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_no-create-info&#39;&gt;--no-create-info&lt;/a&gt; &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_no-data&#39;&gt;--no-data&lt;/a&gt; &lt;a target=&#39;_blank&#39; href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_routines&#39;&gt;--routines&lt;/a&gt; mydata&lt;/code&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;For complete argument list of mysql dump, &lt;a href=&#39;http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html&#39;&gt;click here.&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;The next step is how to &lt;a href=&quot;http://idiot-howto.blogspot.com/2008/05/backup-mysql-database-from-java-part-2.html&quot;&gt;implementing mysqldump in Java&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://idiot-howto.blogspot.com/2008/05/backup-mysql-database-from-java-part-1_29.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-6486121082637630931</guid><pubDate>Tue, 08 Apr 2008 06:07:00 +0000</pubDate><atom:updated>2009-03-16T23:45:59.736-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Create Your Own Simple, Fully Customized Captcha in Desktop Java</title><description>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://i32.photobucket.com/albums/d20/weiliang_1978/captcha.gif&quot;&gt;&lt;img ilo-full-src=&quot;http://i32.photobucket.com/albums/d20/weiliang_1978/captcha.gif&quot; style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;&quot; src=&quot;http://i32.photobucket.com/albums/d20/weiliang_1978/captcha.gif&quot; alt=&quot;&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;br /&gt;Captcha in webpages is designed to avoid bots, I used captcha in my desktop application to avoid accidental processing on high critical transaction as you can see at my screenshot above.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fullpost&quot;&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;First I initialized array of alphanumeric, I don&#39;t use some of them like &#39;1&#39;, &#39;i&#39;, &#39;5&#39;, &#39;s&#39; to avoid misreading.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;private String[] token = new String[]{&quot;3&quot;, &quot;r&quot;, &quot;c&quot;, &quot;t&quot;, &quot;9&quot;,&lt;br /&gt;                                      &quot;n&quot;, &quot;x&quot;, &quot;a&quot;, &quot;j&quot;, &quot;8&quot;, &lt;br /&gt;                                      &quot;d&quot;, &quot;p&quot;, &quot;f&quot;, &quot;y&quot;, &quot;7&quot;, &lt;br /&gt;                                      &quot;h&quot;, &quot;k&quot;};&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;This array will be shuffled everytime the class created using Collections.shuffle() method.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;java.util.List l = Arrays.asList(token);&lt;br /&gt;Collections.shuffle(l);&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Then simply read the shuffled array into a String variable.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;captcha = token[0] + token[1] + token[2] + token[3];&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;The next thing to do is paint the component. Step one is drawing the horizontal and vertical gridlines with random color.&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;Graphics2D g2d = (Graphics2D) g.create();&lt;br /&gt;Random r = new Random();&lt;br /&gt;&lt;br /&gt;for (int x = 10; x &lt; getWidth(); x+=10) {&lt;br /&gt;    g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;    g2d.drawLine(x, 0, x, getHeight());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;for (int y = 10; y &lt; getHeight(); y+=10) {&lt;br /&gt;    g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;    g2d.drawLine(0, y, getWidth(), y);&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Step two is drawing text shadow. This step is optional.&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;g2d.setColor(Color.BLACK);&lt;br /&gt;fm = getFontMetrics(bigFont);&lt;br /&gt;g2d.drawString(token[0], 7, fm.getHeight() + 2);&lt;br /&gt;g2d.drawString(token[1], 7 + fm.getWidths()[0], fm.getHeight() + 2);&lt;br /&gt;g2d.drawString(token[2], 7 + (fm.getWidths()[0]*2), fm.getHeight() + 2);&lt;br /&gt;g2d.drawString(token[3], 7 + (fm.getWidths()[0]*3), fm.getHeight() + 2);&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Step three is drawing the text itself, each letter is drawn using random color too.&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;g2d.drawString(token[0], 5, fm.getHeight());&lt;br /&gt;g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;g2d.drawString(token[1], 5 + fm.getWidths()[0], fm.getHeight());&lt;br /&gt;g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;g2d.drawString(token[2], 5 + (fm.getWidths()[0]*2), fm.getHeight());&lt;br /&gt;g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;g2d.drawString(token[3], 5 + (fm.getWidths()[0]*3), fm.getHeight());&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;After painting is done, the last thing should be done is create comparing method.&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;public boolean match(String input) {&lt;br /&gt;    return (input.equalsIgnoreCase(captcha));&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;From your application, just create a new instance of the class, waiting for user input then compare them.&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;wCaptcha c = new wCaptcha();&lt;br /&gt;. . .&lt;br /&gt;. . .&lt;br /&gt;. . .&lt;br /&gt;c.match(txtInput.getText());&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;The complete source is below.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;import java.util.*;&lt;br /&gt;import java.awt.*;&lt;br /&gt;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;public class wCaptcha extends JPanel {&lt;br /&gt; private String[] token = new String[]{&quot;3&quot;, &quot;r&quot;, &quot;c&quot;, &quot;t&quot;, &quot;9&quot;,&lt;br /&gt;                                       &quot;n&quot;, &quot;x&quot;, &quot;a&quot;, &quot;j&quot;, &quot;8&quot;, &lt;br /&gt;                                       &quot;d&quot;, &quot;p&quot;, &quot;f&quot;, &quot;y&quot;, &quot;7&quot;, &lt;br /&gt;                                       &quot;h&quot;, &quot;k&quot;};&lt;br /&gt; private String captcha = new String();&lt;br /&gt; &lt;br /&gt; private Font bigFont;&lt;br /&gt; private FontMetrics fm;&lt;br /&gt; &lt;br /&gt; public wCaptcha() {&lt;br /&gt;  super();&lt;br /&gt;  &lt;br /&gt;  initData();&lt;br /&gt;  initUI();&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; private void initData() {&lt;br /&gt;  java.util.List l = Arrays.asList(token);&lt;br /&gt;  Collections.shuffle(l);&lt;br /&gt;  &lt;br /&gt;  captcha = token[0] + token[1] + token[2] + token[3];&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; private void initUI() {&lt;br /&gt;  setDoubleBuffered(true);&lt;br /&gt;  &lt;br /&gt;  bigFont = new Font(&quot;Monospaced&quot;,Font.BOLD,getSize2D() + 20);&lt;br /&gt;  fm = getFontMetrics(bigFont);&lt;br /&gt;  &lt;br /&gt;  setBorder(null);&lt;br /&gt;  setPreferredSize(new Dimension((fm.getWidths()[0]*4) + 27, &lt;br /&gt;                                  fm.getHeight() + fm.getMaxDescent() + 2));&lt;br /&gt;  setMaximumSize(new Dimension((fm.getWidths()[0]*4) + 27, &lt;br /&gt;                                  fm.getHeight() + fm.getMaxDescent() + 2));&lt;br /&gt;  setMinimumSize(new Dimension((fm.getWidths()[0]*4) + 27, &lt;br /&gt;                                fm.getHeight() + fm.getMaxDescent() + 2));&lt;br /&gt;  setBackground(Color.WHITE);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public void paintComponent(Graphics g) {&lt;br /&gt;  super.paintComponent(g);&lt;br /&gt;  &lt;br /&gt;  Random r = new Random();&lt;br /&gt;  &lt;br /&gt;  Graphics2D g2d = (Graphics2D) g.create();&lt;br /&gt;  g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,&lt;br /&gt;                       RenderingHints.VALUE_ANTIALIAS_ON);&lt;br /&gt;  g2d.setFont(bigFont);&lt;br /&gt;  g2d.translate(0, 0);&lt;br /&gt;  &lt;br /&gt;  for (int x = 10; x &lt; getWidth(); x+=10) {&lt;br /&gt;   g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;   g2d.drawLine(x, 0, x, getHeight());&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  for (int y = 10; y &lt; getHeight(); y+=10) {&lt;br /&gt;   g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;   g2d.drawLine(0, y, getWidth(), y);&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  g2d.setColor(Color.BLACK);&lt;br /&gt;  g2d.drawString(token[0], 7, fm.getHeight() + 2);&lt;br /&gt;  g2d.drawString(token[1], 7 + fm.getWidths()[0], fm.getHeight() + 2);&lt;br /&gt;  g2d.drawString(token[2], 7 + (fm.getWidths()[0]*2), fm.getHeight() + 2);&lt;br /&gt;  g2d.drawString(token[3], 7 + (fm.getWidths()[0]*3), fm.getHeight() + 2);&lt;br /&gt;  &lt;br /&gt;  g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;  g2d.drawString(token[0], 5, fm.getHeight());&lt;br /&gt;  g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;  g2d.drawString(token[1], 5 + fm.getWidths()[0], fm.getHeight());&lt;br /&gt;  g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;  g2d.drawString(token[2], 5 + (fm.getWidths()[0]*2), fm.getHeight());&lt;br /&gt;  g2d.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));&lt;br /&gt;  g2d.drawString(token[3], 5 + (fm.getWidths()[0]*3), fm.getHeight());&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public boolean match(String input) {&lt;br /&gt;  return (input.equalsIgnoreCase(captcha));&lt;br /&gt; }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;</description><link>http://idiot-howto.blogspot.com/2008/04/create-your-own-simple-fully-customized.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>7</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-8609254631012256930</guid><pubDate>Tue, 22 Jan 2008 04:43:00 +0000</pubDate><atom:updated>2008-07-05T00:24:11.417-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>(Easily) Running Java Application</title><description>Here is the situation:&lt;br /&gt;My Java desktop application run accross my company LAN, thus I put it in the server, every workstation can access to it, and I can easily update my application just by uploading to one machine. The workstations are consist of mixture of Windows 98, 2000, XP and Linux.&lt;br /&gt;&lt;span class=&quot;fullpost&quot;&gt;&lt;br /&gt;The problem is:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When making shortcut pointing to Java application reside in the server. I need only one shortcut reside on server (It has to worked on Windows and Linux).&lt;/li&gt;&lt;li&gt;Using java utility will displaying console window. Some people suggested using .BAT or .CMD, but it&#39;s useless.&lt;/li&gt;&lt;li&gt;Using javaw utility will solved above problem, but it&#39;s only available on Windows.&lt;/li&gt;&lt;li&gt;When I created shortcut, Windows always add C:\WINDOWS\SYSTEM32 (for 98, XP) and C:\WINNT\SYSTEM32 (for 2000), in front of the command line. The path is unavailable and the shortcut may not worked on Linux machine. And I don&#39;t think shortcut from Linux will be worked on Windows (I haven&#39;t tested yet).&lt;/li&gt;&lt;li&gt;Making .JAR from my application? Great, but I have some argument and classpath to pass with the application.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Then I came out to Runtime.exec()  solution. So I create this Launcher class&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;import java.io.*;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;&lt;br /&gt;public class Launcher {&lt;br /&gt;  private BufferedReader in;&lt;br /&gt;  private String cmdLine = null;&lt;br /&gt;  private Runtime rt;&lt;br /&gt;  private Process p;&lt;br /&gt;&lt;br /&gt;  public Launcher() {&lt;br /&gt;      try {&lt;br /&gt;          rt = Runtime.getRuntime();&lt;br /&gt;          in = new BufferedReader(new FileReader(&quot;launch.app&quot;));&lt;br /&gt;       &lt;br /&gt;          do {&lt;br /&gt;              cmdLine = in.readLine();&lt;br /&gt;              if (cmdLine!=null &amp;amp; !(&quot;&quot;.equals(cmdLine))) {&lt;br /&gt;                  p = rt.exec(cmdLine);&lt;br /&gt;&lt;br /&gt;                  InputStream is = p.getInputStream();&lt;br /&gt;                  InputStreamReader inr = new InputStreamReader(is);&lt;br /&gt;                  BufferedReader br = new BufferedReader(inr);&lt;br /&gt;               &lt;br /&gt;                  StringBuffer temp = new StringBuffer();&lt;br /&gt;                  String b;&lt;br /&gt;               &lt;br /&gt;                  do {&lt;br /&gt;                      b = br.readLine();&lt;br /&gt;                   &lt;br /&gt;                      if (b!=null)&lt;br /&gt;                          temp.append(b);&lt;br /&gt;                  } while (b!=null);&lt;br /&gt;               &lt;br /&gt;                  if(temp.toString().trim().length()&gt;0)&lt;br /&gt;                      JOptionPane.showMessageDialog(null, temp.toString(), &lt;br /&gt;                                                    &quot;Error Occured&quot;, &lt;br /&gt;                                                    JOptionPane.ERROR_MESSAGE);&lt;br /&gt;              }&lt;br /&gt;          } while (cmdLine!=null);&lt;br /&gt;           &lt;br /&gt;          in.close();&lt;br /&gt;      } catch (Exception e) {&lt;br /&gt;          JOptionPane.showMessageDialog(null, e.getMessage(), &lt;br /&gt;                                        &quot;Error Occured&quot;, &lt;br /&gt;                                        JOptionPane.ERROR_MESSAGE);&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public static void main(String[] arg) {&lt;br /&gt;      new Launcher();&lt;br /&gt;  }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/span&gt;This class will need a text file called launch.app, contain command line to run, for example:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;blockquote&gt;&lt;code&gt;java -Xms384m -Xmx512m -Djava.library.path=jug-native -cp jar/mysql-connector-java-5.0.3-bin.jar; bin.Main&lt;/code&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;Next step to do is making .JAR file for our Launcher class. First Prepare a text file called mymanifest.txt in same folder with Launcher.class contain:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;blockquote&gt;&lt;code&gt;Main-Class: Launcher&lt;/code&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;and then run this command to create .JAR file:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;code&gt;jar -cvfm Launcher.jar mymanifest.txt Launcher.class&lt;/code&gt;&lt;/span&gt;&lt;/blockquote&gt;Copy generated Launcher.jar and launch.app to the directory where Java application is resided.&lt;br /&gt;You may try double click Launcher.jar file or create shortcut from it.&lt;/span&gt;</description><link>http://idiot-howto.blogspot.com/2008/01/easily-running-java-application.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-3748992485496030837</guid><pubDate>Sat, 19 Jan 2008 06:32:00 +0000</pubDate><atom:updated>2009-03-16T23:45:27.455-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AntiVirus</category><category domain="http://www.blogger.com/atom/ns#">Networking</category><title>NOD32 LAN Update Server</title><description>Yes, I know there are several ways to create your own NOD32 Update Server posted by people in their blogs. There are official Business Edition of NOD32 and unofficial NOD32 Update Generator. I just want to share another way that I think more flexible and automated. I don&#39;t know if it&#39;s posted or not, cause I just made my own experiment about it and didn&#39;t google for it. Here it is.&lt;br /&gt;&lt;span class=&quot;fullpost&quot;&gt;&lt;br /&gt;&lt;div style=&quot;float:right;margin-left:10px;margin-bottom:10px&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;google_ad_client = &quot;pub-1484665728821614&quot;;google_ad_slot = &quot;8619892679&quot;;google_ad_width = 160;google_ad_height = 90;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;I&#39;m using Ubuntu 7.10, but you may use another OS, just remember to equip it with:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Webserver (I&#39;m using Apache)&lt;/li&gt;&lt;li&gt;wget&lt;/li&gt;&lt;li&gt;Scheduling app/daemon (I&#39;m using cron)&lt;/li&gt;&lt;/ul&gt;Prepare a location in your Webserver for storing downloaded update files. In my Ubuntu, I just create a new folder named &lt;span style=&quot;font-style: italic;&quot;&gt;nod32_update&lt;/span&gt; in &lt;span style=&quot;font-style: italic;&quot;&gt;/var/www.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using cron, I scheduled wget every Monday and Thursday like this:&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;code&gt;* * * * 1,4 wget -m -nH -nd -A nup,ver --directory-prefix=/var/www/nod32_update [your nod32 update server]&lt;/code&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Replace &lt;span style=&quot;font-style: italic;&quot;&gt;[your nod32 update server]&lt;/span&gt; with your current remote update server. Don&#39;t forget to add parameter &lt;span style=&quot;font-style: italic;&quot;&gt;--http-user&lt;/span&gt;  and &lt;span style=&quot;font-style: italic;&quot;&gt;--http-password&lt;/span&gt; if your update server need authentication. You may run it for the first time.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;fieldset class=&quot;fieldset&quot;&gt;&lt;legend&gt;Please Spare Your Time To Visit Our Sponsored Ads&lt;/legend&gt;&lt;center&gt;Your Ads Here. Post a comment to make a deal.&lt;/center&gt;&lt;/fieldset&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Last, add your newly created server to NOD32 server list, it should looks like this&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;code&gt;http://[your server host]/nod32_update/&lt;/code&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Voila, every computer in your LAN can now update their virus definition.&lt;/span&gt;</description><link>http://idiot-howto.blogspot.com/2008/01/nod32-lan-update-server_18.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34310462.post-115811303048303440</guid><pubDate>Wed, 13 Sep 2006 01:56:00 +0000</pubDate><atom:updated>2008-07-05T00:24:58.814-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Thread.UncaughtExceptionHandler</title><description>&lt;p&gt;How do you handling exceptions in your Java application?&lt;/p&gt;Most of Java coders use &lt;span style=&quot;font-style: italic;&quot;&gt;try-catch-finally&lt;/span&gt; statements to handling the exceptions and then direct them to message box or log file. But no one can assure you every exceptions in your Java application is guaranteed to be handled. Those unhandled exceptions usually going to your &lt;span style=&quot;font-style: italic;&quot;&gt;System.err&lt;/span&gt; output stream. So how to handling the unhandled exceptions?&lt;br /&gt;&lt;span class=&quot;fullpost&quot;&gt;&lt;p&gt;Since J2SE 1.5.0, new Interface is introduced, called &lt;a href=&quot;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.UncaughtExceptionHandler.html&quot; target=&quot;_blank&quot;&gt;Thread.UncaughtExceptionHandler&lt;/a&gt;. All you have to do is create new class that implements that Inferface. And then in your main class, call &lt;em&gt;Thread.setDefaultUncaughtExceptionHandler()&lt;/em&gt; method before doing anything else.&lt;/p&gt;Here is the example:&lt;br /&gt;&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;pre&gt;&lt;code&gt;public class errHandler implements Thread.UncaughtExceptionHandler {&lt;br /&gt;         public void uncaughtException(Thread t, Throwable e) {&lt;br /&gt;                //implements your error handling here,&lt;br /&gt;                //such as creating message box&lt;br /&gt;         }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;In your application, don&#39;t forget to call:&lt;blockquote&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;code&gt;Thread.setDefaultUncaughtExceptionHandler(new errHandler());&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Sample Implementation Screenshot:&lt;br /&gt;&lt;p&gt;&lt;img src=&quot;http://i32.photobucket.com/albums/d20/weiliang_1978/exception-sample.gif&quot; alt=&quot;Java J2SE UncaughtExceptionHandler&quot; align=&quot;middle&quot; height=&quot;264&quot; width=&quot;333&quot; /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;In my sample above, I showing a JDialog which contain JTextArea and 2 buttons, one of them is &quot;Print&quot; button, for error-reporting.&lt;/p&gt;&lt;/span&gt;</description><link>http://idiot-howto.blogspot.com/2006/09/threaduncaughtexceptionhandler-new.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>1</thr:total></item></channel></rss>