<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Java-Hate on Insignificant Bits</title>
    <link>https://bobcopeland.com/blog/tags/java-hate/</link>
    <description>Recent content in Java-Hate on Insignificant Bits</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <lastBuildDate>Thu, 13 Dec 2012 17:03:51 +0000</lastBuildDate>
    <atom:link href="https://bobcopeland.com/blog/tags/java-hate/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Mavened.</title>
      <link>https://bobcopeland.com/blog/2012/12/mavened/</link>
      <pubDate>Thu, 13 Dec 2012 17:03:51 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=1914</guid> 
      <description>&lt;p&gt;So, I&amp;rsquo;m applying a one line patch to a Java package, and oh yes, it needs maven. Hooray!&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-gdscript3&#34; data-lang=&#34;gdscript3&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;$&lt;/span&gt; apt&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;cache depends &lt;span style=&#34;color:#f92672&#34;&gt;--&lt;/span&gt;recurse maven &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; grep Depends &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     grep &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;v &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;lt;&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; egrep lib&lt;span style=&#34;color:#f92672&#34;&gt;.*&lt;/span&gt;java &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; sort &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; uniq &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; wc &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;l
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;203&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#f92672&#34;&gt;...&lt;/span&gt; start build &lt;span style=&#34;color:#f92672&#34;&gt;and&lt;/span&gt; watch maven download another pile &lt;span style=&#34;color:#f92672&#34;&gt;...&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;$&lt;/span&gt; find &lt;span style=&#34;color:#f92672&#34;&gt;~/.&lt;/span&gt;m2 &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;name &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;pom &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; wc &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;l
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;851&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I find it hard to believe that there are that many useful libraries in the world.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Orders of magnitude</title>
      <link>https://bobcopeland.com/blog/2012/03/orders-of-magnitude/</link>
      <pubDate>Fri, 30 Mar 2012 11:53:47 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=1811</guid> 
      <description>&lt;p&gt;I had a Hadoop map-reduce job that kept timing out, which led to this interesting discovery:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ time ./json-parser-test.py
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;real	0m0.205s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;user	0m0.152s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sys	0m0.032s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ time ./json-parser-test-no-speedups.py
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;real	0m2.069s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;user	0m2.044s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sys	0m0.024s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ time jython ./json-parser-test-no-speedups.py
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;real	79m59.785s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;user	80m23.709s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sys	0m14.441s
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Moral: use Java-based JSON libraries if you have to use Jython and JSON. Also, Java sucks.&lt;/p&gt;</description>
    </item>
    <item>
      <title>On static in Java</title>
      <link>https://bobcopeland.com/blog/2011/01/on-static-in-java/</link>
      <pubDate>Sun, 30 Jan 2011 00:52:06 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=1564</guid> 
      <description>&lt;p&gt;In C, scoping rules aside, the following are pretty much the same:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;static int x[] = { /* ... */ };
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int foo()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    /* do something with x */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int bar()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    static int x[] = { /* ... */ };
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    /* do something with x */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The static array &lt;code&gt;x&lt;/code&gt; will go into the .data section of the executable. When the OS loads the executable into memory, it will ensure that the values for &lt;code&gt;x&lt;/code&gt; are set in the appropriate place (e.g. by mapping its disk page to the virtual address in the ELF headers). In the second case, &lt;code&gt;x&lt;/code&gt; is given some alias to avoid symbol conflicts.&lt;/p&gt;</description>
    </item>
    <item>
      <title>JNIs and ABIs</title>
      <link>https://bobcopeland.com/blog/2010/08/jnis-and-abis/</link>
      <pubDate>Wed, 11 Aug 2010 03:16:11 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=1514</guid> 
      <description>&lt;p&gt;For a recent task at work, I had a compelling reason to break out of the Java jail and do some &amp;ldquo;real programming&amp;rdquo; in C. Unfortunately, said C-language bits were to be run on the Windows platform. I had a stripped DLL (no source) for manipulating USB cameras and an API document to work with, and a plan to duct tape this all together with JNI.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not about to touch MSVC if I can help it, so I grabbed mingw packages for my platform and wrote up a small wrapper DLL to do the necessary JNI bridge. Here&amp;rsquo;s my attempt to archive the working recipe for the Google bots.&lt;/p&gt;</description>
    </item>
    <item>
      <title>JBoss Hash</title>
      <link>https://bobcopeland.com/blog/2010/01/jboss-hash/</link>
      <pubDate>Mon, 04 Jan 2010 22:21:26 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=1414</guid> 
      <description>&lt;p&gt;Here&amp;rsquo;s how to figure out the hashes of method names used by JBoss&amp;rsquo; RMI invoker from the shell. The first two numbers in the method signature form the length of the string. Maybe there&amp;rsquo;s a better way to do the backrefs in sed, but you do need to swap them around.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ echo $[`printf &amp;#34;0031ping(Ljava/lang/String;)V&amp;#34; |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sha1sum |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sed -e &amp;#34;s/(..)(..)(..)(..)(..)(..)(..)(..).*/0x87654321/g&amp;#34;`]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Don&amp;rsquo;t ask me why I figured that out.&lt;/p&gt;</description>
    </item>
    <item>
      <title>sizeof()</title>
      <link>https://bobcopeland.com/blog/2009/02/sizeof/</link>
      <pubDate>Tue, 17 Feb 2009 21:50:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=580</guid> 
      <description>&lt;p&gt;Renaming your class variables to shorter names reduces your EJB network footprint. Finally, those people who said that removing vowels from variable names improved performance are vindicated! Ok, well they were correct already in Javascript, but that doesn&amp;rsquo;t count.&lt;/p&gt;</description>
    </item>
    <item>
      <title>is-not-a</title>
      <link>https://bobcopeland.com/blog/2009/02/is-not-a/</link>
      <pubDate>Tue, 17 Feb 2009 03:18:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=579</guid> 
      <description>&lt;p&gt;&lt;a href=&#34;http://asserttrue.blogspot.com/2009/02/inheritance-as-antipattern.html&#34;&gt;Let&amp;rsquo;s dump the last useful feature in Java&lt;/a&gt;. What castles in the sky are people building these days?&lt;/p&gt;</description>
    </item>
    <item>
      <title>swing rant</title>
      <link>https://bobcopeland.com/blog/2008/07/swing-rant/</link>
      <pubDate>Mon, 07 Jul 2008 14:56:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=538</guid> 
      <description>&lt;p&gt;Never ever write a Java gui application with the requirement that you check fields before letting the user tab off of them. What a nightmare! Your only two tools, without rewriting large parts of Swing yourself, are FocusListener and InputVerifier. FocusListener is great for the case when you have two such fields. Set up bad data in each field, then watch the focus traversal war as a focusLost() method reclaims the focus for one component, causing focusLost() in the other component to fire. Fun. Then you have InputVerifier, ostensibly designed for this very purpose. Ignoring the fact that buttons still fire without the verifier getting called, now you have the awesomeness of not knowing what the target component would be. Want to build a view with multiple fields that get validated as one? Good luck with that.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Meh</title>
      <link>https://bobcopeland.com/blog/2008/05/meh/</link>
      <pubDate>Tue, 13 May 2008 13:48:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=531</guid> 
      <description>&lt;p&gt;I&amp;rsquo;m playing with date conversions today, and again I&amp;rsquo;m struck by how much the Java Calendar should be held up as an example of the over-engineered API. Has anyone ever used anything besides the Gregorian calendar? They were so proud of it when it hit 1.1.&lt;/p&gt;
&lt;p&gt;I should have two patches hitting kernel 2.6.26, one entirely cosmetic and one that fixes a real bug on Atheros wireless cards. Akpm did pick up the OMFS patchset so hopefully that will go in .27 timeframe, though the jury is still out on whether it hits mainline.&lt;/p&gt;</description>
    </item>
    <item>
      <title>javac sucks</title>
      <link>https://bobcopeland.com/blog/2008/04/javac-sucks/</link>
      <pubDate>Thu, 10 Apr 2008 14:39:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=524</guid> 
      <description>&lt;p&gt;More evidence that javac is one of the dumbest compilers ever:
&lt;code&gt;public class Foo extends java.lang.Object{ public Foo(); Code: 0:   aload_0 1:   invokespecial   #1; //Method java/lang/Object.&amp;quot;&amp;quot;:()V 4:   return public static void main(java.lang.String[]); Code: 0:   aconst_null 1:   instanceof      #2; //class Foo 4:   ifeq    15 7:   getstatic       #3; //Field java/lang/System.out:Ljava/io/PrintStream; 10:  ldc     #4; //String never! 12:  invokevirtual   #5; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 15:  return }&lt;/code&gt;
Ok, I&amp;rsquo;ll give them a break &amp;ndash; this probably never comes up in a real application.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why I hate ant</title>
      <link>https://bobcopeland.com/blog/2008/02/why-i-hate-ant/</link>
      <pubDate>Thu, 28 Feb 2008 20:04:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=516</guid> 
      <description>&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ strace -f ant &amp;gt; out.txt 2&amp;gt;&amp;amp;1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep &amp;#34;stat.*java&amp;#34; out.txt  | wc -l
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;32933
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;WTF? No wonder our build times suck. I still have yet to hear a rationale for the existence of ant that had any more substance than &amp;ldquo;but make uses tabs!&amp;rdquo;&lt;/p&gt;</description>
    </item>
    <item>
      <title>I hate you, Sun.</title>
      <link>https://bobcopeland.com/blog/2008/01/i-hate-you-sun/</link>
      <pubDate>Thu, 24 Jan 2008 22:04:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=510</guid> 
      <description>&lt;p&gt;Is it too much to ask of a compiler that if it decides to blare warnings at you for no reason at all, that you can turn the !@#$ thing off? In a move that rivals the stupidity of certain gcc warnings, we have this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[javac] file: java:519: warning: com.sun.rowset.CachedRowSetImpl is Sun proprietary API and may be removed in a future release&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Well, hey that&amp;rsquo;s a nice heads-up to give me 600 times when compiling our tree. Let me go find the non-com.sun equivalent of that. Oh wait, there isn&amp;rsquo;t one! And, the freaking javadoc even tells you to do it that way. Okay, well, maybe &lt;code&gt;@SuppressWarnings({&amp;quot;deprecation&amp;quot;})&lt;/code&gt; will work? Nope, haha! Sigh. Time for a wrapper script.&lt;/p&gt;</description>
    </item>
    <item>
      <title>I dislike Java.</title>
      <link>https://bobcopeland.com/blog/2006/10/i-dislike-java/</link>
      <pubDate>Wed, 25 Oct 2006 19:00:00 +0000</pubDate>
       <guid isPermaLink="false">http://bobcopeland.com/blog/?p=460</guid> 
      <description>&lt;p&gt;Dear lazy web,&lt;/p&gt;
&lt;p&gt;It would be nice if you could tell me a non-hacky way to do progress dialogs from within the event-dispatch thread in Swing, where all of our application logic happens to reside.&lt;/p&gt;
&lt;p&gt;This doesn&amp;rsquo;t work:
&lt;code&gt;display modal dialog start worker thread&lt;/code&gt; (won&amp;rsquo;t run because event thread is blocked)&lt;/p&gt;
&lt;p&gt;Nor does this:
&lt;code&gt;start worker thread display modal dialog&lt;/code&gt; (race condition hiding the dialog)&lt;/p&gt;
&lt;p&gt;Joining in the event thread won&amp;rsquo;t work because it blocks updates. Using a non-modal dialog and passing the bottom-half of the rest of the event thread to the worker thread to execute at completion will work, but is obscenely messy. Or, one can spin in the beginning of the thread waiting for the modal dialog to appear to avoid the race condition, but that is still gross. One could subclass Dialog and have it also signal a condition variable once it blocks&amp;hellip; ugh.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
