Avatar
😀

Organizations

  • For use when you have multiple JVM providers (Apple & Oracle), you want to be able to switch between JDKs for each CLI

    usejava ()
    {
        local sel=$1.jdk
        if [ -x "/Library/Java/JavaVirtualMachines/jdk$sel/Contents/Home/bin/java" -a ! -x "/Library/Java/JavaVirtualMachines/$1/Contents/Home/bin/java" ]
        then
            sel=jdk$sel
        fi
        local base=/Library/Java/JavaVirtualMachines
        if [ -x "/System/Library/Java/JavaVirtualMachines/$sel/Contents/Home/bin/java" ]
        then
            base=/System/Library/Java/JavaVirtualMachines
        fi
        if [ -z "$1" -o ! -x "$base/$sel/Contents/Home/bin/java" ]
        then
            local prefix="Syntax: usejava "
            for i in /Library/Java/JavaVirtualMachines/* /System/Library/Java/JavaVirtualMachines/*
            do
                if [ -x "$i/Contents/Home/bin/java" ]
                then
                    /bin/echo -n "$prefix$(basename $i | sed -e "s/^jdk//;s/\.jdk$//;")"
                    prefix=" | "
                fi
            done
            /bin/echo ""
        else
            if [ -z "$JAVA_HOME" ]
            then
                export PATH=$base/$sel/Contents/Home/bin:$PATH
            else
                export PATH=$(echo $PATH|sed -e "s:$JAVA_HOME/bin:$base/$sel/Contents/Home/bin:g")
            fi
            export JAVA_HOME=$base/$sel/Contents/Home
            echo -n -e "\033]0;$(java -version 2>&1 | sed -e "s/.*\"\(.*\)\".*/Java \1/;q")\007"
        fi
    }
    

    There is additional fun to be had, given that most Java based launchers that try to fix JAVA_HOME when not set will guess the Apple JVM path… so the following Java program can help

    Shell Created Fri, 01 Feb 2013 00:00:00 +0000
  • http://j.mp/TfdoxL a link to a free online iOS app development training course that looks worth checking out

    Created Sat, 01 Dec 2012 00:00:00 +0000
  • Special Symbols and Characters on the regular Mac Keyboard

    These are for the British Keyboard layout

    Currency Symbols

    $

    dollar

    Shift+4

    ¢

    cents

    Option+4

    £

    pound

    Shift+3

    ¥

    yen

    Option+y

    Euro

    Option+2

    Trademark and Copyright Symbols

    ©

    copyright

    Option+g

    ®

    registered

    Option+r

    trademark

    Option+Shift+2

    Apple Symbol

    apple

    Option+Shift+K

    Math and Greek Character Symbols

    ±

    plus-or-minus

    Option+Shift+Equals

    µ

    micro

    Option+h

    π

    pi

    Option+l (as in L is for llama)

    square root

    Option+t

    ÷

    divided by

    Option+/ (slash is key to the left of right-hand shift key)

    Created Mon, 01 Oct 2012 00:00:00 +0000
  • This is a repost of my post on the CloudBees Developers blog

    TL;DR Source control injection attacks are a bigger worry than build tool injection attacks, and if you cannot trust your local filesystem, then you cannot trust anything.

    A few exchanges on twitter have prompted me to write a fuller blog post on the subject of Cross-Build Injection (XBI) Attacks.

    The idea of XBI is that you trick the developer and replace parts of their code with your code, thereby getting your code to be trusted by the developer.

    Maven Jenkins Created Mon, 01 Oct 2012 00:00:00 +0000
  • Hamlet: … for there is nothing either good or bad, but thinking makes it so.

    Hamlet Act 2, scene 2, 239–251

    William Shakespeare

    The Apache Software Foundation is a meritocracy. By this we mean that you gain status based on the merit of your work and actions. In fact the status that you gain is a recognition of the merit of your work and actions.

    Maven is an Apache project, that means that we have to follow the Apache rules and way. One of those rules is that we cannot hand out commit access to anyone who asks for it.

    Maven Created Sun, 01 Jul 2012 00:00:00 +0000
  • Cmd+Shift+4 followed by Space is a lovely way to get a screen shot of a window on an Apple Mac…

    In fact here is one such screenshot:

    Notice the nice shadow effect around the screenshot? Ever wanted to add that shadow effect to your non-mac screenshots?

    ImageMagick is your friend

    convert NoShadowScreenshot.png ( +clone -background black -shadow 80x20+0+15 ) +swap -background transparent -layers merge +repage WithShadowScreenshot.png

    There you are, nice equivalent shadow added.

    Created Sat, 01 Oct 2011 00:00:00 +0000
  • With Java Generics, it can be useful to insert wildcards wherever possible, but how do you decide which wildcard is correct? When do you use ? super T, ? extends T and when should you not use a wildcard at all.

    The Get and Put principle: Use an extends wildcard when you only get values from the structure. Use a super wildcard when you only put values into the structure. Don’t use a wildcard when you both get and put values from/into the structure.

    Created Sat, 01 Oct 2011 00:00:00 +0000
  • Book review: “EJB 3.1 Cookbook” by Richard M. Reese

    Review

    The kind people at Packt gave me a copy of “EJB 3.1 Cookbook” by Richard M. Reese to review. This book should be viewed as a collection of building block recipes, not as a collection of meal plans, and not as a how to cook book that you would read from cover to cover. When I look at the book from this point of view, I think that it is well structured and put together and the content is pitched just about right. This book does not tell you when to use a specific recipe, so it would be a mistake to think that this is the only book you would need for EJB 3.1. However, when you need a “Béchamel sauce”, this is a book that you can go to, quickly find and open up the right section and read the recipe to refresh your mind and get cooking.

    Created Mon, 01 Aug 2011 00:00:00 +0000
  • Java has a couple of “nice” features, specifically:

    Built-in locks

    Baked in support for object serialization

    Now I don’t want to get into a war about how both of these are flawed (there was a reason that I put “nice” in quotes) but here is a quick note on how to make the two play nice (more as a reference to myself… but if others find this useful, well and good).

    Created Mon, 01 Aug 2011 00:00:00 +0000
  • There has been this idea running around the back of my head for a while, and it’s only now that it is starting to crystalize into something that I can express.

    When we look at Open Source projects, we see that there is a hierarchy of involvement. There are different levels at which you can be involved, and at each higher level, there will be less and less individuals. For now I am going to divide involvement up like this:

    Created Mon, 01 Aug 2011 00:00:00 +0000