ruby gem error: “ERROR: While executing gem … (ConcurrencyError)”

On Windows 7 running ‘gem install [gem name]” I was getting this cryptic error:

ERROR:  While executing gem … (ConcurrencyError)
Detected invalid array contents due to unsynchronized modifications with concurrent users

The only post I found that mentions this exact error was in the comments for this post about Neo4j on Ruby, and specifically getting this error with jruby 1.6.0.-RC2. I was using 1.6.0-RC1. I downloaded the latest version (1.6.7.2) and replaced my older version, and that fixed it.

Posted in Kev's Blog | Tagged , , | Leave a comment

Managing SSH keys on Heroku

Heroku uses Git for your code repo, and therefore uses SSH to talk to the remote server. If you’re already using an SSH keypair for another repo or elsewhere, you may have to explicitly manage which of your key’s you want to use to access Heroku.

To list your current keys you’ve shared with Heroku:

heroku keys

To add a new key – run this from your ~/.ssh/ dir:

heroku keys:add keyfilename (e.g. rsa_id.pub)

If you get this error:

Fingerprint already exists. Please use one SSH key per Heroku account

… it’s because you’ve already used this SSH key with another account.

Posted in Kev's Blog | Tagged , , | Leave a comment

In a Nutshell: Deploying a Java webapp to Red Hat’s OpenShift

Deploying a Java webapp to OpenShift couldn’t be any simpler. In as few words as possible to show you how simple it is – here’s a quickstart:

 

… and that’s it. Your app is pushed to your remote Git repo, built with Maven, and deployed to JBoss 7.

That’s pretty simple, huh?

Posted in Tech Notes | Tagged , , , | Leave a comment

In a Nutshell: Deploying a Java webapp to Heroku

This post walks you through getting started with Heroku and deploying a simple Spring MVC web app.

  • Follow the Getting Started guide to get your Heroku Toolbelt setup
  • Login to Heroku from the commandline with ‘heroku login’
  • Since Heroku does not provide it’s own app server, you configure your pom.xml to pull in a dependency on a container, like Jetty (this is from the Getting Started with Spring MVC guide)
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.3</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals><goal>copy</goal></goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-runner</artifactId>
                        <version>7.4.5.v20110725</version>
                        <destFileName>jetty-runner.jar</destFileName>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>

The Heroku Getting Started with Java instructions give some steps on how to run your app locally by running Java from the command line and passing a classpath pointing to your target dir, but this seems odd since Jetty is able to run from Mavan against your created war file or even the code compiled to your target dir using the ‘mvn jetty:run’ command. Add the following to the above <plugins> section to enable and use this approach instead:

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
</plugin>

  • Heroku uses a file named ‘Procfile’ in the root of your project to tell Heroku how to run your code. Add this file, and inside it add this one line
<code> web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war </code>
  • Create your new app on Heroku with ‘heroku create –stack cedar’
  • Add and commit your code if you haven’t already, then push to your heroku remote git:
<code>git add . git commit -m "commit comment" git push heroku master </code>

At this point Heroku should build you app remotely and start it up.

If you see this error about the jetty-runner.jar missing, then you forgot to add the plugin part to your pom.xml to copy the jetty jar to the target/dependency dir:

<code>Unable to access jarfile target/dependency/jetty-runner.jar</code>

Posted in Tech Notes | Tagged , , | Leave a comment

Is Zuckerberg’s hoodie really ‘a mark of immaturity’?

An industry analyst who recently met with Zuckerberg about investment plans in Facebook stated that he thought Zuckerberg’s trademark hoodie is ’a mark of immaturity’, implying that he should have been more suitably dressed for the business meeting.

Over on Google+, Robert Scoble posted about the analyst’s comment, which unleashed the most active community discussion that I’ve ever seen on G+ as a result of a single post. Opinions ranged wildly, but the activity in the discussion proves the absurdity and out of date thinking behind the expectation that professional business atire should be nothing other than suit, shirt and tie.

Times change, fashions change. The suit in today’s world is an absurd form of clothing. It has no practical benefits and is purely for show. This is my key issue – I don’t see how a suit is relevant in today’s world (in the software development world that I live in, at least) – wearing a suit does not make anyone a better software developer. It does not gift the developer with magical coding skills. It’s purely for show.

The popular saying ‘don’t judge a book by it’s cover’ hits the nail on the head with this issue. Wearing a suit is nothing more than a cover on a book. As the other expression goes, ‘first impressions count’, but the fact is, once you’ve got beyond that faux outer layer to discover the contents of the person that has wrapped themselves in fancy, overpriced fabrics, it’s hard to hide the facts without the flashy threads. In software development, you can either code or you can’t. You either gel with the team, or you don’t. You perform or you don’t. Each of these have varying levels of degree, but the key point is this: a suit is nothing more than fancy plumage. Remove the outer shell and show me what you’ve got.

There’s some awesome comments to Scoble’s post that capture my thoughts entirely, that I’d like to quote here that make the point perfectly:

"wearing a tie doesn't make you money, not unless you sell ties"
"If you need to wear a costume to play out your roles, you should
have become an actor or actress long ago"

Posted in Kev's Blog | Tagged , , | Leave a comment

Markdown wiki format for code blocks

Sometimes the simplest approaches are best.

To include a code block using Markdown wiki markup, indent each line of the block by 4 chars or a tab. Any additional spaces or tabs will be indents.

Posted in Tech Notes | Tagged , | Leave a comment

What did Jobs mean when he said he’d ‘cracked’ the TV format?

Apple has been rumored to be working on an Apple branded TV, and Jobs said about this new device that he’d ‘finally cracked it’, presumably meaning that he found a combination of features or new features that would make the killer Apple TV.

So what exactly did he have in mind? Most recent rumors from someone who claims to have seen an early prototype are that it’s a large flatscreen, with the Apple TV box integrated, a camera to support FaceTime, and Siri technology built in.

That doesn’t sound like a combination that would lead Jobs to say he’d ‘cracked’ it. Cracked what exactly? There must be more to it than just the combination of these components, because at face value that’s not exciting or revolutionary.

If I were to be interested in this product, it’s going to need to project a 3d hologram into the center of my living room. If Steve cracked that, then I’m buying.

Posted in Kev's Blog | Tagged , , | Leave a comment

Jury has partial verdict in favor of Oracle in case against Google

The Jury in the Oracle v Google case over Android has come to a partial verdict in favor of Oracle, but does not have a unanimous verdict for the other questions they were asked by the Judge to answer to arrive at their verdict.

To complicate the partial verdict, the verdict of the first question is only for 1 part of the question (“Has Oracle proven that Google has infringed the overall structure, sequence and organization of copyrighted works?”) and apparently the jury are not able to come to a decision on the second part (“Has Google proven that its use of Oracle’s Java documentation constituted “fair use”?”). Google’s attorneys  are therefore asking for a mistrial stating that this question cannot be partially answered.

It’s obviously not clearcut at this point where this is heading, and I imagine this could still swing either way.

If the end result of this case is that it is ruled that an API is Copyrightable, it will be interesting to see what the repercussions of this will be for other follow-on lawsuits.

Posted in Kev's Blog | Tagged , , , | Leave a comment

JSTL String test oddity

I’ve come across this multiple times, and for some reason this always catches me out. You’d think being that EL has ‘eq’ and ‘ne’ operators that work with Strings that this should work:

<c:if test="${hello.name ne ''}">
    Hello <c:out value="${hello.name}"/>
</c:if>

This seems to make sense that it would do what you think it should do, but no, it always returns true. The code you’re looking for is using EL operator ‘empty’:

<c:if test="${!empty hello.name}">
    Hello <c:out value="${hello.name}"/>
</c:if>

Posted in Tech Notes | Tagged , , , | Leave a comment

Git notes

Typical add/commit/push workflow:

#add local change ready to commit
git add .

#git commit changes to repo
git commit -m "commit message"

#push to remote repo
git push [optional remote repo name here, eg origin, etc]

Find changes committed locally compared with remote repo, i.e. to find what you’ve committed locally but not yet pushed:

git diff --stat [remote repo name]

Posted in Tech Notes | Tagged , | Leave a comment