Skip to content
May 11 08

My adventures with Hardy

by Ronnie

I finally upgraded my computer to Ubuntu 8.04, but unfortunately my VMWare server didn’t work any more.  That led me into a whole bunch of things that I noticed wrong with my upgrade.  Allow me to explain the idiocity.

First, for some reason, even after upgrading, I was still booting into the old 7.10 kernel(2.6.22-14). A quick change to the /boot/grub/menu.lst file cleared that up.  I just copied one of the other entries and then modified it so that it pointed to the new kernel (2.6.24-16).

Great.  I booted up and then…had no wireless.  I had forgotten how I set it up before, until I came across this page. For some reason, Hardy breaks newer Broadcom wireless cards (BCM4312, rev. 02 to be exact).  But that page has pretty direct instructions on how to fix your po’ computer…that is, if you have internet…which you probably do, if you’re looking at this page.

Great.  Ok now I can install VMWare.   I had it installed before, but something made it get all scared and I suppose it scurried away to /dev/null for eternity.  Suicide must have been more appealing to the VMWare.

Apparently there are issues with VMWare on Hardy, but following this page seemed simple enough.  Except when I ran:

sudo ./runme.pl

It gave me this error:

A previous installation of VMware software has been detected.

The previous installation was made by the tar installer (version 3).

Keeping the tar3 installer database format.

Error: Unable to execute "/usr/bin/vmware-uninstall.pl.

So great, it left pieces of itself behind, except without a shovel to clean them up with. This was easily cleared up by removing the /etc/init.d/vmware directory.

After that, everything worked great.  I was able to open up my old XP instance perfectly.

Mar 6 08

Maven and skinny wars

by Ronnie

As I explained in this post here, we used the magical Maven groovy plugin to check when our EAR gets to big, and fail the build.  It works great, because now we get instant notification in our CI environment when something is amiss, which might get…um…missed.  So our build has been failing lately, intermittently because the EAR has been too big.

The problem was the latest version of the Maven war plugin (2.1-alpha-2-SNAPSHOT) changes the way that skinny WARs are created for packaging in EARs. The documentation hasn’t quite made it to the website yet.  Instead of using <warSourceExludes> to exclude the JARs that you do not want, you have to now use <packagingExcludes>.  It’s described in this bug here.

Feb 22 08

Stupid little tricks with Firefox I use

by Ronnie

People who use Linux know that copy/paste is as easy as selecting some text and then clicking the middle mouse button to put that text exactly where you want it. No need to navigate your poor and addled with carpel-tunnel left hand all the way over to the Ctrl-C/Ctrl-V combination, saving precious calories.

I used to use this trick in Firefox also. If you highlighted a URL, you could just hover in the window and middle click in there, and it would take you to the page. This was nice, because if you tried to copy it into the address bar, it would keep the original address in there, and then you would have to backspace it out, blah blah.

For some reason, the newer versions of Firefox seem to have this disabled (I think, unless I disabled it in some stupid way, which is completely possible). To enable it, navigate to about:config. This will take you to the secret preferences of Firefox. There, you can set the middlemouse.contentLoadURL to ‘true’, and get that setting back.

Another one that I like is using Ctrl-Backspace to delete parts of a URL in the address bar. It works great on my windows side, but in Linux, it just deletes the entire bar. To get that setting back, I had to set layout.word_select.stop_at_punctuation to ‘true’.

The about:config has all kinds of settings in there that can help you if you poke around in there.

Jan 23 08

Using the Groovy Maven plugin to do magic

by Ronnie

Recently, we had an issue that came up with creating our EAR for our web applications. We were trying to package up individual WARs in an EAR so they could share the same libraries and such and only load stuff used between them once, to save on memory.

We had it working great and then something ridiculous happened that caused WARs with their complete libraries (as opposed to stripped-down ones) to be included in the EAR, for no apparent reason. This caused a number of headaches and issues with the application, that we didn’t know until it was deployed, because we failed to recognize that the EAR had nearly doubled in size.

You may be wondering, “Hey, I just read two of your dumb paragraphs and I haven’t seen the word ‘groovy’, ‘maven’, ‘magic’, or ‘using’ yet.” Well, wouldn’t it have been nice if we knew instantly that the EAR had grown, when trying to build? That’s where the using the groovy maven magic plugin can help!

My co-worker James and I attempted to use the maven enforcer plugin, but it would have taken too much work and we would have needed to write a custom plugin for it to check the size of the EAR. So we decided to do it with Groovy. Here’s the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<plugin>
  <groupid>org.codehaus.mojo.groovy</groupid>
  <artifactid>groovy-maven-plugin</artifactid>
  <version>1.0-beta-4-SNAPSHOT</version>
  <executions>
    <execution>
<phase>verify</phase>
      <goals>
        <goal>execute</goal>
      </goals>
      <configuration>
        <source>
 
          def ear = new File("$pom.basedir/target/${project.artifactId}-${project.version}.${project.packaging}")
          log.info("${ear?.length()}");
          def maxsize = project.properties['ear.maxsize'];
          if (ear?.length() > maxsize?.toInteger()) {
            fail("EAR Exceeds maximum size allowed.");
          }
        </source>
      </configuration>
    </execution>
  </executions>
</plugin>

This beginning part essentially defines the groovy plugin, and states run the code during the maven’s “verify” phase, so we know that the EAR is already created:

1
2
3
4
5
6
7
8
9
10
11
<plugin>
  <groupid>org.codehaus.mojo.groovy</groupid>
  <artifactid>groovy-maven-plugin</artifactid>
  <version>1.0-beta-4-SNAPSHOT</version>
  <executions>
    <execution>
<phase>verify</phase>
      <goals>
        <goal>execute</goal>
      </goals>
</execution></executions></plugin>

The groovy code is really straight forward. First we get a reference to the file:

13
14
def ear = new File("$pom.basedir/target/${project.artifactId}-${project.version}.${project.packaging}");
log.info("${ear?.length()}");

We’re using variables defined directly in the POM, so we know the name of the file. We also print the length of the file out, for sanity’s sake.

Next we get the max size value:

15
def maxsize = project.properties['ear.maxsize'];

This is defined later in the pom.xml file, under properties:

<properties>
        <ear.maxsize>60000000</ear.maxsize>
</properties>

As you can see, it is set to near 60MBs.

Finally, and obviously, we check the two values against each other, and fail the build if the EAR is bigger than the size allowed.

16
17
18
if (ear?.length() > maxsize?.toInteger()) {
  fail("EAR Exceeds maximum size allowed.");
}

The fail() call in groovy allows you to fail the build with a message attached to it.

So now, if anything fishy happens with the EAR, we’ll be able to know as soon as our CI environment attempts to build it. This is a really simple example, but you could see how integrating groovy into maven could allow for some very powerful things to be done.