<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="http://www.marcanoonline.com/plog/styles/rss.css" type="text/css"?>
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom"
>
 <channel>
  <title>Robert Marcano&#039;s blog</title>
  <link>http://www.marcanoonline.com/plog/blog/1</link>
  <description></description>
  <pubDate>Thu, 11 Mar 2010 01:03:00 -0800</pubDate>
  <generator>http://www.lifetype.net</generator>
    <item>
   <title>Subclipse added to Fedora Extras</title>
   <description>
    &lt;p&gt;After approval I added &lt;a href=&quot;http://subclipse.tigris.org/&quot;&gt;Subclipse&lt;/a&gt; (Subversion Eclipse plugin) to the Fedora Extras repository. :-P &lt;a href=&quot;http://overholt.ca/wp/?p=64&quot;&gt;The news&lt;/a&gt; reached &lt;a href=&quot;http://fedoraproject.org/people/&quot;&gt;Fedora People&lt;/a&gt; and &lt;a href=&quot;http://www.dberlin.org/planetgcc/&quot;&gt;Planet GCC&lt;/a&gt;.&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/156</link>
   <comments>http://www.marcanoonline.com/plog/post/1/156</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/156</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
      
    <category>Linux</category>
      
    <category>Development</category>
      
    <category>Open Source</category>
         <pubDate>Sat, 26 Aug 2006 21:14:26 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>JBoss Inc. to be acquired by Red Hat</title>
   <description>
    &lt;p&gt;&lt;a href=&quot;http://www.redhat.com/about/news/prarchive/2006/jboss.html&quot;&gt;Amazing news....&lt;/a&gt;.&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/148</link>
   <comments>http://www.marcanoonline.com/plog/post/1/148</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/148</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
      
    <category>Open Source</category>
         <pubDate>Mon, 10 Apr 2006 13:05:20 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>Java = APIs, Oracle = Wrong APIs implementations</title>
   <description>
    &lt;p&gt;Since &lt;a href=&quot;http://java.sun.com/products/jdbc/&quot;&gt;JDBC&lt;/a&gt; 3.0 it has been posible to retrieve the keys that are generated on a database when an SQL insert is executed, using the &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#getGeneratedKeys()&quot;&gt;getGeneratedKeys()&lt;/a&gt; method on the statement object. For some reason the latest Oracle JDBC driver that claims that implement this method, has a &lt;a href=&quot;http://forums.oracle.com/forums/thread.jspa?threadID=336591&amp;amp;amp;tstart=-1&quot;&gt;non standard behaviour&lt;/a&gt; (that is not strange on Oracle):&lt;/p&gt;

&lt;p&gt;It does not returns the generated keys values, it only returns a value for a propietary object implementation named ROWID. One of the solutions was to use that ROWID in a query to retrieve the other generated columns:&lt;/p&gt;

&lt;pre&gt;SELECT KEY_1, KEY_2, KEY_3 FROM MYTABLE WHERE ROWID = ?&lt;/pre&gt;

&lt;p&gt;where KEY_1, KEY_2, KEY_3 are the generated columns I want to know its value. The other solution is not to use the int parameter (with the value &lt;em&gt;Statement.RETURN_GENERATED_KEYS&lt;/em&gt;) in the PreparedStatement, instead use the one that &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Connection.html#prepareStatement(java.lang.String,%20java.lang.String[])&quot;&gt;needs the generated column names or indexes.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another reason why I prefer &lt;a href=&quot;http://www-306.ibm.com/software/data/db2/&quot;&gt;IBM DB2&lt;/a&gt; and &lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt; over &lt;a href=&quot;http://www.oracle.com/database/&quot;&gt;Oracle&lt;/a&gt;.&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/128</link>
   <comments>http://www.marcanoonline.com/plog/post/1/128</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/128</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
         <pubDate>Wed, 23 Nov 2005 14:50:39 -0500</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>Java Desktop Search</title>
   <description>
    &lt;p&gt;I am in the process of learning &lt;a href=&quot;http://java-gnome.sourceforge.net/&quot;&gt;Java-GNOME&lt;/a&gt; and to do that I am building a desktop search tool. I have currently working the basic UI and basic file indexing.&lt;/p&gt;

&lt;p&gt;Why am I doing this? before anyone start asking why I do not use &lt;a href=&quot;http://beaglewiki.org/&quot;&gt;Beagle&lt;/a&gt;, these are my reasons&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I want to learn.&lt;/li&gt;
&lt;li&gt;I believe that &lt;a href=&quot;http://gcc.gnu.org/java/&quot;&gt;GCJ&lt;/a&gt;/&lt;a href=&quot;http://www.gnu.org/software/classpath/&quot;&gt;Classpath&lt;/a&gt; are a more open solution than &lt;a href=&quot;http://www.mono-project.com&quot;&gt;Mono&lt;/a&gt;, remember that this is my personal decission and you are free to use what you preffer.&lt;/li&gt;
&lt;li&gt;I think that still are many gaps on the amount of GNOME and POSIX APIs available to Java programmers, so I intend with a popular type of application to detect what can be enhanced, for example, bindings to &lt;a href=&quot;http://www.gnome.org/~veillard/gamin/&quot;&gt;FAM/gamin&lt;/a&gt;, &lt;a href=&quot;http://www.kernel.org/pub/linux/kernel/people/rml/inotify/v2.6/&quot;&gt;inotify&lt;/a&gt; and others.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is an very early screenshot of what is being developed, there will not be any release until something more useful is ready (stay tuned :-) ):&lt;/p&gt;

&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; alt=&quot;Very preliminary screenshot of my desktop search application&quot; src=&quot;http://www.marcanoonline.com/plog/resserver.php?blogId=1&amp;amp;resource=desktop-search.png&quot; /&gt;&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/102</link>
   <comments>http://www.marcanoonline.com/plog/post/1/102</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/102</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
      
    <category>GNOME</category>
         <pubDate>Mon, 11 Jul 2005 21:42:11 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>Java has a great community</title>
   <description>
    &lt;p&gt;Last week I was reading one of the &lt;a href=&quot;http://jroller.com/page/santhosh/20050709#context_sensitive_actions&quot;&gt;posts&lt;/a&gt; on &lt;a href=&quot;http://jroller.com/page/santhosh/&quot;&gt;Santhosh Kumar&#039;s Weblog&lt;/a&gt; and as the problem explained was related to and old one I had, I decided to ask for a little help; later a full post was published with Santhosh &lt;a href=&quot;http://jroller.com/page/santhosh/20050709#globally_context_sensitive_actions&quot;&gt;solution&lt;/a&gt;. Thanks.&lt;/p&gt;

&lt;p&gt;My friends always ask me why I write tips or solutions to software development problems. My answer is always the same: &quot;because someone need it&quot;, that is the only way I have to say thanks to the people that had helped anonymously.&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/101</link>
   <comments>http://www.marcanoonline.com/plog/post/1/101</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/101</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
      
    <category>Personal</category>
         <pubDate>Mon, 11 Jul 2005 17:00:41 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>Hibernate criteria API limitation</title>
   <description>
    &lt;p&gt;I tried a few hours to solve the following problem: having a class named &lt;em&gt;Group&lt;/em&gt; that has zero or more &lt;em&gt;roles&lt;/em&gt;, where each role is a String, and the mapping is the following:&lt;/p&gt;

&lt;pre&gt;&amp;lt;set
    name=&quot;roles&quot;
    table=&quot;GROUPROLES&quot;
    lazy=&quot;true&quot;
    &amp;lt;key column=&quot;GROUP&quot;/&amp;gt;
    &amp;lt;element column=&quot;ROLE&quot;/&amp;gt;
&amp;lt;/set&amp;gt;&lt;/pre&gt;

&lt;p&gt;create a Criteria based query that returns the groups that has assigned a particular role. Well, this is not posible without resorting to direct SQL, and this is a limitation of Hibernate when one of relationship sides is not a mapped class, like this case that is a String.&lt;/p&gt;

&lt;p&gt;The workaround: use a SQL expresion with a susbselect:&lt;/p&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;Expresion.sql(&quot;EXISTS (SELECT * FROM GROUPROLES&quot;
                    + &quot; WHERE GROUP = {alias}.GROUP&quot;
                    + &quot;    AND ROLE = ?)&quot;,
              &quot;myrole&quot;,
              Hibernate.STRING)&lt;/pre&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/100</link>
   <comments>http://www.marcanoonline.com/plog/post/1/100</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/100</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
         <pubDate>Thu, 07 Jul 2005 22:30:06 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>Litte glasspane bug report accepted</title>
   <description>
    &lt;p&gt;I have reported a bug when using a glasspane to show the wait cursor and it &lt;a href=&quot;http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294063&quot;&gt;has been approved&lt;/a&gt;. The problem is that the cursor does not change when the glasspane is used in a JDialog with no parent window.&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/99</link>
   <comments>http://www.marcanoonline.com/plog/post/1/99</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/99</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
         <pubDate>Thu, 07 Jul 2005 14:11:17 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>JTabbedPane background on Windows XP</title>
   <description>
    &lt;p&gt;I am not a fan of the usage of notebook like widgets because I think that they tend to make the application interface cluttered, I prefer wizard like structures, but sometimes they are the best solution available. In Java this kind of component is called a &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTabbedPane.html&quot;&gt;JTabbedPane&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For some reason when looking a JTabbedPane with the Windows look and feel on Windows XP (Luna theme), a small anoyance is revealed: JPanel components on the JTabbedPane are opaque thus hiding the tabbed pane default background, like this:&lt;/p&gt;

&lt;p&gt;&lt;img alt=&quot;JTabbedPane with the wrong background on Windows XP&quot; src=&quot;http://www.marcanoonline.com/plog/resserver.php?blogId=1&amp;amp;resource=tabbedpane-wrong-background.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To solve this remember to set your JPanels and other components like radio buttons and checkboxes non opaque:&lt;/p&gt;

&lt;pre&gt;panel.setOpaque(false);&lt;/pre&gt;

&lt;p&gt;and you will get a nicer tabbed pane&lt;/p&gt;

&lt;p&gt;&lt;img alt=&quot;JTabbedPane with the correct background on Windows XP&quot; src=&quot;http://www.marcanoonline.com/plog/resserver.php?blogId=1&amp;amp;resource=tabbedpane-correct-background.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 07/06/2005:&lt;/strong&gt; I forgot to tell that this only works with JSE 5.0 because the Windows Look and Feel on previous releases did not implemented the correct JTabbedPane background&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 07/08/2005:&lt;/strong&gt; This probably is a bug in the Sun implementation as said by one of the commentators, but I think they will not change that because JPanels on the Windows L&amp;amp;F has been always opaque. My solution involves the usage of a custom utility method that traverse the components tree and change the opacity for the panels when the Windows L&amp;amp;F is active.&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/98</link>
   <comments>http://www.marcanoonline.com/plog/post/1/98</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/98</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
         <pubDate>Wed, 06 Jul 2005 15:13:56 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>Java-GNOME</title>
   <description>
    &lt;p&gt;Now that many Linux distributions are packaging updated versions of &lt;a href=&quot;http://gcc.gnu.org/java/&quot;&gt;GCJ&lt;/a&gt;, &lt;a href=&quot;http://www.eclipse.org/&quot;&gt;Eclipse&lt;/a&gt; and &lt;a href=&quot;http://java-gnome.sourceforge.net/&quot;&gt;Java-GNOME&lt;/a&gt;, never has been so easy to develop &lt;a href=&quot;http://www.gnome.org/&quot;&gt;GNOME&lt;/a&gt; applications using Java. I am using &lt;a href=&quot;http://fedora.redhat.com/&quot;&gt;Fedora&lt;/a&gt; Core 4 and for this little tutorial you must have installed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;eclipse-jdt&lt;/li&gt;
&lt;li&gt;libgtk-java&lt;/li&gt;
&lt;li&gt;libgnome-java&lt;/li&gt;
&lt;li&gt;libgconf-java&lt;/li&gt;
&lt;li&gt;libglade-java&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use yum to install them:&lt;/p&gt;

&lt;pre&gt;yum install eclipse-jdt libgnome-java libgconf-java libglade-java libgtk-java&lt;/pre&gt;&lt;p&gt;Start Eclipse and create a Java project. Edit the build path of your new project adding the following external jars&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;/usr/share/java/gtk2.6.jar&lt;/li&gt;
&lt;li&gt;/usr/share/java/gconf2.10.jar&lt;/li&gt;
&lt;li&gt;/usr/share/java/glade2.10.jar&lt;/li&gt;
&lt;li&gt;/usr/share/java/gnome2.10.jar&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;http://www.marcanoonline.com/plog/resserver.php?blogId=1&amp;amp;resource=java-gnome-jars.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you can try with this example:&lt;/p&gt;

&lt;pre&gt;public static void main(String[] args) {
	// intializing GTK
	Gtk.init(args);

	// creating the widget tree
	Window window = new Window(WindowType.TOPLEVEL);
	window.setTitle(&quot;Testing GTK&quot;);
	window.add(new Button(&quot;Test...&quot;));

	// adding a listener to detect when the window is closed to end the
	// event dispatch main cycle and exit the application
	window.addListener(new LifeCycleListener() {
		public void lifeCycleEvent(LifeCycleEvent evnt) {
			if (evnt.getType() == LifeCycleEvent.Type.UNREALIZE)
				Gtk.mainQuit();
		}

		public boolean lifeCycleQuery(LifeCycleEvent evnt) {
			return false;
		}
	});
	// showing the window
	window.showAll();

	// starting the event dispatch cycle
	Gtk.main();
}&lt;/pre&gt;

&lt;p&gt;Test the application and you will get something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.marcanoonline.com/plog/resserver.php?blogId=1&amp;amp;resource=test-gtk.png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Extended documentation can be found on the &lt;a href=&quot;http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/HintsAndTips&quot;&gt;Java-GNOME documentation page&lt;/a&gt; and the original &lt;a href=&quot;http://developer.gnome.org/doc/&quot;&gt;GNOME documentation&lt;/a&gt; (C based APIs)
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/95</link>
   <comments>http://www.marcanoonline.com/plog/post/1/95</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/95</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
      
    <category>Linux</category>
      
    <category>GNOME</category>
      
    <category>Development</category>
      
    <category>Open Source</category>
         <pubDate>Sun, 03 Jul 2005 18:30:04 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
    <item>
   <title>Disabling Keyboard Input - Swing</title>
   <description>
    &lt;p&gt;A good programmer using Swing knows that long operations must be executed outside the Swing event dispatch thread, and there are many utlities to do that like the &lt;a href=&quot;http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html&quot;&gt;SwingWorker&lt;/a&gt; class. One of the problems that arises when another thread in opened to do processing is that sometimes is needed to inhibit any input made by the user. One of the solutions is the usage of the glass pane in order to capture input events, adding a mouse listener to the glass pane we can capture all mouse input events in order to block them.&lt;/p&gt;

&lt;p&gt;But what about key events? a key listener works, but is required to transfer the focus to the glass pane, and that remove the focus from the current focused component. For this key events problem I take another approach: use the &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/awt/KeyboardFocusManager.html&quot;&gt;KeyboardFocusManager&lt;/a&gt;. This class allows to install a &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/awt/KeyEventDispatcher.html&quot;&gt;KeyEventDispatcher&lt;/a&gt; that is able to route the event to the appropiate component. If a dispatcher is installed that always returns true, no key event will be sent to any component until the dispatcher is removed. See the following example:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-java&quot;&gt;import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.WindowConstants;

public class TestWindow {
    private static JFrame frame;

    private static KeyEventDispatcher dispatcher = new KeyEventDispatcher() {
        public boolean dispatchKeyEvent(KeyEvent e) {
            // returning true will make the KeyboardFocusManager to not send the
            // event the component
            return true;
        }
    };

    public static void main(String[] args) {
        frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        // building the components tree
        frame.setBounds(0, 0, 400, 400);
        JTextField tf = new JTextField();
        frame.getContentPane().add(tf);
        frame.setVisible(true);

        // enter on the text field will call a new thread performing a long
        // operation without blocking the swing events dispatch thread
        tf.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // setting a glass pane
                JPanel gp = new JPanel();
                gp.setOpaque(false);
                frame.setGlassPane(gp);
                gp.setVisible(true);

                // this empty mouse listener will capture all the mouse events
                gp.addMouseListener(new MouseAdapter() {
                });

                // installing the dispatcher
                KeyboardFocusManager kfm = KeyboardFocusManager
                        .getCurrentKeyboardFocusManager();
                kfm.addKeyEventDispatcher(dispatcher);

                // starting the thread
                Thread t = new LongOperation();
                t.start();
            }
        });
    }

    private static class LongOperation extends Thread {
        public void run() {
            try {
                // doing someting for a long time
                Thread.sleep(5000);
            } catch (Exception e) {
                e.printStackTrace();
            }

            // hidding the glass pane
            frame.getGlassPane().setVisible(false);

            // removing the dispatcher
            KeyboardFocusManager kfm = KeyboardFocusManager
                    .getCurrentKeyboardFocusManager();
            kfm.removeKeyEventDispatcher(dispatcher);
        }
    }
}&lt;/pre&gt;

&lt;p&gt;Calling the action on the JTextField (enter key) a glass pane will be installed to consume mouse events, and a KeyEventDispatcher to consume key events, next the long operation thread will start. At the end the glass pane and the dispatcher are removed to allow normal processing of the events. In the period that the new thread is executing, no input will be accepted by the user, that was the idea.&lt;/p&gt;
   </description>
   <link>http://www.marcanoonline.com/plog/post/1/92</link>
   <comments>http://www.marcanoonline.com/plog/post/1/92</comments>
   <guid>http://www.marcanoonline.com/plog/post/1/92</guid>
      <dc:creator>robert</dc:creator>
      
    <category>Java</category>
      
    <category>Development</category>
         <pubDate>Thu, 09 Jun 2005 16:11:28 -0400</pubDate>
   <source url="http://www.marcanoonline.com/plog/rss/rss20/1">Robert Marcano&#039;s blog</source>
     </item>
   </channel>
</rss>