Saturday, April 14, 2012

vi and arrow keys

I ignored a nagging nuisance until finally I couldn't take it anymore. Turns out vi doesn't acknowledge the arrow keys in insert mode - they output A, B, C, or D followed by a newline. Ubuntu installs the original vi by default, but if you install vim, it will relink vi to vim and all will be right in the world.

$ sudo apt-get install vim


Friday, December 30, 2011

Eclipse Plugins CLI Install

I tend to install/reinstall Eclipse on numerous machines and I end up following the same pattern every time.  Download eclipse, unpack it, fire it up, install a half dozen plugins from the marketplace,  and oh yeah, restart eclipse between each install.  

The Eclipse marketplace did do a nice thing by adding the ability to create a personal repository of plugins and using a single update URL, one can install all their favorite plugins at once.  But what if there was an easier way!

There are two, depending on your version of eclipse.  The first version is actually deprecated as of Eclipse 3.7 (Indigo).  I include it because I've had an issue or two installing plugins with poorly configured update sites using the latter method.  This method is also a bit trickier to use because you need to know the exact version of the Equinox Launcher that is installed with your eclipse.  To find the correct version, issue the following from the eclipse directory (assuming linux/mac osx)

$ EQUINOX_LAUNCHER=`find . -name org.eclipse.equinox.launcher_* -print`

Then, install or update a plugin

$ java -jar $EQUINOX_LAUNCHER -application org.eclipse.update.core.standaloneUpdate -command install -from http://foos-bar.eclipselabs.org.codespot.com/svn/update -featureId com.foosbar.mailsnag -version 1.0.1

The options I provided are for a small plugin I wrote (shameless plug), but the three important options are

    -from          # the plugin repository url
    -featureId   # the unique feature id for the plugin
    -version      # the plugin version being installed

All of this information can be obtained from the plugin repository.  If you take the repository url and append it with /site.xml, you will see the descriptor for that plugin or plugins hosted by the update site.

The second and recommended method is using the new p2 directory application.  I'm not sure when it was first included with eclipse, but I believe it was Galileo.

From the eclipse installation directory you can install the same MailSnag plugin with the following single command

$ ./eclipse -noSplash -application org.eclipse.equinox.p2.director -repository http://foos-bar.eclipselabs.org.codespot.com/svn/update -i com.foosbar.mailsnag/1.0.1

The other benefit to using this command is you can install multiple plugins at a time using a comma separated list of repositories and feature ids.

To uninstall a plugin

$ ./eclipse -noSplash -application org.eclipse.equinox.p2.director -u com.foosbar.mailsnag/1.0.1

To get a list of options to use with the p2 Director

$ ./eclipse -noSplash -application org.eclipse.equinox.p2.director -help

And with that, have a happy New Year!

Wednesday, September 28, 2011

Story of Ubuntu 11.10 Beta 2 on a Sony Vaio Laptop

I have 2 year old Sony Vaio Laptop (FW398) that I use as my personal development machine - its beginning to show its age.  I have been trying (unsuccessfully) to replace Win7 with Ubuntu 11.04.  The problem is, I can run Ubuntu from the CD-ROM or a USB drive, but when I install it to the SSD, it fails to start up.  I see the Vaio splash screen followed by a blank screen with a blinking cursor... and nothing else.  No amount of magic keystrokes seemed to help and the network didn't initialize.

Then I found out, Ubuntu 11.10 released its second beta so I decided to give that a shot. Well, long story short, same result!  It wasn't until I began playing with the partitions that I finally got it working. The default setup creates 2 logical partitions; one for swap space and the remaining space for root.  I tried creating an additional boot partition, but that didn't matter.  Finally I cleared all the partitions and created the three (root, boot and swap) as physical partitions.  Jackpot!

I'm psyched its working but would love to know why.  If you know, please share.

Sunday, September 25, 2011

Cisco AnyConnect on Fedora 15/16 (64-bit)

Getting Cisco's AnyConnect VPN client (32-bit) to install on Fedora 15 (64-bit) is just a matter of dependency resolution.  The client version I'm using is a little old (2.4.1012) so I'm not sure if this applies to more recent versions.

sudo yum install glibc-*.i686 atk-2*.i686 gdk-pixbuf2-*.i686 gtk2-*.i686 libxml2-*.i686

Once those packages are installed, the AnyConnect client can be installed or run.

NOTE: The "*" in the install list will match the latest version available for that particular package.

EDIT: I was successful with these instructions on Fedora 16 as well.

Tuesday, August 9, 2011

JBoss AS 7 and an Oracle Datasource

Here are step by step directions on how I configured my development instance of JBoss to communicate with Oracle XE.

1. Create directory for the oracle driver deployment
$ cd $JBOSS_HOME/modules
$ mkdir -p com/oracle/ojdbc6/main
$ vi module.xml

Add the following snippet to the newly created module.xml file
<module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6">
  <resources>
    <resource-root path="ojdbc6.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
  </dependencies>
</module>

Copy the ojdbc6.jar to $JBOSS_HOME/modules/com/oracle/ojdbc6/main

Next, create the driver definition in the standalone configuration file
$ vi $JBOSS_HOME/standalone/configuration/standalone.xml

Look for <subsystem xmlns="urn:jboss:domain:datasources:1.0"> - this is where the datasource and driver configuration will go. Within this subsystem, look for the <drivers> section and add the following:
<driver name="oracle" module="com.oracle.ojdbc6">
  <xa-datasource-class>
    oracle.jdbc.OracleDriver
  </xa-datasource-class>
</driver>

Then create the datasource configuration, also in the standalone configuration file. The following block will go just below the <datasources> element.
<datasource jndi-name="WorkCenterDS" pool-name="OracleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
  <connection-url>jdbc:oracle:thin:@localhost:1521:oradb1</connection-url>
  <driver>oracle</driver>
  <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
  <pool>
    <prefill>true</prefill>
    <use-strict-min>false</use-strict-min>
    <flush-strategy>FailingConnectionOnly</flush-strategy>
  </pool>
  <security>
    <user-name>user1</user-name>
    <password>1234</password>
  </security>
</datasource>

Restart JBoss and look for the following lines in your log file to determine if the deployment succeeded.

DEBUG [org.jboss.as.connector.deployer.dsdeployer] (MSC service thread 1-4) Adding datasource: java:/WorkCenterDS
INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) Bound data source [java:WorkCenterDS]

Thursday, July 14, 2011

Flash 11 (64bit) on Chrome for Fedora 15

Uninstall the old plugin

If you installed flash like I did in my previous post, then removing it is simple.

$ cd ~/.mozilla/plugins
$ rm libflashplayer.so

Download the new Flash 11 Plugin

Find the 64bit plugin for Linux at the site below.
http://labs.adobe.com/downloads/flashplayer11.html

Once downloaded, unpack it and install.
$ cd ~/Downloads
$ tar xzvf flashplayer11_<version>.tar.gz

That will unpack the libflashplayer.so and a usr folder into the Downloads directory. You can discard the usr directory if you like; I only needed the libflashplayer.so.

Move the plugin into your local mozilla plugins directory
$ mv libflashplayer.so ~/.mozilla/plugins

Restart Chrome and/or Firefox. To confirm the installation, type "about:plugins" on the url bar and you should see something similar to:

Saturday, May 7, 2011

Maven Build Number Plugin and SVN

I was trying to get the Subversion Revision number into a properties file in my application in order to display the build number - nothing exotic. However it wasn't as easy as it should've been and turns out it was an issue with my environment.

A little about my environment: Windows 7, Eclipse Helios, Maven 3.0.x.

I wanted to take advantage of the buildnumber-maven-plugin from Codehaus so I added the following plugin to my project's WAR pom.xml file.

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>buildnumber-maven-plugin</artifactId>
   <version>1.0</version>
   <executions>
      <execution>
         <phase>validate</phase>
         <goals>
            <goal>create</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <doCheck>false</doCheck>
      <doUpdate>false</doUpdate>
   </configuration>
</plugin>

I enabled resource file filtering and in one of my properties xml files, I added the build number variable for replacement.

<value>build: ${buildNumber}</value>

However, when I was building the war file, the ${buildNumber} variable was being replaced with null. It wasn't until I enabled debugging within Maven that I discovered Maven couldn't connect to my Subversion repository. The error itself during a default build was very subtle. A long story short, I don't have the subversion client installed on my machine (only the Subclipse plugin) so I needed to add the following to my buildnumber-maven-plugin configuration (below in bold)

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>buildnumber-maven-plugin</artifactId>
   <version>1.0</version>
   <executions>
      <execution>
         <phase>validate</phase>
         <goals>
            <goal>create</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <doCheck>false</doCheck>
      <doUpdate>false</doUpdate>
      <providerImplementations>
         <svn>javasvn</svn>
      </providerImplementations>
   </configuration>
</plugin>

Hope that helps someone, somewhere!