Amazon Prime – Totally Worth It

Posted in Personal with tags , on December 27, 2013 by jstevenperry

I joined Amazon Prime a year or so ago. Not only do I get free 2 day shipping on all my orders, they have fantastic customer service! So, I ordered some stuff that was supposed to show up a week before Christmas. Well, it never showed up. So I waited an extra week, just to be safe. At this point, I figured the package just got lost. So I started a live chat with an Amazon.com rep and in minutes I was told I will have a credit card refund. If I end up getting the items from UPS (I’ll be over here holding my breath), all I have to do is contact Amazon.com for a shipping label and I can ship them back at no charge.

That’s pretty awesome. I don’t know whether or not my outstanding customer service experience today is because I’m a Prime member, but I’d like to think it is. If not, then all the more reason to shop with Amazon.com.

Hallelujah!

Posted in Java, Open Source, Software Development on December 27, 2013 by jstevenperry

Hallelujah!

Anyone who uses the JDK Date/Time API knows it, well, sucks. Badly.

Joda-Time was created to remedy the numerous shortcomings in the JDK’s stock Date/Time API. And it pretty much ruled for a very long time. Include it in my Maven POM and, boom!, just like that, I had a very good Date/Time API.

I wrote an article for IBM DeveloperWorks about Joda-Time in an attempt to share this news with those who didn’t know they had to suffer in silence.

So imagine when I read this article at JavaWorld about JSR-310. Basically Joda-Time’s (very few) design flaws will be fixed and the spirit of Joda-Time will be included in the JDK as part of Java 8 (at least, that is the plan). I’m sure that is not a completely accurate characterization of the situation, but basically the new JDK Date/Time API will be very familiar to anyone who has used Joda-Time.

–jsp

My Resume

Posted in About Me, Personal on December 11, 2013 by jstevenperry

My Resume

As a consultant, I’m always looking for my next job (kind of like being a politician, only I’m honest and deliver something of real value). If you want to see what I’ve done, what I’ve written, where I went to college, click on the link above. Or the one below:

http://careers.stackoverflow.com/jstevenperry

–jsp

Breaking Bad

Posted in Personal, Philosophy, TV on September 27, 2013 by jstevenperry

I began watching this show on a lark, and was hooked from the very first episode. I’ve watched them all (now multiple times, thanks to Netflix), and enjoy them very much. More than once I have asked myself why I am so drawn to this story of greed, obsession, lust, avarice, and raw humanity.

Walter White is a superbly intelligent individual. But he is also a deeply flawed human being. Several times throughout the show he could have walked away a rich man, and chose not to. Though it’s not completely clear why he walked away from Gray Matter (which, ironically, would have made him more millions – legitimately – than cooking meth every did), a careful study of the show reveals that Walter always feels that his genius is unappreciated. So he sold his shares, left Gray Matter with a huge resentment and “a couple of months’ rent”, and subsequently slid into mediocrity. That haunted him until his diagnosis.

From the beginning we see a man on a mission, and it takes him from hero, to killer, to criminal mastermind, and finally to fugitive. Like the man, the mission is deeply flawed. Never feeling fully appreciated, his obsession (matched only by his brother-in-law Hank’s obsession to catch the mysterious “Heisenberg”) leads him down a very dark path from which redemption is hopeless.

That said, Walter seems comfortable knowing that what he is doing is illegal. He seems to grow more at ease with the terrible things he has done, but never tries to justify it in terms of “free markets” or any other such nonsense, and does not try to disguise stealing from innocent (if perhaps greedy) people as “Capitalism at its finest.” In fact, he proudly declares more than once that the money he has acquired by cooking methamphetamine is money he “earned.”

Perhaps the lesson is this: greed in any form, leads to destruction. Period.

Or maybe the lesson is, when you have 1,000 gallons of methylamine and you can sell it for $15,000,000, take the deal.

That doesn’t make for very good TV though.

JBoss AS 7 Debugging With Eclipse

Posted in Eclipse, Java, JBoss EAP, Software Development with tags , on July 31, 2013 by jstevenperry

If you have ever wanted to debug application code running on a instance of JBoss then this post is for you. This information is in various places on the Net, but I thought I would pull it together in one spot. That’s how I roll.

First off, I use JBoss EAP 6.1 (AS 7) and Eclipse Juno. These instructions will probably work for you should your versions be different. Just wanted to get that out of the way.

Next, You will need to start JBoss with a few extra options to the JVM. You can set these either in standalone.xml, or via the JAVA_OPTS environment variable. The options look basically the same, but for this post I will use JAVA_OPTS. Read this post from the JBoss Community forum if you want to use standalone.xml to configure the JVM parameters.

Add this line to your existing JAVA_OPTS:

-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

The port number (8787) above must match your Eclipse setup (see below).

Finally, you will need to tell Eclipse how to connect to the remote process. In Eclipse, click the Debug button’s drop-down arrow and select “Debug Configurations”.

  • In that dialog, navigate to “Remote Java Application” and click the “New” button.
  • Under “Project” select the project that contains the code you want to debug.
  • Under Connection Type make sure “Standard (Socket Attach)” is selected.
  • Under Connection Properties, make sure the host (e.g., localhost) and port (which must match the port spec in the JAVA_OPTS, in this case 8787) are set.
  • Click on the “Source” tab and add any projects containing code you want to debug (if there are other projects in your workspace that contain code other than the main project).
  • In the Common tab, under “Display in favorites menu” select the Debug icon and a handy dandy icon will appear in your Debug toolbar dropdown (the name will be the same as the Project setting from earlier).

If JBoss is already running (with the options set earlier) click Debug to attach. If not, start JBoss, then click Debug to attach.

Now you can set breakpoints, step through your code, etc.

Have fun!

–jsp

JBoss Logging Got Ya Down?

Posted in Java, JBoss EAP, Software Development on July 16, 2013 by jstevenperry

Okay, I admit it, I like JBoss. Well, once I finally got the hang of it, that is. But logging was always something that drove me crazy. On my current project, my client is using Liferay portal and JBoss together, and let’s just say there was some friction. I used to get log messages that looked like this:

10:14:10,134 INFO  [stdout] (JMS Session Delivery Thread - DeidentifiedThreadId) INFO  - ==> Got message:

Notice the [stdout] next to the log message. Because of this, JBoss does not know how to control the logger. Many posts I read recommended putting org.apache.log4j as an exclusion in jboss-deployment-structure.xml. I did this and it did not work. If you are using JBoss EAP 6.x DO NOT DO THIS! READ ON!

First of all, I could never reliably get my log messages to show up (using log4j). Sometimes they would come out, sometimes they wouldn’t. It drove me nuts! We started using JBoss EAP 5 and have now upgraded to 6.1. There has been some pain.

First, we were using a jboss-deployment-structure.xml file to control dependencies (and exclusions). Until today, I had org.apache.log4j under <exclusions>. No more! My jboss-deployment-structure.xml went from this:

<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
    <exclusions>
      <module name="org.apache.log4j" /> 
      <module name="org.hibernate" />
    </exclusions>
    <dependencies>
      <module name="org.apache.log4j" />
      <module name="com.liferay.portal" />
      <module name="javax.mail.api" />
      <module name="org.apache.xerces" />
      <module name="org.jboss.modules" />
      <module name="org.apache.cxf" />
    </dependencies>
  </deployment>
</jboss-deployment-structure>

To this:

<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
    <exclusions>
    </exclusions>
    <dependencies>
      <module name="org.apache.log4j" /> 
      <module name="org.hibernate" />
      <module name="org.apache.log4j" />
      <module name="com.liferay.portal" />
      <module name="javax.mail.api" />
      <module name="org.apache.xerces" />
      <module name="org.jboss.modules" />
      <module name="org.apache.cxf" />
    </dependencies>
  </deployment>
</jboss-deployment-structure>

Now I can control log output through the JBoss console (or by changing standalone.xml directly). My log messages come out with the correct logger name and everything works.

Just thought I’d pass that along!

–jsp

When Polymorphism Fails

Posted in Java, Rants, Software Development on July 10, 2013 by jstevenperry

When Polymorphism Fails

I love Java. I love OOP. I love polymorphism. But polymorphism does not always solve every problem I have. Something about sweeping statements of the form “If you use instanceof you are a complete idiot” have always bothered me (on many levels, but I’m referring here only to its technical aspect).

This nifty blog post by Steve Yegge made me feel better. It points out when polymorphism just will not do the trick (and has a nice recap/primer of polymorphism if you are a little rusty on it).

Just thought I’d share that.

–jsp

Follow

Get every new post delivered to your Inbox.

Join 64 other followers