Posts

STOMP + SSL testing

See STOMP protocol here . Edit activemq/conf/activemq.xml and add the following transport connectors: Start activemq. Connect from the command line: For non SSL just       telnet localhost 61613 For SSL      openssl s_client -connect localhost:61614 Connect with (login/passcode is only required if AMQ configured for authentication): CONNECT accept-version:1.1 login:system passcode:manager host:localhost ^@ CONNECTED will be echo'd Subscribe to one or more queues: SUBSCRIBE id:0 destination:/queue/someQueueName ack:client ^@ Send a message: SEND destination:/queue/someQueueName content-type:text/plain hello queue a ^@ Should see the sent message echo'd See the protocol for more

Thread deadlock analysis

"waiting for monitor entry [0x00007f0e2bbfa000]" the hexadecimal address does not correspond directly with lock addresses. Test code: public class ThreadMonitorTest implements Runnable {   ThreadMonitorTest b;   public static void main(String[] args)   {     ThreadMonitorTest a = new ThreadMonitorTest();     a.b = new ThreadMonitorTest();     a.b.b = a;       new Thread(a).start();     new Thread(a.b).start();   }   public void run()   {     synchronized(this) {       try       {         this.wait(60000);         synchronized (b)         {           b.wait(60000);         }       }       catch (InterruptedException e)       {         e.printStackTrace();   ...

Generically load enum mapping via properties file

  public static void main(String[] args) {     final Properties props = loadProperties("some.properties");     loadMap(props, SomeEnum.class, someMap, "some.properties");   }   public > void loadMap(final Properties props, Class enumType,       Map m, final String resourceName)   {     for (Object o: props.keySet())     {       String key = null;       String value = null;       try       {         key = (String) o;         value = (String) props.get(key);         m.put(key, Enum.valueOf(enumType, value));       }       catch (Exception ex)       {         log.error(String.format("Error loading %s key %s, value %s", resourceName, key, value), ex);       }     }   }  ...

Ubuntu 12.04 Windows share

When using Places : Connect to Server use uppercase for the server and domain. The server does not start with \\. Alternatively enter Alt+F2 and enter smb://server/share and click the Run button, then enter the domain and credentials.

Oracle sqlplus history

linux rlwrap sqlplus http://www.oracle-base.com/articles/linux/rlwrap.php

Ubuntu - switch from Unity to Classic

sudo apt-get install gnome-session-fallback logout login and select GNOME Classic http://www.howtogeek.com/189912/how-to-install-the-gnome-classic-desktop-in-ubuntu-14.04/ http://norwied.wordpress.com/2012/12/25/panels-in-ubuntu-12-10-gnome-classic/ Drag and drop to top panel to add application shortcuts Click Alt+Meta(Windows key) and right click on top panel to get add menu Keyboard shortcuts like Alt+Tab won't work initially - install ccsm sudo apt-get install compizconfig-settings-manager Got to Application : System Tools : Preferences : CompizConfig Settings Manager Select Window Management and enable either Application Switcher or Static Application Switcher

ActiveMQ https

ActiveMQ supports tunneling JMS over https to transparently traverse firewalls, but the  documentation  doesn't indicate how to configure it and relevant examples were lacking via google. After hacking for half a day I finally stumbled upon the simple solution. Keep in mind that you will want to create you own keys and certificate. For testing I just used the ones provided in the activemq/conf dir. Simply configure an https transport connector in conf/activemq.xml and pass the keystore, password, and truststore to activemq when started. conf/activemq.xml <amq:transportconnector uri="https://0.0.0.0:61684"> activemq start parameters -Djavax.net.ssl.keyStore=/path/activemq/conf/broker.ks -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/path/activemq/conf/broker.ts import self-signed cert into client jdk keystore cd /path/jdk1.7.0_15/jre/lib/security keytool -import -trustcacerts -file /path/activemq/conf/broker-l...