solr

Mulitple cores in SOLR

Setting up multiple cores in SOLR can seem like a daunting task but is pretty simple. You'll need to create a solr.xml file, create a directory to contain the core specific infomration, and modify some configuration files. (more…)

By dan, ago
maven

OutOfMemoryException in Maven

I came across a situation today where Maven threw an OutOfMemoryException. I didn't think the process would have taken that much memory but it clearly did. I was trying to deploy. I then tried it again but skipped the tests. No good. I found out that by setting the MAVEN_OPTS environment variable to something like -Xmx512m I was good to go.

By dan, ago
programming

Comparing Hash Tables

I was recently asked in a comment how to compare 2 hash tables in Perl. Furthermore, the commenter mention that this would be use in a subroutine. There is a module Data::Compare http://search.cpan.org/~dcantrell/Data-Compare-1.19/lib/Data/Compare.pm. I've never used this in any way other than to learn what it can do. From what I can tell it will not provide details. It will just tell you yes, the data structures are the same or no, the data structures are not the same. (more…)

By dan, ago
maven

Maven Commands

I've collected a short list of commands I use for maven and thought I'd share. Install to Local Repository Compile Test Classes, Do Not Run Tests

mvn -Dmaven.test.skip.exec install
Install to Local Repository Do Not Compile Test Classes, Do Not Run Tests
 mvn -Dmaven.test.skip install
Generate Test Results in HTML Format (tests will be run)
mvn surefire-report:report
Generate Test Results in HTML Format (tests will not be run, source of reports will be last tests run)
mvn surefire-report:report-only
Run Specific Test Class
mvn -Dtest=MyTestClass test
Use Patterns to Run Specific Tests
mvn -Dtest=MyTest*lass test
Run Multiple Specific Test Classes
 mvn -Dtest=UnitTestClass,Accep*TestClass test
View Dependency Tree: output is a mono-spaced tree views of all classes in the current artifact
mvn dependency:tree
Download Sources: Usually when using Maven only the binary version of your dependency are fetched from the repository. This will tell Maven to download the sources of your dependencies.
mvn [goal] -DdownloadSources=true
Download JavaDocs: Same as with sources, Maven doesn't usually grab the JavaDocs.
mvn [goal] -DdownloadJavadocs=true

By dan, ago
programming

Hash tables

I have found a number of potentially unconventional uses for hash tables (aka "associative arrays"). I suppose the first thing that comes to mind when thinking of hash tables is as a way to map a given value to another value. As a very simple example, say you have a list of items and want to keep track of how many of those items you have.

my %items = ();
$items{shoes} = 2;
$items{pants} = 1;
$items{dogs} = 5;
$items{cats} = 50;
We often refer to this arrangement as a "key/value" pair. Now, if you want to know how many shoes you have you can do so by referencing $items{shoes}. If you want to know just how crazy the cat person is, look at $items{cats}. (more…)

By dan, ago
maven

Converting from Apache Ant to Apache Maven

At work (http://www.monsanto.com/) we're converting all projects from Apache ant to Apache maven. The architecture team came up with the POM which all our applications would extend and set up the company-wide repository. I spent about a week and a half converting our project. Everyone thought that conversions would go smoothly. However, I haven't heard of any project taking less than a week. A colleague wrote an application called "mavenizer". The mavenizer helps analyze your project and generates a POM for each artifact. We had to determine how to split our application into artifacts but using the mavenizer app helped us figure out the dependencies and got us started with an initial POM. I can't speak for other projects but probably the most time consuming part of the process was weeding out the dependencies. We had some production code that had interdependencies but the majority was located in the test code. For instance, we have a TestHelper class that provides methods setting up the data environment prior to running a test and for tearing it down once the test completes. This class was used in a couple of leaf artifacts (domainpos and batchprocess). When working with maven each, for lack of a better word, installable module is packaged in what's known as an artifact. An "installable" would be something like a jar or war or ear or some other unit. We have a "common" artifact that's a jar and can be used by all other artifacts. Then there is an "appdao" jar which contains all database-related code. Finally there are 3 leaf artifacts which can depend on the common and/or appdao but should not depend on each other: domainpos (war that is our point-of-service); plugin (jar that is a plugin for the company-wide GUI framework); batchprocess (jar that runs on a schedule for batch processing). I'll post here more about the conversion process and about things I learn about maven.

By dan, ago