<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3619881695344253937</id><updated>2012-02-16T06:55:56.022-08:00</updated><category term='Windows sc.exe'/><category term='Windows instsrv.exe'/><category term='InstallShield'/><category term='WebService'/><category term='JScrollPane'/><category term='EC2-S3'/><category term='XML XPath'/><category term='DebugBreak'/><category term='Java'/><category term='ICS'/><category term='Pipes and Filters'/><category term='Bi-directional Maps'/><category term='Ajax'/><category term='Oracle DB'/><category term='Windows DLL'/><category term='Repeating JButton'/><category term='Windows Assemblies'/><category term='Swing'/><category term='Windows &quot;Local system account&quot;'/><category term='SortedList'/><category term='dotnetfx2.0.exe'/><category term='Unix Admin'/><category term='Jetty'/><category term='Agile'/><category term='Subclipse and Tortoise SVN'/><category term='General Interface'/><category term='HTTP daemon'/><category term='vstor2005.exe'/><category term='NanoHttpd'/><category term='EAI'/><category term='JAX-WS'/><category term='o2007pia.msi'/><category term='Spring'/><category term='Miscellaneous'/><category term='Windows Service'/><category term='surf stick'/><category term='Visual C++'/><category term='JTextArea'/><category term='JSON'/><category term='redundant home internet'/><title type='text'>Tech Eureka</title><subtitle type='html'>Random thoughts about Java, Patterns, EAI, C++</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-8997065028952313961</id><published>2011-07-12T09:38:00.000-07:00</published><updated>2011-07-12T09:48:22.727-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Eclipse doesn't start after crash</title><content type='html'>After a crash on Windows 7, my beloved Eclipse environment wouldn't start again!
It just hung there, showing nothing but the Splash screen.
eclipse -clean didn't help, monitoring files with Sysinternal's ProcMon or 'handle.exe' didn't help - quite devastating...

But finally I found the solution &lt;a href="http://off-topic.biz/en/eclipse-hangs-at-startup-showing-only-the-splash-screen/"&gt;here&lt;/a&gt;:

&lt;ol&gt;&lt;li&gt;cd to your Eclipse home directory&lt;/li&gt;&lt;li&gt;cd .metadata/.plugins&lt;/li&gt;&lt;li&gt;ren org.eclipse.core.resources BAK (Keep this directory around)&lt;/li&gt;&lt;li&gt;Restart Eclipse, ignore the error message.&lt;/li&gt;&lt;li&gt;Close all open editors tabs !! (in my case, playing with the .xsd file editor caused the issue)&lt;/li&gt;&lt;li&gt;Exit Eclipse.&lt;/li&gt;&lt;li&gt;del org.eclipse.core.resources (Delete the newly created directory.)&lt;/li&gt;&lt;li&gt;ren BAK org.eclipse.core.resources (Restore the original directory.)&lt;/li&gt;&lt;li&gt;Restart Eclipse.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-8997065028952313961?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/8997065028952313961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2011/07/eclipse-doesnt-start-after-crash.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8997065028952313961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8997065028952313961'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2011/07/eclipse-doesnt-start-after-crash.html' title='Eclipse doesn&apos;t start after crash'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-6759613483855609529</id><published>2010-12-15T01:29:00.000-08:00</published><updated>2010-12-15T01:46:55.770-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Repeating JButton'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Swing'/><title type='text'>How to implement a 'repeating' Swing JButton ?</title><content type='html'>Sometimes you want to repeat your JButton action after the button was pressed. This is definitely not rocket-science, but I thought it's nice and small enough to share. Here's the usual code with a one-click action: a 'Next' button that selects the next row in a table.
&lt;pre&gt;&lt;code&gt;
    nextButton.addActionListener( new ActionListener() {
      public void actionPerformed(ActionEvent arg0)
      {
        selectNextRow(...);
      }});
&lt;/code&gt;&lt;/pre&gt;
For a repeating button, you can &lt;b&gt;&lt;i&gt;replace &lt;/i&gt;&lt;/b&gt;this code with the code snippet below. Adjust the times appropriately. I wonder why this isn't standard functionality in a Swing JButton(..., startMsec, repeatMsec) ?
&lt;pre&gt;&lt;code&gt;
    nextButton.addMouseListener( new MouseAdapter() {
      
      Timer repeatTimer;
      
      public void mousePressed(MouseEvent arg0)
      {
        selectNextRow(...); // initial execution
        
        repeatTimer = new Timer(100, new ActionListener() {
          public void actionPerformed(ActionEvent e)
          {
            selectNextRow(...); // execute every 100 msec
          }});
        repeatTimer.setInitialDelay(1000); // start repeating only after 1 second
        repeatTimer.start();
      }
      
      public void mouseReleased(MouseEvent arg0)
      {
        repeatTimer.stop();
      }});
&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-6759613483855609529?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/6759613483855609529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2010/12/how-to-implement-repeating-swing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6759613483855609529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6759613483855609529'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2010/12/how-to-implement-repeating-swing.html' title='How to implement a &apos;repeating&apos; Swing JButton ?'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-5728636797591720383</id><published>2010-05-18T02:13:00.000-07:00</published><updated>2010-05-18T02:21:22.030-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle DB'/><title type='text'>Managing Oracle Tablespace (ORA-01653 error)</title><content type='html'>&lt;div&gt;This procedure helped me a bit to manage an Oracle DB's tablespace. I was getting&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;ORA-01653: unable to extend table SYSTEM... &lt;/span&gt;&lt;/span&gt;errors. &lt;/div&gt;&lt;div&gt;Maybe the following procedure is useful for others as well:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;In order to manage/see the current usage, here's a good script posted by 'bipul' on &lt;a href="http://forums.oracle.com/forums/thread.jspa?messageID=3590569"&gt;http://forums.oracle.com/forums/thread.jspa?messageID=3590569&lt;/a&gt;&lt;/li&gt;&lt;li&gt;To check which data files are used: &lt;p class="MsoListParagraph"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Calibri, sans-serif; font-weight: normal; font-size: 15px; "&gt;select name from v$datafile&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;To increase that setting:&lt;/li&gt;&lt;/ol&gt;&lt;span class="Apple-style-span" style="font-family: Calibri, sans-serif; font-size: 15px; "&gt;alter database datafile 'C:\ORACLEXE\ORADATA\XE\SYSTEM.DBF' autoextend on next 100m maxsize 2000m;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-5728636797591720383?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/5728636797591720383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2010/05/managing-oracle-tablespace-ora-01653.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/5728636797591720383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/5728636797591720383'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2010/05/managing-oracle-tablespace-ora-01653.html' title='Managing Oracle Tablespace (ORA-01653 error)'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-8699981992013686150</id><published>2010-02-24T10:21:00.000-08:00</published><updated>2010-02-24T10:23:14.331-08:00</updated><title type='text'>Quants</title><content type='html'>An interesting documentation about quants, including Emanuel Derman, &lt;div&gt;starts in Dutch first, but in English later.&lt;/div&gt;&lt;div&gt;
&lt;div&gt;&lt;a href="http://player.omroep.nl/?aflID=10567577"&gt;http://player.omroep.nl/?aflID=10567577&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-8699981992013686150?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/8699981992013686150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2010/02/quants.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8699981992013686150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8699981992013686150'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2010/02/quants.html' title='Quants'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-384068853684291897</id><published>2010-02-15T07:47:00.000-08:00</published><updated>2010-02-15T08:01:49.191-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='SortedList'/><title type='text'>Java: Sorted List</title><content type='html'>Sometimes you might have the need for a Java list, that is sorted with every element insertion. If you use a sorted TreeSet, you are stuck with iterators, no random access for elements. If you use an ArrayList, you could call Collections.sort() after every add, but that's not necessarily efficient. Collection.sort() will have to check the order for every element. If your list is long, this might take time.&lt;div&gt;
&lt;/div&gt;&lt;div&gt;But here's the trick: if you know your list was already sorted before your insertion, there's no need to re-sort everything again. You can find the proper insertion point with a quick binary search, and insert the new element at the proper position. Voilà, your list is always sorted.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Surprisingly simple to do this in Java:&lt;pre&gt;
&lt;span fontsize="-2"&gt;
&lt;code&gt;

/** A LinkedList that efficiently sorts itself with every add.
 * 
 * @author apodehl
 *
 */
public class SortedList&lt; T extends Comparable&lt;? super T&gt;&gt; extends LinkedList&lt;T&gt;
{
  /** Adds this element to the list at the proper sorting position.
   * If the element already exists, don't do anything.
   */
  @Override
  public boolean add(T e)
  {
    if( size()==0 ) {
      
      return super.add(e);
    }
    else {
      
      // find insertion index
      int idx = -Collections.binarySearch(this, e)-1;
      
      if( idx &lt; 0 ) {
        return true; // already added
      }
      
      // add at this position
      super.add(idx, e);
      return true;
    }
  }
}

&lt;/code&gt;
&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-384068853684291897?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/384068853684291897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2010/02/java-sorted-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/384068853684291897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/384068853684291897'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2010/02/java-sorted-list.html' title='Java: Sorted List'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-758794097285273928</id><published>2010-02-15T07:25:00.000-08:00</published><updated>2010-02-15T07:57:20.419-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bi-directional Maps'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java BiMap, BidiMap</title><content type='html'>After doing some research and trying to find just the right &lt;a href="http://tech-eureka.blogspot.com/2009/08/java-bi-directional-maps-apache-commons.html"&gt;Java Bi-Map&lt;/a&gt;, I couldn't find any, so I had to roll my own :-( To my surprise, implementation of a Bi-Maps is not straight-forward, there's not such thing as the 'one Bi-Map functionality'.&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;The interesting case is this one:  say there are mappings A-&gt;1 and B-&gt;2. What happens once you insert C-&gt;2 ? &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Will you remove B-&gt;2 to ensure uniqueness of keys and values ? (resulting in A-&gt;1 and C-&gt;2)&lt;/div&gt;&lt;div&gt;or not, resulting in A-&gt;1, B-&gt;2 and C-&gt;2. Please note that in the latter case, there's no well-defined lookup for value "2". Is it B or is it C ?&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;So what I needed was uniqueness of both keys and values, in all cases, using generics. Here it goes:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;span style="font-size:-2;"&gt;
&lt;pre&gt;
&lt;code&gt;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/**
 * One possible implementation of a Bi-directional Map.
 * 
 * Note: there are several variations of BiMap, depending on the behaviour of put(k,v)... Is it allowed to have more
 * than one k for one value ?? Modify
 * 
 * @author apodehl
 * 
 * @param &lt;K&gt;
 * @param &lt;V&gt;
 */
public class BiMap&lt;K, V&gt; implements Map&lt;K, V&gt;
{
  Map&lt;K, V&gt; keyVal; // maps key-&gt;value

  Map&lt;V, K&gt; valKey; // maps value-&gt;key

  public BiMap()
  {
    keyVal = new LinkedHashMap&lt;K, V&gt;();
    valKey = new LinkedHashMap&lt;V, K&gt;();
  }

  @Override
  public V put(K key, V val)
  {
    // --- this implementation allows one-to-one ONLY !! ---
    if (valKey.containsKey(val)) {
      keyVal.remove(valKey.get(val));
    }
    if (keyVal.containsKey(key)) {
      valKey.remove(keyVal.get(key));
    }
    // --- remove above if that's not what you want ---

    // 
    valKey.put(val, key);
    return keyVal.put(key, val);
  }

  @Override
  public void putAll(Map&lt; ? extends K, ? extends V&gt; m)
  {
    for (Entry&lt; ? extends K, ? extends V&gt; e : m.entrySet()) {
      put(e.getKey(), e.getValue());
    }
  }

  /**
   * Type-safe get.
   * 
   * @param key
   * @return
   */
  public K getKey(V val)
  {
    return valKey.get(val);
  }

  /**
   * Type-safe get.
   * 
   * @param key
   * @return
   */
  public V getVal(K key)
  {
    return keyVal.get(key);
  }

  @Override
  // unfortunately Map interface isn't type-safe
  public V get(Object key)
  {
    return getVal((K) key);
  }

  /**
   * Type-safe contains.
   * 
   * @param key
   * @return
   */
  public boolean contains(K key)
  {
    if (keyVal == null) return false;
    return keyVal.containsKey(key);
  }

  /**
   * Type-safe containsValue.
   * 
   * @param key
   * @return
   */
  public boolean containsVal(V val)
  {
    if (valKey == null) return false;
    return valKey.containsKey(val);
  }

  // unfortunately Map interface isn't type safe here ..
  @Override
  public boolean containsKey(Object key)
  {
    return contains((K) key);
  }

  // unfortunately Map interface isn't type safe here ..
  @Override
  public boolean containsValue(Object value)
  {
    return containsVal((V) value);
  }

  @Override
  public Set&lt; java.util.Map.Entry&lt;K, V&gt;&gt; entrySet()
  {
    return keyVal.entrySet();
  }

  @Override
  public boolean isEmpty()
  {
    return keyVal.isEmpty();
  }

  @Override
  public int size()
  {
    return keyVal.size();
  }

  @Override
  public Collection&lt;V&gt; values()
  {
    return keyVal.values();
  }

  public V removeByKey(K key)
  {
    V val = keyVal.remove(key);
    valKey.remove(val);
    return val;
  }

  public K removeByVal(V val)
  {
    K key = valKey.remove(val);
    keyVal.remove(key);
    return key;
  }

  // unfortunately Map interface isn't type-safe
  @Override
  public V remove(Object key)
  {
    return removeByKey((K) key);
  }

  @Override
  public Set&lt;K&gt; keySet()
  {
    return keyVal.keySet();
  }

  @Override
  public void clear()
  {
    keyVal.clear();
    valKey.clear();
  }

  public String toString()
  {
    String s = "BiMap:\n";
    s += "  key-&gt;value: " + keyVal.toString();
    s += "\n";
    s += "  value-&gt;key: " + valKey.toString();
    return s;
  }

  public static void main(String[] args)
  {

    BiMap&lt;String, Integer&gt; biMap = new BiMap();
    biMap.put("A", 1);
    biMap.put("B", 2);
    System.out.println(biMap); // {A=1, B=2}

    biMap.put("C", 2);
    System.out.println(biMap); // {A=1, C=2}

    biMap.removeByVal(1);
    System.out.println(biMap); // {C=2}
  }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-758794097285273928?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/758794097285273928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2010/02/java-bimap-bidimap.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/758794097285273928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/758794097285273928'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2010/02/java-bimap-bidimap.html' title='Java BiMap, BidiMap'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-8299230499633457291</id><published>2009-12-23T06:01:00.000-08:00</published><updated>2009-12-23T06:47:42.096-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='surf stick'/><category scheme='http://www.blogger.com/atom/ns#' term='redundant home internet'/><category scheme='http://www.blogger.com/atom/ns#' term='ICS'/><title type='text'>Redundant home internet with a Surf Sticks and Internet Connection Sharing</title><content type='html'>If you have a not-so-reliable ISP and an UMTS surf stick you can configure your home internet to be more redundant by setting up the surf stick as secondary gateway and DNS server for all your machines on a local network.&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Takes a while to set up, but its worth it :-)&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Assumption: you already have a primary internet gateway (e.g. DSL/Cable) on 192.168.0.1.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;Internet host setup&lt;/b&gt; (sometimes connected directly through a surf stick):&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Setup your dial-up connection to use 'Internet Connection Sharing' (ICS) as described, for example here: &lt;a href="http://support.microsoft.com/kb/306126"&gt;http://support.microsoft.com/kb/306126&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Make sure that for Internet Connection Sharing 'Settings' you have enabled DNS to be provided by this new Internet host. Possibly DHCP, but not for now.&lt;/li&gt;&lt;li&gt;Also make sure that the LAN network interface (on a laptop, that's usually 'Local Area Connection') now uses a static IP. Set it the way you would like your new internet gateway to appear on your home network. For example in my case, I already have a default gateway on192.168.0.1, so the new Internet-Host, should still use this primary gateway while it is not connected through the surf stick. The new internet host's ip is 192.168.0.100&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Ethernet adapter Local Area Connection:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;        Connection-specific DNS Suffix  . :&lt;/div&gt;&lt;div&gt;        Description . . . . . . . . . . . : Intel(R) 82567LM Gigabit Network Connection&lt;/div&gt;&lt;div&gt;        Dhcp Enabled. . . . . . . . . . . : No&lt;/div&gt;&lt;div&gt;        IP Address. . . . . . . . . . . . : 192.168.0.100&lt;/div&gt;&lt;div&gt;        Subnet Mask . . . . . . . . . . . : 255.255.255.0&lt;/div&gt;&lt;div&gt;        Default Gateway . . . . . . . . . : 192.168.0.1&lt;/div&gt;&lt;div&gt;        DNS Servers . . . . . . . . . . . : 192.168.0.1&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;So the Internet Host (my laptop with a surf stick) will use IP and DNS from 192.168.0.1 if it currently isn't connected directly.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;Client Machine Setup:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The client machines on the network 192.168.0.x must be configured to use both, the primary gateway at 192.168.0.1 and, if not available, the secondary gateway at 192.168.0.100.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;On each client machine, go to 'Local Area Connection' -&gt; Properties -&gt; TCP/IP -&gt;Properties and specify an "Alternate DNS Server" of 192.168.0.100 and click 'Advanced' to add a new Default Gateway. Click 'Add' and set the 'TCP/IP Gateway Address' to 192.168.0.100.&lt;/div&gt;&lt;div&gt;Now each client uses 192.168.0.1, while your DSL/Cable internet is available, and 192.168.0.100 otherwise.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;The whole configuration with DHCP is similar, you just need to prepolute the DHCP answers with about the same settings (Default gateways and DNS: 192.168.0.1 and 192.168.0.100) .&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-8299230499633457291?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/8299230499633457291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/12/redundant-home-internet-with-surf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8299230499633457291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8299230499633457291'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/12/redundant-home-internet-with-surf.html' title='Redundant home internet with a Surf Sticks and Internet Connection Sharing'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-8495471121140648084</id><published>2009-10-30T04:59:00.000-07:00</published><updated>2009-10-30T05:06:37.080-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Unix Admin'/><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>MAC/IP lookup</title><content type='html'>&lt;div&gt;I was trying to figure out more about a MAC address and found an interesting lookup mechanism:&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.8086.net/tools/mac/"&gt;http://www.8086.net/tools/mac/&lt;/a&gt; &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;To be concise, all lookups on one page:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;What's my browser: &lt;a href="http://www.cyscape.com/showbrow.aspx?bhcp=1"&gt;http://www.cyscape.com/showbrow.aspx?bhcp=1&lt;/a&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;What's my IP: &lt;a href="http://ipid.shat.net/"&gt;http://ipid.shat.net/&lt;/a&gt; or &lt;a href="http://ip-lookup.net/"&gt;http://ip-lookup.net/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;What's my MAC: &lt;a href="http://www.8086.net/tools/mac/"&gt;http://www.8086.net/tools/mac/&lt;/a&gt; &lt;/div&gt;&lt;div&gt;or &lt;a href="http://www.cavebear.com/archive/cavebear/Ethernet/vendor.html"&gt;http://www.cavebear.com/archive/cavebear/Ethernet/vendor.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-8495471121140648084?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/8495471121140648084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/macip-lookup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8495471121140648084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8495471121140648084'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/macip-lookup.html' title='MAC/IP lookup'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-7128885788672634726</id><published>2009-10-29T23:22:00.000-07:00</published><updated>2009-10-30T04:55:13.831-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Unix Admin'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Automatic Restart Script for a Java service</title><content type='html'>This blog tries to describe a pattern on how to write a pragmatic Unix start and stop script for an automatically restarting Java service.&lt;div&gt;
&lt;/div&gt;&lt;div&gt;In many cases, you might want to write a Java service that should be up and running 24x7. Now in theory the garbage collector should deal with everything, and if programmed correctly, the process should never crash. But in praxis, things do happen. For example a web service could encounter user requests where memory use is much bigger than you ever expected. &lt;/div&gt;&lt;div&gt;What is a good maximum heap size anyway ?&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;A pragmatic approach is just to face the fact that your JRE could run out of memory and deal with it. There are sophisticated monitoring solutions out there to automatically restart processes (e.g. nagios/ganglia), but a poor-man's solution is to &lt;b&gt;automatically restart the JRE from the Unix start script&lt;/b&gt;. &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Please note, you &lt;b&gt;don't want to restart in every case&lt;/b&gt;. A bad command line option should just stop the process and not run into the restar loop. Also, &lt;b&gt;there must be a clean way to manually stop it&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Under these constraints, the best solution I could find is to create a temporary file from the Java code at exactly the point 'of no return'. If the JRE stops before this point, no restart happens. If the JRE stops after this point, automatic restart will kick in.&lt;/div&gt;
&lt;span style="font-size:-1;"&gt;&lt;code&gt;&lt;pre&gt;... parse command line options ...
 &lt;/pre&gt;&lt;pre&gt;     // register shutdown hook      Runtime.getRuntime().addShutdownHook(new ShutdownHook(...));&lt;/pre&gt;&lt;pre&gt;     // register uncaught exception handler
    Thread.currentThread().setDefaultUncaughtExceptionHandler( new UncaughtExceptionHandler() {
      public void uncaughtException(Thread t, Throwable e)
      {
        e.printStackTrace();
        if( e.getClass()==java.lang.OutOfMemoryError.class ) {
      
          System.err.println("FATAL: shutting down because of java.lang.OutOfMemoryError ...");
          System.exit(7);
        }
      }} );

    File restart = new File("webservice.restart"); // tell the shell to restart me
    restart.createNewFile();

... start your service ...
&lt;/pre&gt;&lt;/code&gt;&lt;/span&gt;
&lt;div&gt;The Unix start script below will restart the JRE if, and only if, the temporary file (webservice.restart) exists. This could go like this:&lt;/div&gt;&lt;div&gt;
&lt;span style="font-size:-1;"&gt;&lt;code&gt;&lt;pre&gt;#!/bin/sh

#try to start service once
${JAVA_HOME}/bin/java -DREPLAYWEB ${JOPT} com.codestreet.replay.jms.shell.web.ReplayWeb $*

# restart again (until webservice.restart file was removed)
while [ -f webservice.restart ]; do
echo "### RESTART ###"
/bin/rm -f webservice.restart # let Java decide if we really want to restart
${JAVA_HOME}/bin/java -DREPLAYWEB ${JOPT} com.codestreet.replay.jms.shell.web.ReplayWeb $*
done

&lt;/pre&gt;&lt;/code&gt;&lt;/span&gt;So Java decides &lt;i&gt;if &lt;/i&gt;the service should be restarted and the shell actually &lt;i&gt;performs the restart&lt;/i&gt;. &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;An alternative would have been to &lt;b&gt;simply use return codes from System.exit() ?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;But then the question would be: &lt;i&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;what's the return code with a not yet known exception ? &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;If someone else uses kill-9 on the jre, a shutdown hook wouldn't be invoked. &lt;i&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;And to manually stop the restarting&lt;/span&gt;&lt;/i&gt; you would have to kill the start script as well as the JRE.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;With this file-based approach, the stop script is pretty simple: remove the temporary file and kill the JRE. Please note that finding the proper Java process is not as simple as it seems since the classpath is usually very long and 'ps -f' potentially won't show the classname anymore because the line gets too long. On Linux you can use the --col option to see a longer output, but that doesn't work on Solaris :-(&lt;/div&gt;&lt;div&gt;So a little trick around this is to use a &lt;b&gt;dummy JRE property,&lt;/b&gt; -DREPLAYWEB in this case. This mock up property has no meaning except that it will show up in ps before the classpath and you can make it unique enough to identify only this instance of JRE.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;The stop script would then perform these steps:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;get the 'ps line' that contains the dummy JRE property (REPLAYWEB)&lt;/li&gt;&lt;li&gt;get the task id of that process (awk is good enough)&lt;/li&gt;&lt;li&gt;remove the temporary restart file so the start script won't restart automatically&lt;/li&gt;&lt;li&gt;kill the process&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: monospace; font-size: small; white-space: pre; "&gt;#!/bin/sh -f&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:-1;"&gt;&lt;pre&gt;&lt;code&gt;
psline=`/bin/ps -aef | /bin/grep "REPLAYWEB" | /bin/grep -v grep`
echo $psline
pid=`echo $psline | /bin/awk '{ print $2}'`
if [ $pid ]
then
 /bin/rm -f webservice.restart
 echo "stop_webservice: killing Web Service with pid=$pid"
 kill $pid
else
 echo "stop_webservice: Web Service was not running"
fi

&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-7128885788672634726?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/7128885788672634726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/automatic-restart-script-for-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7128885788672634726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7128885788672634726'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/automatic-restart-script-for-java.html' title='Automatic Restart Script for a Java service'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-1305147804671168090</id><published>2009-10-15T02:55:00.000-07:00</published><updated>2009-10-15T03:11:46.298-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JAX-WS'/><category scheme='http://www.blogger.com/atom/ns#' term='Jetty'/><title type='text'>JAX-WS inside Jetty</title><content type='html'>&lt;a href="http://www.mortbay.org/jetty/"&gt;Jetty&lt;/a&gt; is a nice and easy to use Web Server (see previous post), but it can it handle an open standards, heavy weight JAX-WS Web Service ?&lt;div&gt;With a bit of luck and glue code, it can. &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;So first we need a Service Provider Implementation (SPI) from Jetty: &lt;a href="http://docs.codehaus.org/display/JETTY/J2se6HttpServerSPI"&gt;J2se6HttpServerSPI&lt;/a&gt;&lt;/div&gt;&lt;div&gt;This will make the JAX-WS endpoint use the Jetty server instead its default Sun HttpServer.&lt;/div&gt;&lt;div&gt;To plugin different SPI's you would define this new service in a META-INF/services file, but you can also set a system property, as described &lt;a href="http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/spi/HttpServerProvider.html#provider()"&gt;here&lt;/a&gt;. You can even do this in code which reduces the number of files you need to worry about when refactoring.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;So here's an example of a Jetty Server handling a JAX-WS endpoint in combination with a File system directory. &lt;/div&gt;&lt;code&gt;&lt;pre&gt;&lt;span style="font-size:-1;"&gt;      Server jettyServer = new Server(port);
     HandlerCollection handlerCollection = new HandlerCollection();
     jettyServer.setHandler(handlerCollection);
    
     /** 1) Publish WebService (JettyHttpServerProvider) */ 
     String context = "/web/ws";
             
     // 1.1) register THIS Jetty server with the JettyHttpServerProvider
     new JettyHttpServerProvider().setServer(jettyServer);
      
     // 1.2) make sure JAX-WS endpoint.publish will use our new service provider: JettyHttpServerProvider
     System.setProperty("com.sun.net.httpserver.HttpServerProvider",
           "org.mortbay.jetty.j2se6.JettyHttpServerProvider");
      
     // 1.3) add an empty HandlerCollection to by setup by this provider
     handlerCollection.addHandler( new HandlerCollection() );
      
     // 1.4) use JAX-WS API to publish the endpoint (will use a JettyHttpServerProvider)
     Endpoint endpoint = Endpoint.create(replayServiceImpl);
     endpoint.publish("http://localhost:" + port + "/web/ws", replayServiceImpl);
    
     /** 2) Publish WebGUI (Jetty) */       
     String context = "/gui";

     // 2.1) configure File Resource Handler
     ResourceHandler fileResourceHandler=new ResourceHandler();
     fileResourceHandler.setWelcomeFiles(new String[]{"index.html"});
     fileResourceHandler.setResourceBase(guiPath); // start here
       
     // 2.2) configure 'gui' Context
     ContextHandler guiHandler = new ContextHandler();
     guiHandler.setContextPath(context);
     guiHandler.setResourceBase(".");
     guiHandler.setClassLoader(Thread.currentThread().getContextClassLoader());
     guiHandler.setHandler(fileResourceHandler);
      
     // 2.3) add this context handler
     handlerCollection.addHandler(guiHandler);
 
     /** 3) start JETTY server */
     jettyServer.start();
     jettyServer.join();&lt;/span&gt;&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-1305147804671168090?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/1305147804671168090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/jax-ws-inside-jetty.html#comment-form' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/1305147804671168090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/1305147804671168090'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/jax-ws-inside-jetty.html' title='JAX-WS inside Jetty'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-6457763583498784229</id><published>2009-10-15T02:12:00.000-07:00</published><updated>2009-10-15T02:54:56.243-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Jetty'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP daemon'/><category scheme='http://www.blogger.com/atom/ns#' term='NanoHttpd'/><title type='text'>Embedding an HTTP daemon in Java</title><content type='html'>&lt;div&gt;Apache Tomcat, the well-known WebServer is about 84MB after installation. Other contenders are even bigger. Does it have to be so complicated ? The following blog is about the search for a 'right size' HTTP daemon embedable in Java.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;Now, what's a Web Server anyway ?

&lt;div&gt;To my mind, its just a piece of software that opens a socket (port 8080) where you send requests to (as defined by the HTTP protocol) and it returns data, in most cases something from the file system (HTML pages and such).

This doesn't sound too complicated. In fact, there are examples on the net of HTTP daemons that only take 10 lines of source code (compare the &lt;a href="http://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest"&gt;C++ obfuscation contest&lt;/a&gt;).&lt;/div&gt;&lt;div&gt;But besides this little niche, there is also &lt;a href="http://elonen.iki.fi/code/nanohttpd/"&gt;NanoHTTPD&lt;/a&gt; which already handles some of the ugliness of HTTP. So in order to serve up a system directory, which could contain fairly complicated AJAX/Javascript/JSP files, you don't need more than this single file of Java source code.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;If serving a file directory is all you need, go back to the previous chapter.&lt;/div&gt;&lt;div&gt;Unfortunately, things are not that easy ... sometimes you &lt;i&gt;also &lt;/i&gt;need to publish a WebService or a Servlet or an already packaged Web application (a war file). Then you need something slightly bigger. The best thing I could find in this category is &lt;a href="http://www.mortbay.org/jetty/"&gt;Jetty&lt;/a&gt;. It gives up a nice stand-alone WebServer with all kinds of configuration choices and extension points, but most importantly, it is very easy to &lt;a href="http://docs.codehaus.org/display/JETTY/Embedding+Jetty"&gt;embed&lt;/a&gt;. By using three jar files (less then 1 MB in total) and writing very little &lt;a href="http://jetty.mortbay.org/xref/org/mortbay/jetty/example/FileServer.html"&gt;code&lt;/a&gt; you again have a complete HTTP daemon. Oh, and also, Jetty is already used inside Eclipse and GWT.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-6457763583498784229?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/6457763583498784229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/embedding-http-daemon-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6457763583498784229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6457763583498784229'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/embedding-http-daemon-in-java.html' title='Embedding an HTTP daemon in Java'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-6251825504564939187</id><published>2009-10-15T02:05:00.000-07:00</published><updated>2009-10-15T02:15:09.388-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JAX-WS'/><category scheme='http://www.blogger.com/atom/ns#' term='WebService'/><title type='text'>Publishing a JAX-WS Endpoint not just to localhost</title><content type='html'>&lt;div&gt;Interestingly enough, publishing the JAX-WS Endpoint with endpoint.publish(url) as described in a previous post, publishes the WSDL to http://localhost:8080 but this socket is not accessible from any other host ! Strange default, but there you go ...&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;So in order to really make a JAX-WS Endpoint public to the world, you can revert to the slightly more cumbersome API of com.sun.net.httpserver.HttpServer (at least on Sun's JDK):&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;
&lt;code&gt;&lt;pre&gt;&lt;span style="font-size:-1;"&gt;
HttpServer server = HttpServer.create(new InetSocketAddress(port), 3 ); // backlog
server.start();
  
endpoint.setExecutor( Executors.newFixedThreadPool(10) );
  
// publish WebService
HttpContext wsContext = server.createContext( "/" + service );
  
//wsContext.setAuthenticator(new TestBasicAuthenticator("test"));
endpoint.publish( wsContext );&lt;/span&gt;&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-6251825504564939187?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/6251825504564939187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/publishing-jax-ws-endpoint-not-just-to.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6251825504564939187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6251825504564939187'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/publishing-jax-ws-endpoint-not-just-to.html' title='Publishing a JAX-WS Endpoint not just to localhost'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-5016550828334976273</id><published>2009-10-04T04:11:00.000-07:00</published><updated>2009-10-04T04:16:33.063-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>Quarkbase</title><content type='html'>Ever wondered who are the key people behind a website  ?&lt;div&gt;
&lt;div&gt;Check out &lt;a href="http://www.quarkbase.com/"&gt;http://www.quarkbase.com/&lt;/a&gt; and enter the  URL to check.&lt;/div&gt;&lt;div&gt;Not always perfect, though ... ;-)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-5016550828334976273?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/5016550828334976273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/quarkbase.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/5016550828334976273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/5016550828334976273'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/10/quarkbase.html' title='Quarkbase'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-4862270571360192937</id><published>2009-09-07T01:44:00.000-07:00</published><updated>2009-10-15T02:11:25.547-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JAX-WS'/><category scheme='http://www.blogger.com/atom/ns#' term='WebService'/><title type='text'>60 seconds on SOAP-based Web Services</title><content type='html'>According to this &lt;a href="http://oreilly.com/catalog/9780596002695/"&gt;book&lt;/a&gt;, there are 74 distinct initiatives trying to define what a Web Service should look like. And I bet, there are at least 74 different abbreviations around to describe different parts of it.  So it's surprising how simple it is to create a Web Service with JDK 1.6. First you define an interface with a bunch of annotations:
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;pre&gt;&lt;code&gt;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
// use RPC or 'wrapped' document-style
@SOAPBinding(style = Style.RPC)
//@SOAPBinding(style = Style.DOCUMENT,
// parameterStyle = SOAPBinding.ParameterStyle.WRAPPED )
public interface Example
{
 @WebMethod public String getGreeting( @WebParam(name="myname") String myname);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;
And then implement the service itself. Use a thread-pool if your application is multi-threaded. &lt;div&gt;&lt;div&gt;
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;pre&gt;&lt;code&gt;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService(endpointInterface = "simple.Example")
public class ExampleImpl implements Example
{
 @Override
 public String getGreeting(String myname)
 {
   return "hello, " + myname;
 }

 public static void main(String[] args)
 {
   String url = "http://127.0.0.1:9876/example";
   System.out.println("Starting WebService at: " + url);
   System.out.println("WSDL available at:      " + url + "?wsdl");

   Endpoint endpoint = Endpoint.create(new ExampleImpl());
   //endpoint.setExecutor( Executors.newFixedThreadPool(10) );
   endpoint.publish(url);
 }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;
&lt;span class="Apple-style-span"   style="  white-space: normal; font-family:Georgia, serif;font-size:16px;"&gt;The resulting WSDL definition of this service can be looked at http://127.0.0.1:9876/example?wsdl (use Firefox or IE, not Chrome!). Any SOAP-based client (such as the XML Test Utility in General Interface, see previous post) can now invoke this service. &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"   style="  white-space: normal; font-family:Georgia, serif;font-size:16px;"&gt;&lt;div&gt;REST-style would be harder to implement, but easier to test. In the REST case, you can simply do: http://127.0.0.1:9876/rs?name="Pete" for invocations. The difference to the previous solution is that with REST-style, the client uses an HTTP GET to invoke a method and the return value can be any kind of XML, not just a SOAP envelope. &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;The code above implements the main 'standard', but its also the most bloated possibilty. More efficient, but less standardized, is a message encoding of JSON instead of XML, or better, use the &lt;a href="http://code.google.com/webtoolkit/"&gt;Google Web Toolkit&lt;/a&gt;. If you are in full control of the server and the client and don't need to follow standards, GWT seems an excellent choice right now.&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-4862270571360192937?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/4862270571360192937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/09/60-seconds-on-soap-based-web-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/4862270571360192937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/4862270571360192937'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/09/60-seconds-on-soap-based-web-services.html' title='60 seconds on SOAP-based Web Services'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-8710842284685816055</id><published>2009-09-04T01:43:00.000-07:00</published><updated>2009-09-09T05:31:04.772-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='General Interface'/><title type='text'>General Interface Primer</title><content type='html'>There's now an open-source Ajax GUI builder called &lt;a href="http://www.generalinterface.org/"&gt;General Interface&lt;/a&gt; which looks quite promising. A bunch of components that are somewhat familiar to Swing developers. Of course, all logic is Javascript :-(&lt;div&gt;
&lt;/div&gt;&lt;div&gt;After installation, here some tips that could come in handy:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Look at the &lt;a href="http://www.generalinterface.org/docs/display/DOC/Tutorials"&gt;video tutorials&lt;/a&gt;, the best one for tables(matrix) isn't actually on that page, but &lt;a href="http://media.tibco.com/gi/gi32_webcast/index.html"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Defining Javascript functions doesn't always work, even after Save/Reload. Try to restart and reload the page before giving up.&lt;/li&gt;&lt;li&gt;You might sneeze at the package names, but trust me, in Javascript conflicts are easy to create. Here's a simple example on a function called&lt;b&gt; jmsw.doAction(index)&lt;/b&gt; :
&lt;code&gt;&lt;/code&gt;&lt;pre&gt;&lt;code&gt;
// name of the package to create: jmsw
jsx3.lang.Package.definePackage(  "jmsw", function(jmsw) {
 jmsw.doAction = function(index) // define doAction(index)
 {
   ...
 };
});
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;Do &lt;b&gt;Control+Click&lt;/b&gt; on a component (such as a button) to locate its definition in the 'Component Hierachy'.&lt;/li&gt;&lt;li&gt;Float a Palette to get more space or to move it to the bottom panel: Upper Right Corner of a Palette View, click on 'Floating'. Use Menu-&gt;Palettes to enable/disable a palette.&lt;/li&gt;&lt;li&gt;The 'XML Mapping Tool' always starts with the same default of ..Address.wsdl, but this will not be the one you will be working with. To change the default of this initial URI, edit &lt;span class="Apple-style-span" style="font-size: small;"&gt;C:\TIBCO\gi-3.8-max\GI_Builder\plugins\jsx3.ide.mapping\components\Inputs\wsdl.xml&lt;/span&gt; and search for 'Address, comment it out and add your own WebService URI:
&lt;pre&gt;&lt;code&gt;
       &amp;lt;!-- use different default for XML Mapping Tool:
       &amp;lt;strings jsxname=&amp;quot;jsx_schema_wsdlurl&amp;quot; jsxvalue=&amp;quot;jsxplugin://jsx3.ide.mapping/samples/Address.wsdl&amp;quot; jsxwidth=&amp;quot;100%&amp;quot;/&amp;gt;
       --&amp;gt;

       &amp;lt;strings jsxname=&amp;quot;jsx_schema_wsdlurl&amp;quot; jsxvalue=&amp;quot;http://127.0.0.1:9876/rs?wsdl&amp;quot; jsxwidth=&amp;quot;100%&amp;quot;/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-8710842284685816055?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/8710842284685816055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/09/general-interface-primer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8710842284685816055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8710842284685816055'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/09/general-interface-primer.html' title='General Interface Primer'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-4916677112997458496</id><published>2009-08-31T03:51:00.001-07:00</published><updated>2009-08-31T04:29:08.746-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Bi-directional Maps'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java Bi-directional Maps: Apache commons or Google collections ?</title><content type='html'>&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;In case you need a bi-directional Map in Java, you can, of course, easily roll your own.&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;But this is a common problem, so others have done this work already. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Here's a simple how-to on bi-directional maps with Apache and Google commons.&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://commons.apache.org/collections/"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Apache commons&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; collections offers a &lt;/span&gt;&lt;/span&gt;&lt;a href="http://commons.apache.org/collections/apidocs/org/apache/commons/collections/BidiMap.html"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;BidiMap &lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;interface with various implementations. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;For example:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;pre&gt;public class TestBidiMap
{
static BidiMap bimap = new DualHashBidiMap();
public static void main(String[] args)
{
bimap.put("D", 3);
System.out.println("D -&amp;gt; " + bimap.get("D") );
System.out.println("3 -&amp;gt; " + bimap.inverseBidiMap().get(3) );
}
}
&lt;/pre&gt;&lt;/code&gt;
&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Nice and easy, but unfortunately this version of BidiMap doesn't use Java generics, which I have learned to like over time (bimpap.get(3) will not show a compile error) !&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style=" white-space: normal;"&gt;&lt;a href="http://code.google.com/p/google-collections/"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Google collections&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; has an alternative that uses generics: &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://google-collections.googlecode.com/svn/trunk/javadoc/index.html?com/google/common/collect/BiMap.html"&gt;BiMap&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;public class TestBiMap
{
static BiMap&amp;lt;String,Integer&amp;gt; bimap = HashBiMap.create();
public static void main(String[] args)
{
 bimap.put("D", 3);
 System.out.println("D -&amp;gt; " + bimap.get("D") );
 System.out.println("3 -&amp;gt; " + bimap.inverse().get(3) );
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="Apple-style-span"  style="  white-space: normal; font-family:georgia, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Also nice and easy, what's interesting is the factory method HashBiMap.create(). This removes the need to duplicate the generics type specification of String, Integer. &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;a href="http://en.wikipedia.org/wiki/KISS_principle"&gt;Kiss&lt;/a&gt; rules&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;, so two points for Google collections here.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="Apple-style-span"  style="font-family:georgia, serif;"&gt;&lt;span class="Apple-style-span" style=" white-space: normal;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Summary: any mid-size Java project probably shouldn't live without Apache commons, but as a useful addition, Google collections is definitely worth a look.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="Apple-style-span"   style="font-family:georgia, serif;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal;font-size:16px;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-4916677112997458496?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/4916677112997458496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/java-bi-directional-maps-apache-commons.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/4916677112997458496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/4916677112997458496'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/java-bi-directional-maps-apache-commons.html' title='Java Bi-directional Maps: Apache commons or Google collections ?'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-6640976233013262777</id><published>2009-08-17T03:02:00.000-07:00</published><updated>2009-08-17T03:05:35.725-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EC2-S3'/><title type='text'>Amazon S3 intro</title><content type='html'>Started to look into Amazon EC2/S3 recently (technology you should know about).&lt;div&gt;Here's a short S3 intro, one with lots of screenshots and therefore easy to digest:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.hongkiat.com/blog/amazon-s3-the-beginners-guide/"&gt;http://www.hongkiat.com/blog/amazon-s3-the-beginners-guide/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-6640976233013262777?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/6640976233013262777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/amazon-s3-intro.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6640976233013262777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/6640976233013262777'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/amazon-s3-intro.html' title='Amazon S3 intro'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-1135111224606780292</id><published>2009-08-10T06:36:00.000-07:00</published><updated>2009-08-10T07:03:07.188-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pipes and Filters'/><category scheme='http://www.blogger.com/atom/ns#' term='Spring'/><title type='text'>Spring and Pipes&amp;Filters</title><content type='html'>&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 20px; font-size:11px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; white-space: pre-wrap; font-family:monospace;font-size:13px;"&gt;&lt;code&gt;&lt;/code&gt;&lt;pre&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span"   style="font-family:Georgia, serif;color:#333333;"&gt;&lt;span class="Apple-style-span" style="line-height: 20px; white-space: normal;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Finally an IoC container that almost everyone agrees on: &lt;/span&gt;&lt;a href="http://www.springframework.org/" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Spring&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;.
After many inhouse, half-baked attempts and 'framework wars' a default solution. TIBCO folks might remember the days of TAF (1996), GAF, XXTAF or PushBeans. Also
&lt;/span&gt;&lt;a href="https://www.openadaptor.org/" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;openadaptor.org&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; should be noted here.

Now Spring certainly is nice and generic, but for building EAI adapters or 'message processing pipelines' it is not ideal. In case of these pipelines, the message path is very structured: from a source bean through several transformation beans until it finally reaches one (or many) sinks. XML already imposes an 'order of things' so an ideal configuration language of a little adapter might look something like this:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;code&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;&amp;lt;pipelines&amp;gt;
&amp;lt;pipe name="Jdbc2JMSPipe"&amp;gt;
  &amp;lt;jdbc dbref="db1" querysql="select * from table1"&amp;gt;
  &amp;lt;concatenate method1="getFirstName" method2="getLastName" result="setName"&amp;gt;
  &amp;lt;jmsObject2MapMessage&amp;gt;
  &amp;lt;jmsPublish topic="PERSON"&amp;gt;
&amp;lt;/pipe&amp;gt;
&amp;lt;/pipelines&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;This example configures a processing pipeline to get rows from a JDBC connection, invoke the concatenation filter, convert an object to a JMS MapMessage and finally publish the result to a JMS topic named 'T.PERSON'.&lt;/span&gt;
&lt;/span&gt;&lt;pre&gt;&lt;span class="Apple-style-span"   style="font-family:Georgia, serif;color:#333333;"&gt;&lt;span class="Apple-style-span" style=" line-height: 20px; white-space: normal;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
The configuration above is easy to understand and manipulate. One can imagine extensions with for-loops, if-clauses etc.  For example:&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; white-space: pre-wrap; font-family:monospace, serif;font-size:x-small;"&gt;&amp;lt;pipelines&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;code&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;  &amp;lt;pipe name="Jdbc2JMSPipe"&amp;gt;
  &amp;lt;jdbc dbref="db1" querysql="select * from table1"&amp;gt;
  &amp;lt;concatenate method1="getFirstName" method2="getLastName" result="setName"&amp;gt;
  &amp;lt;jmsObject2MapMessage&amp;gt;
  &amp;lt;if method="getName" startswith="a-z"&amp;gt;
    &amp;lt;jmsPublish topic="PERSON.LOWERCASE"&amp;gt;
  &amp;lt;else&amp;gt;
    &amp;lt;jmsPublish topic="PERSON.UPPERCASE"&amp;gt;
  &amp;lt;/else&amp;gt;
  &amp;lt;/if&amp;gt;
&amp;lt;/pipe&amp;gt;
&amp;lt;/pipelines&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;Configuring the first example pipeline with Spring could look like this:&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;
&amp;lt;beans&amp;gt;
&amp;lt;bean id="1" class="com.abc.jdbc" dbRef="db1" querySql="select * from table1"&amp;gt;
  &amp;lt;property name="next"&amp;gt; &amp;lt;ref bean="2"&amp;gt; &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
&amp;lt;bean id="2" class="com.abc.concatenate" method1="getFirstName" method2="getLastName" result="setName"&amp;gt;
  &amp;lt;property name="next"&amp;gt; &amp;lt;ref bean="3"&amp;gt; &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
&amp;lt;bean id="3" class="com.abc.jmsObject2MapMessage&amp;gt;
  &amp;lt;property name="next"&amp;gt; &amp;lt;ref bean="4"&amp;gt; &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
  &amp;lt;bean id="4" class="com.abc.jmsPublish" topic="T.PERSON"/&amp;gt;
&amp;lt;/beans&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;
&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;The order of beans is defined explicitly although XML already provides an order.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:monospace, serif;"&gt;&lt;span class="Apple-style-span"  style=" white-space: pre-wrap;font-size:small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 20px; font-size:11px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; white-space: pre-wrap; font-family:monospace;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;A nasty user of this system could even reorder the beans in a different order :-(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 20px; font-size:11px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; white-space: pre-wrap; font-family:monospace;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;So maybe some XSLT to transform from a 'pipes&amp;amp;filters' language to a Spring configuration ?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 20px; font-size:11px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; white-space: pre-wrap; font-family:monospace;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;Or extend Spring with this kind of processing step ?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 20px; font-size:11px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; white-space: pre-wrap; font-family:monospace;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;Or how about a XML-aware bean reference:&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;&amp;lt;beans&amp;gt;
&amp;lt;bean id="1" class="com.abc.jdbc" dbRef="db1" querySql="select * from table1"&amp;gt;
  &amp;lt;property name="next"&amp;gt; &amp;lt;ref bean="following-sibling"&amp;gt; &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
&amp;lt;bean id="2" class="com.abc.concatenate" method1="getFirstName" method2="getLastName" result="setName"&amp;gt;
  &amp;lt;property name="next"&amp;gt; &amp;lt;ref bean="following-sibling"&amp;gt; &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
&amp;lt;bean id="3" class="com.abc.jmsObject2MapMessage&amp;gt;
  &amp;lt;property name="next"&amp;gt; &amp;lt;ref bean="following-sibling"&amp;gt; &amp;lt;/property&amp;gt;
&amp;lt;/bean&amp;gt;
  &amp;lt;bean id="4" class="com.abc.jmsPublish" topic="T.PERSON"/&amp;gt;
&amp;lt;/beans&amp;gt;
&lt;/span&gt;&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 20px; font-size:11px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; white-space: pre-wrap; font-family:monospace;font-size:13px;"&gt;&lt;code&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal; color: rgb(51, 51, 51); line-height: 20px; font-family:Georgia, serif;"&gt;Currently, I think XSLT would be the best solution since it keeps the clarity of the pipes&amp;amp;filters language.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-1135111224606780292?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/1135111224606780292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/finally-ioc-container-that-almost.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/1135111224606780292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/1135111224606780292'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/finally-ioc-container-that-almost.html' title='Spring and Pipes&amp;amp;Filters'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-3808774151766953752</id><published>2009-08-10T05:30:00.001-07:00</published><updated>2009-08-10T07:10:24.597-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Agile'/><category scheme='http://www.blogger.com/atom/ns#' term='EAI'/><title type='text'>Good books on EAI and Agile Programming</title><content type='html'>&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); font-size:small;"&gt;&lt;h3 class="post-title"  style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 4px; padding-left: 0px;  font-weight: normal; line-height: 1.4em; color: rgb(204, 102, 0); font-size:18px;"&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  line-height: 20px; font-size:small;"&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=" ;font-size:11px;"&gt;Head First "Design Patterns" - 26 pages on the Decorator ? Finally the space it deserves ! If you found the "Consequences, Forces, Solutions, Implementation, Related Patterns"structure of other Patterns book too rigid. This one is for you. Finally an entertaining read on Patterns. "Patterns in Java" and even the GoFs books loose their glory after reading this one.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=" ;font-size:11px;"&gt;"Client/Server Survival Guide" - Very old, but I liked the writing. (use Steven's "Unix Network Programming" as a reference)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=" ;font-size:11px;"&gt;"Extreme Programming Explained" - there you go, little Agile programmer. Also some good tips on how to convince upper management of the benefits.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=" ;font-size:11px;"&gt;"Java Extreme Programming Cookbook" - nice intro to a all the good technologies (as of 2005).&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=" ;font-size:11px;"&gt;"Java Message Service" (Monson-Haefel&amp;amp;Chappel) - no thrills, but all you really need. Writing concise books is a great virtue.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/h3&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-3808774151766953752?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/3808774151766953752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/good-books-on-eai-and-agile-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3808774151766953752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3808774151766953752'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/good-books-on-eai-and-agile-programming.html' title='Good books on EAI and Agile Programming'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-2990409196577508366</id><published>2009-08-10T05:08:00.000-07:00</published><updated>2009-09-04T01:58:15.348-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSON'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='XML XPath'/><title type='text'>Ajax: Xpath-enabled Json queries</title><content type='html'>&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 20px; font-size:small;"&gt;In the Ajax world, there is a big discussion about XML versus &lt;a href="http://www.json.org/" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;Json&lt;/a&gt;as a means of transporting data from the Server to the Browser. After looking at the first examples of using a DOM API in Javascript, I knew, I'll &lt;span style="font-weight: bold; font-style: italic; "&gt;not&lt;/span&gt;&lt;span style="font-style: italic; "&gt; &lt;/span&gt;be using XML in Javascript. Using Json instead, feels very nice and natural.

But Json is just a means of transport. Nothing else. The simplistic&lt;a href="http://www.json.org/java/index.html" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;classes&lt;/a&gt; work, but no query language to select the interesting data before sending it over.

If you structure your Web-Gui well, the resulting data should be simple. Hence no need for the complex XML structure. XML offers however, two goodies, I wouldn't want to miss: Object to XML serializers (e.g. &lt;a href="http://www.w3.org/TR/xpath" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;XStream&lt;/a&gt;) and &lt;a href="http://www.w3.org/TR/xpath" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;XPath &lt;/a&gt;to select parts of the XML.

So my idea is this: why not marry both approaches ?

Transform the Java object into XML, apply an XPath query to select what you really want and then transform the result to Json to send it over. Even more flexible, support a 'class' and 'method' (and an optional 'args') parameter to select which data to get.

Here is how it works:
1) Ajax Request: On the Browser, request a Json object with parameters class,method, xpath:
&lt;pre&gt;&lt;span style=" ;font-size:12px;"&gt;requestList( &lt;/span&gt;&lt;span style="font-weight: bold;  font-size:12px;"&gt;"class=TibjmsAdmin&amp;amp;method=getTopics&amp;amp;xpath=/*/*/name"&lt;/span&gt;&lt;span style=" ;font-size:12px;"&gt;,
"name",
isAsync,
topicList );&lt;/span&gt;
&lt;/pre&gt;2) Java Method call: On the Server-side, this request will execute the method TibjmsAdmin.getTopics() and create a Java object with some code similar to this:
&lt;pre&gt;&lt;span style=" ;font-size:12px;"&gt;
if( className.equals("TibjmsAdmin") ) { // TODO: use ClassLoader (security?)
 Object invokee = jmsAdmin;
}
... others ...

// get specified method on specified class
className = invokee.getClass().getName();
Class c = Class.forName(className); // className is TibjmsAdmin
Method m = c.getMethod(method,argClasses); // method is getTopics, argClasses is null

// invoke method and get return object
&lt;/span&gt;&lt;span style="font-weight: bold;  font-size:12px;"&gt;  returnObj &lt;/span&gt;&lt;span style=" ;font-size:12px;"&gt;= m.invoke(invokee, argObs);&lt;/span&gt;
&lt;/pre&gt;3) Java to XML: the next step is now to serialize this Java object to XML. I like to use &lt;a href="http://www.w3.org/TR/xpath" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;XStream&lt;/a&gt; for this purpose because its extremly simple and straight-forward.
&lt;pre&gt;&lt;span style=" ;font-size:12px;"&gt;
XStream xstream = new XStream();
String &lt;/span&gt;&lt;span style="font-weight: bold;  font-size:12px;"&gt;xml&lt;/span&gt;&lt;span style=" ;font-size:12px;"&gt; = xstream.toXML(returnObj);&lt;/span&gt;
&lt;/pre&gt;If the returned object does not produce the required results, you can do some magic by plugging in an XStream 'Converter' (not shown here).

4) Apply Xpath: Now that that we have the XML, we can apply the specified XPath to fiddle out the data that is really interesting for us. The following code will create a list of selected XML nodes.
&lt;pre name="code"&gt;    NodeList nl = XmlUtils.selectNodeList(docBuilder,xmlString,xpath);
StringBuffer sb = new StringBuffer("&lt;list&gt;");
for( int i=0;i&amp;lt;nl.getLength();i++ ) {

  Node node = nl.item(i);
  sb.append("&lt;" + node.getNodeName() + "&gt;" );
  sb.append( node.getTextContent() );
  sb.append("" );
}
sb.append("\n&lt;/list&gt;");
&lt;/pre&gt;

5) Return Json result: finally return the Json object back to the Browser using the Json &lt;a href="http://www.json.org/java/index.html" style="color: rgb(85, 136, 170); text-decoration: none; "&gt;tools&lt;/a&gt;.
&lt;pre&gt;
JSONObject json = XML.toJSONObject(xml);
  response.setContentType("text/plain");
if( out.equals("pretty") ) // pretty JSON
  response.getWriter().print( json.toString(2) );
else // or not
  response.getWriter().print( json.toString() );
&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-2990409196577508366?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/2990409196577508366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/ajax-xpath-enabled-json-queries.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/2990409196577508366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/2990409196577508366'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/ajax-xpath-enabled-json-queries.html' title='Ajax: Xpath-enabled Json queries'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-2969816461745874398</id><published>2009-08-10T04:21:00.000-07:00</published><updated>2009-08-10T06:34:50.728-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Service'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows instsrv.exe'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows sc.exe'/><title type='text'>Windows NT Service configuration</title><content type='html'>&lt;p class="MsoNormal"&gt;To debug current Windows Service configuration, try 'sc' on a command console.&lt;/p&gt;&lt;p class="MsoNormal"&gt;For example '&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;sc query&lt;/span&gt;&lt;/b&gt;' pretty much shows the same configuration information as the registry tree which defines Windows services:&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt; There's an interesting Windows Resource Kist that includes service configuration tools.&lt;/p&gt;&lt;p class="MsoNormal"&gt;For example &lt;b&gt;instsrv.exe&lt;/b&gt; to run ANY other .exe application as Windows service&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;C:\Program Files\Windows Resource Kits\Tools&gt;instsrv.exe AAA "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt;The service was successfuly added!&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;C:\Program Files\Windows Resource Kits\Tools&gt;instsrv.exe AA REMOVE&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-2969816461745874398?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/2969816461745874398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/windows-nt-service-configuration.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/2969816461745874398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/2969816461745874398'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/windows-nt-service-configuration.html' title='Windows NT Service configuration'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-7789718769070530947</id><published>2009-08-10T04:11:00.000-07:00</published><updated>2009-08-10T06:33:34.517-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Subclipse and Tortoise SVN'/><title type='text'>Consistent Subversion icons in Windows and Eclipse</title><content type='html'>&lt;div&gt;
&lt;/div&gt;With the latest version of Tortoise SVN (1.6.x) the default icon set changed to be different from the icons in Eclipse (subclipse). &lt;div&gt;
&lt;/div&gt;&lt;div&gt;To justify that again, so SVN icons look the same in Eclipse and in Windows folders, choose a TortoiseSVN directory, right mouse-click, TortoiseSVN -&gt; Settings and choose the Subclipse icon set as shown below.&lt;div&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_eU2AbpuUfIA/SoABb0d5KOI/AAAAAAAAAAc/402iBnPfgeE/s1600-h/t.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 266px;" src="http://3.bp.blogspot.com/_eU2AbpuUfIA/SoABb0d5KOI/AAAAAAAAAAc/402iBnPfgeE/s400/t.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5368292333277751522" /&gt;&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-7789718769070530947?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/7789718769070530947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/consistent-subversion-icons-in-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7789718769070530947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7789718769070530947'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/consistent-subversion-icons-in-windows.html' title='Consistent Subversion icons in Windows and Eclipse'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_eU2AbpuUfIA/SoABb0d5KOI/AAAAAAAAAAc/402iBnPfgeE/s72-c/t.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-2608779799868508483</id><published>2009-08-10T03:52:00.000-07:00</published><updated>2009-08-10T06:28:14.162-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual C++'/><category scheme='http://www.blogger.com/atom/ns#' term='DebugBreak'/><title type='text'>Debugging Visual C++ applications</title><content type='html'>&lt;p class="MsoNormal"&gt;Sometimes, the simplest trick is the best. I'm sure you all know this, but to debug a Windows application (for exampe a Windows NT Service), call 'DebugBreak'. In many situations this can be more handy than setting a breakpoint.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt; int main(int argc, char** argv)&lt;/b&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;  DebugBreak();&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-2608779799868508483?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/2608779799868508483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/debugging-visual-c-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/2608779799868508483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/2608779799868508483'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/debugging-visual-c-applications.html' title='Debugging Visual C++ applications'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-5184173327204340195</id><published>2009-08-10T03:48:00.000-07:00</published><updated>2009-08-10T06:33:14.645-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Service'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows &quot;Local system account&quot;'/><title type='text'>How to spawn a command shell under windows 'system' user</title><content type='html'>&lt;p class="MsoNormal"&gt;This trick can be useful if you want to debug user permission is&lt;span&gt;&lt;span&gt;sues with a Windows NT service that logs on under "Local System account" (the default).&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Calibri, sans-serif; font-size: 15px; "&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;First, figure out your current system time:&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;C:\&gt;time&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;The current time is:  6:15:18.57&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;  &lt;/p&gt;&lt;p class="MsoNormal"&gt;Second, use the 'at' command to start an interactive command shell when the next minute starts:&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;C:\&gt;at 6:16 /interactive cmd&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;span&gt;&lt;span&gt;Now inside this new command shell, try your command which is run under this new user.&lt;/span&gt;&lt;/span&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span" style="font-family: Calibri, sans-serif; font-size: 15px; "&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-5184173327204340195?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/5184173327204340195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/how-to-spawn-command-shell-under.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/5184173327204340195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/5184173327204340195'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/how-to-spawn-command-shell-under.html' title='How to spawn a command shell under windows &apos;system&apos; user'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-1861704074622929093</id><published>2009-08-10T03:31:00.000-07:00</published><updated>2009-08-10T06:27:12.021-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows DLL'/><title type='text'>Windows DLL load order</title><content type='html'>&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;So when you work with Windows NT services, you might want to make sure the right DLLs are loaded a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;t the proper time. When debugging issues on NT service startup time, this becomes important. On Windows, the order of DLL loading is as follows (see also Visual C++'s help on LoadLibrary()):&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The directories listed in the App Path registry key (if any)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The directory where the executable module for the current process is located.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The current directory.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The directories listed in the PATH environment variable.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;To set an 'App Path' for your application (text.exe), set the (Default) value of&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/code&gt;&lt;span&gt;&lt;span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\test.exe&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;to the full path of your executable, for example:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;C:\Program Files\Test\test.exe&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Add a sub-key named Path, set it's value to the full path of the DLL, for example:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;C:\Program Files\Test\lib&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Use regedit see examples of other applications, and how they setup their App Path keys.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Calibri, sans-serif;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:15px;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;          &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-1861704074622929093?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/1861704074622929093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/windows-dll-load-order.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/1861704074622929093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/1861704074622929093'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/08/windows-dll-load-order.html' title='Windows DLL load order'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-3640890331112607942</id><published>2009-07-22T07:28:00.000-07:00</published><updated>2009-08-31T04:31:55.572-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='JScrollPane'/><category scheme='http://www.blogger.com/atom/ns#' term='JTextArea'/><title type='text'>How to display a non-scrolling background for a Java JScrollPane</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;To add a background text (or image) to the back of a JTextArea that is inside a JScrollPane, you can use the following code. The advantage here is that the background text/image does NOT scroll with the text in the JTextArea. See screenshot below.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_eU2AbpuUfIA/Smcjy3crRQI/AAAAAAAAAAU/Gg72uqvqaEg/s1600-h/overlay.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 130px;" src="http://4.bp.blogspot.com/_eU2AbpuUfIA/Smcjy3crRQI/AAAAAAAAAAU/Gg72uqvqaEg/s400/overlay.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5361293238192522498" /&gt;&lt;/a&gt;&lt;div&gt;&lt;div style="text-align: left;"&gt;Here's the code:&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:11px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;
&lt;span style="font-size:78%;"&gt;
&lt;pre&gt;
&lt;span class="Apple-style-span"  style="font-size:small;"&gt;public static void main(String[] args) {


JFrame frame = new JFrame("Overlay test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JScrollPane scroll = new JScrollPane();
scroll.getViewport().setBackground(Color.WHITE);

scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scroll.setPreferredSize( new Dimension(400,100));
frame.add(scroll);

final String text = "English";

final JTextArea ta = new JTextArea() {

 {setOpaque(false);}  // instance initializer

 public void paintComponent (Graphics g) {
   g.setFont(new Font("Verdana",Font.ITALIC,20));
   g.setColor(Color.LIGHT_GRAY);

   Rectangle rect = getVisibleRect();
   int x = rect.width + rect.x - 14*text.length();
   int y = rect.y + 20; // approx. height of the text
   g.drawString(text, x, y);
   super.paintComponent(g);
 }
};

ta.setText("This text area contains an overlayed text that is BEHIND this text and does not scroll");
ta.setPreferredSize( new Dimension(600,100));
scroll.setViewportView(ta);
frame.pack();
frame.setVisible(true);
}&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-3640890331112607942?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/3640890331112607942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/how-to-display-text-in-back-of-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3640890331112607942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3640890331112607942'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/how-to-display-text-in-back-of-java.html' title='How to display a non-scrolling background for a Java JScrollPane'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_eU2AbpuUfIA/Smcjy3crRQI/AAAAAAAAAAU/Gg72uqvqaEg/s72-c/overlay.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-8033255188369410192</id><published>2009-07-17T08:27:00.000-07:00</published><updated>2009-08-10T06:24:55.362-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='InstallShield'/><category scheme='http://www.blogger.com/atom/ns#' term='dotnetfx2.0.exe'/><category scheme='http://www.blogger.com/atom/ns#' term='o2007pia.msi'/><category scheme='http://www.blogger.com/atom/ns#' term='vstor2005.exe'/><title type='text'>InstallShield Setup Prerequisites for PIA 2003, PIA 2007, VSOT, .NET2.0</title><content type='html'>Now, if you are writing an "InstallShield X" package for something like an Excel Addin, you are dependent on a number of things:&lt;div&gt;&lt;ul&gt;&lt;li&gt;.NET Framework (2.0, for example, dotnetfx2.0.exe)&lt;/li&gt;&lt;li&gt;Office 2007 Primary Interop Assemblies (o2007pia.msi)&lt;/li&gt;&lt;li&gt;Visual Studio Tools for Office (vstor2005.exe)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;One way to do this is setting up a "Basic MSI Project" (NOTE: this doesn't work with a standard InstallShield project as pre-requisites are not supported there !!)&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;and add prerequisites (Tools-&gt;Prerequisite Editor) for each of these dependencies.&lt;/div&gt;&lt;div&gt;See &lt;a href="http://shieldmaster.wordpress.com/2009/04/26/tutorial-adding-setup-prerequisites-to-installshield-package/"&gt;http://shieldmaster.wordpress.com/2009/04/26/tutorial-adding-setup-prerequisites-to-installshield-package/&lt;/a&gt; for a good tutorial on this.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Now the crucial question is, which condition to set for each of these packages ?&lt;/div&gt;&lt;div&gt;Here's my best solution, so far (Conditions tab in Preqrequisites):&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;.NET Framework 2.0: "A File does or does not exist" &lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;[WindowsFolder]\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt; &lt;/span&gt;&lt;/span&gt;   --- Run setup if: Not Found&lt;/li&gt;&lt;li&gt;PIA Office 2007: "A registry key does or does not exist"  &lt;span class="Apple-style-span"  style="font-family:'Courier New';"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Uninstall\{50120000-1105-0000-0000-0000000FF1CE}&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-weight: normal; font-family:Georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;--- Run setup if: Not Found&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;PIA Office 2003: "A registry key  does or does not exist"  &lt;span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;HKEY_L&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;OCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Uninstall\{&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'Courier New';"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;91490409-6000-11D3-8CFE-0150048383C9} &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="  font-weight: normal; font-family:Georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;--- Run setup if: Not Found&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:'Courier New';"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="  font-weight: normal; font-family:Georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Visual Studio 2005 Office Tools: "A registry key does or does not exist"  &lt;span style="font-family:&amp;quot;Courier New&amp;quot;; mso-fareast-mso-fareast-theme-font:minor-latin;mso-ansi-language: EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SAfont-family:Calibri;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;HKEY_L&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;OCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Uninstall\{&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;388E4B09-3E71-4649-8921-F44A3A2954A7}&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="  font-weight: normal; font-family:Georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;--- Run setup&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="  font-weight: normal; font-family:Georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; if: Not Found&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;Took me a long time to figure these out, thanks Anthony ! Would be nice if this helps someone :-) &lt;/div&gt;&lt;div&gt;
&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-8033255188369410192?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/8033255188369410192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/installshield-setup-prerequisites-for.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8033255188369410192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/8033255188369410192'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/installshield-setup-prerequisites-for.html' title='InstallShield Setup Prerequisites for PIA 2003, PIA 2007, VSOT, .NET2.0'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-7493083597165689021</id><published>2009-07-17T07:25:00.000-07:00</published><updated>2009-07-17T08:27:40.683-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Assemblies'/><title type='text'>10 Seconds on Windows Assemblies</title><content type='html'>&lt;div&gt;So ... Windows assemblies are these little packages a .NET application can be made of.&lt;/div&gt;&lt;div&gt;Kind of a way around the 'DLL hell'. Check out C:\WINDOWS\assembly to see what I mean.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Interesting to note is that the same thing looks quite different in the command shell, try:&lt;/div&gt;&lt;div&gt;dir C:\Windows\assembly&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Details are described here: &lt;/div&gt;&lt;div&gt;&lt;a href="http://geekswithblogs.net/pavelka/archive/2006/05/05/WindowsExplorerAndTheGlobalAssemblyCache.aspx"&gt;http://geekswithblogs.net/pavelka/archive/2006/05/05/WindowsExplorerAndTheGlobalAssemblyCache.aspx&lt;/a&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;Here's a tool to list and possibly remove assemblies (can be very handy after a bad install):&lt;div&gt;&lt;a href="http://support.microsoft.com/kb/290301"&gt;http://support.microsoft.com/kb/290301&lt;/a&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-7493083597165689021?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/7493083597165689021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/10-seconds-on-windows-assemblies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7493083597165689021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7493083597165689021'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/10-seconds-on-windows-assemblies.html' title='10 Seconds on Windows Assemblies'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-3820636624633033465</id><published>2009-07-15T03:26:00.000-07:00</published><updated>2009-08-10T06:20:32.989-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='InstallShield'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Service'/><title type='text'>InstallShield and Windows Services: ServiceExistsService doesn't work</title><content type='html'>So for me, ServiceExistsService didn't work at all.&lt;div&gt;There are some permission issues apparently (see &lt;a href="http://community.acresso.com/archive/index.php?t-169135.html"&gt;http://community.acresso.com/archive/index.php?t-169135.html&lt;/a&gt;)&lt;/div&gt;&lt;div&gt;&lt;a href="http://community.acresso.com/archive/index.php?t-169135.html"&gt;&lt;/a&gt;but the solution proposed there is a tad too heavy-weight for me.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;Here's an alternative, use the Registry entry of a service to figure out if the service is installed or not:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;div&gt;&lt;code&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;// Indicates if the service with this key (e.g. myNewService) has been installed&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;function BOOL windowsServiceExists(serviceKey)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;   string szKey,szServiceName;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;   number nRootKey; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;begin&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;nRootKey = HKEY_LOCAL_MACHINE;  &lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;code&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;if (RegDBSetDefaultRoot (nRootKey) &lt;&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;MessageBox ("Unable to set HKEY_LOCAL_MACHINE.", SEVERE);  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;return FALSE;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;endif;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;          &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;szKey =  "SYSTEM\\CurrentControlSet\\Services\\" +  serviceKey;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;//MessageBox("Testing for service: " + serviceKey, INFORMATION); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;if (RegDBKeyExist (szKey) = 1 )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;then&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;//MessageBox("found service:" + szServiceName, INFORMATION);  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;return TRUE;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;endif;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;return FALSE;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:x-small;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;&lt;/blockquote&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-3820636624633033465?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/3820636624633033465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/installshield-and-windows-services.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3820636624633033465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3820636624633033465'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/installshield-and-windows-services.html' title='InstallShield and Windows Services: ServiceExistsService doesn&apos;t work'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-7784433101998197364</id><published>2009-07-15T03:21:00.000-07:00</published><updated>2009-08-10T06:17:12.008-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='InstallShield'/><title type='text'>How to suppress InstallShield warning W7503</title><content type='html'>If you are like me and don't like duplication you might have something like a common.rul file that contains common methods. But with the InstallShield (7.x and higher ?) compiler you get this warning if you didn't use a method:&lt;div&gt;
&lt;/div&gt;&lt;div&gt;W7503: function defined but never called&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Bad thing about this is the fact that you can't easily spot real warnings from this 'warning to ignore'.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Here's how to avoid this:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;1)  define a dummy method where you call all your offending methods&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;div&gt;&lt;code&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// dummy function to supress warning 'function defined but never called' &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;prototype dummySuppressWarningW7503();                     &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;function dummySuppressWarningW7503()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;begin &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;setRegistryValue("","",0,"");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;end;&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;2) call this method someplace that is definitely executed inside an if( FALSE ):&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;/code&gt;&lt;div&gt;&lt;code&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // a little trick to stop the compiler from showing warnings&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  if( FALSE ) then&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;dummySuppressWarningW7503();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  endif;  &lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;code&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;span class="Apple-style-span"  style="font-size:10px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Tada ! The compiler thinks its called, but it never is.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-7784433101998197364?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/7784433101998197364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/how-to-suppress-installshield-warning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7784433101998197364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/7784433101998197364'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/how-to-suppress-installshield-warning.html' title='How to suppress InstallShield warning W7503'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3619881695344253937.post-3373055918688829181</id><published>2009-07-15T03:16:00.000-07:00</published><updated>2009-08-10T07:05:54.211-07:00</updated><title type='text'>void main()</title><content type='html'>Ok, here it goes ... instead of collecting my private Tips&amp;amp;Tricks, why not publish them online?&lt;div&gt;Makes it easier for me to search and maybe someone out there finds a little trick that solves his/her problem. I owe you people out there a lot of good ideas.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;This blog will be about Java, Groovy, C++ (if I can't avoid it), Design Patterns, Agile Methods, possibly Berlin or, more generally, some 'Eureka' moments when things just start working again.&lt;/div&gt;&lt;div&gt;Enjoy !&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3619881695344253937-3373055918688829181?l=tech-eureka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-eureka.blogspot.com/feeds/3373055918688829181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/start.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3373055918688829181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3619881695344253937/posts/default/3373055918688829181'/><link rel='alternate' type='text/html' href='http://tech-eureka.blogspot.com/2009/07/start.html' title='void main()'/><author><name>Axel Podehl</name><uri>http://www.blogger.com/profile/10752349929649267813</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
