Updating all of the pom.xml Version Numbers in a Multi-Module Maven Project

To update the versions of all of the poms in a multiple module project use the versions-maven plugin.

To update

mvn versions:set -DnewVersion=1.4.0-SNAPSHOT

Will modify all of the versions of each of the poms to the version specified.  It will create a pom.xml.versionsBackup for each pom file that it modified.  You can then examine each to make sure that it is as you intended.

If you want, you can revert your change with

mvn versions:revert

If you are satisfied with → Continue reading “Updating all of the pom.xml Version Numbers in a Multi-Module Maven Project”

Use awk to Print from nth element to the End of the Line

If you want to extract from the nth token to the end of the line, following is how you can do that with awk:

Given a source file with the following:

line1 -- 01   0011 1
line2 -- 01   0011 2
line3 -- 01   0011 3
line4 -- 01   0011 4
line5 -- 01   0011 5
line6 -- 01   0011 6
line7 -- 01   0011 7
line8 -- 01   0011 8
line9 -- 01   0011 9
line10 -- 01   0011 
Continue reading “Use awk to Print from nth element to the End of the Line”

JVM Option for Increasing the Default Number of Lines in the StackTrace

By default (Java 1.6 or greater), the JVM will output, at most, 1024 lines of the stack trace.

In the situation where you have some recursion problem or some infinite loop that results in a stack overflow error you will need to increase this value with a JVM option to see the origin of your crash.

To do so, add the following option to the java command

$ java -XX:MaxJavaStackTraceDepth=-1 -jar some.jar some.package.Class  etc, etc,

-1 indicates no limit.  Any → Continue reading “JVM Option for Increasing the Default Number of Lines in the StackTrace”

Debugging Maven Tests by Connecting an IDE to the Maven JVM

In some instances you cannot reproduce a failure or condition running a test in an IDE that manifests itself when you run it on your build server or via maven on the command line.

In that case, it is very helpful to be able to remotely attach your IDE to the running maven process and then step through the code.

To do so you will need to:

Execute maven on  the command line as follows (adding any additional -D args → Continue reading “Debugging Maven Tests by Connecting an IDE to the Maven JVM”

Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can’t attach to the process [SOLVED]

If you are attempting to use jmap or another Java memory analysis tool to connect to a running JVM to generate a heap dump, even when running jmap as the same user as that of the running process, and encounter the following error:

Attaching to process ID 2712, please wait...
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process

Following is the (likely) solution to your problem.

It is likely that the ptrace_scope setting for your system is set → Continue reading “Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can’t attach to the process [SOLVED]”

Firewall for Ubuntu 14.04 LTS

For whatever reason, Ubuntu 14.04 does not seem to come with a firewall.

There are however two packages which provide, both a firewall and a handy GUI front-end for it.  UncomplicatedFireWall is the main package (ufw) and the GUI is gufw.

To install:

apt-get install gufw

This will install the front-end and the dependent packages

To turn it on:

ufw enable

The default is to block all incoming traffic.

To update and add your own firewall rules and allow incoming → Continue reading “Firewall for Ubuntu 14.04 LTS”

Possible Remediation for Stagefright Android Vulnerability

By now, everyone is aware of the Stagefright vulnerability in Android.  It isn’t as much the name of the vulnerability but a media player library used in Android.

It seems that one of the ways to remediate the vulnerability is to configure your text messaging application to NOT auto-retrieve Multimedia messages (MMS).  On my phone that is under the Advanced Settings, “Auto-retrieve Automatically retrieve messages”.

The other thing that I did was disable Google Hangouts.  I don’t use it on → Continue reading “Possible Remediation for Stagefright Android Vulnerability”

Hadoop Cluster Sizing Wizard by Hortonworks

Anyone who does any Hadoop development or systems engineering arrives at the “how should I size my cluster” question.

Hortonworks has a very nice cluster sizing calculator that takes into account the basic use-cases and data profile to help get you started with your hardware requirements.→ Continue reading “Hadoop Cluster Sizing Wizard by Hortonworks”

Generate a Random String of a Specified Size with a Shell Script

The following is a one-liner for generating a random string of a fixed size in bash, where the possible characters to use in the string are any digit, letter, and a newline.

By adding the newline, you are fairly sure to prevent getting one long line of text.

< /dev/urandom tr -dc "[:digit:][:alpha:][\n]" | head -c1000 file.out
Continue reading “Generate a Random String of a Specified Size with a Shell Script”

Connecting To a Test Kitchen Instance Via SFTP, SSH, or SCP

If you are using Chef and Test Kitchen to test your cookbooks you may have need to connect to the Test Kitchen VM in some other fashion other than $ kitchen login instance-name.

To do so:

Do a $ kitchen list to see the running vms

kitchen list
Instance                      Driver   Provisioner  Verifier  Transport  Last Action
default-centos-66             Vagrant  ChefSolo     Busser    Ssh        Converged

Then look in the .kitchen directory from where you ran your $ kitchen command and look for the corresponding → Continue reading “Connecting To a Test Kitchen Instance Via SFTP, SSH, or SCP”