Local javac path issues on older OpenShift WildFly8.2 based project

I have an app that I created a few months back on OpenShit based on the WildFly 8.2 cartridge. Locally in Eclipse the project builds and compiles fine, but executing mvn directly or in Netbeans (which also builds using your mvn pom.xml), it fails with an error regarding a path to javac:

-------------------------------------------------------------
COMPILATION ERROR : 
-------------------------------------------------------------
Failure executing javac, but could not parse the error:
/bin/sh: ${env.OPENSHIFT_WILDFLY_DIR}usr/lib/jvm/jdk1.8.0_05/bin/javac: bad substitution
1 error

This is obviously setup for building specifically in the OpenShift environment with this property defining the path to javac:

<maven.compiler.executable>${env.OPENSHIFT_WILDFLY_DIR}usr/lib/jvm/jdk1.8.0_05/bin/javac</maven.compiler.executable>

There’s a few posts and discussions about this (e.g. here and I suspect this is related), but I’m guessing the version of the pom.xml I have is older and been changed recently. I created a new OpenShift WildFly based project to compare the created pom.xml, and these two properties are no longer in the pom.xml file:

<maven.compiler.executable>${env.OPENSHIFT_WILDFLY_DIR}usr/lib/jvm/jdk1.8.0_05/bin/javac</maven.compiler.executable>
<maven.compiler.fork>true</maven.compiler.fork>

Removing them fixes my local builds, and pushing the code to OpenShift still seems to build ok too.

Mounting Linux ext partitions on OS X

I wanted to check some files on an SD Card formatted in ext that I had used on my Pi and wanted to check if I had left some files in the home dir before I reimaged it. OS X doesn’t support ext formatted drives by default, but you add support using OSXFuse.

  • Install Fuse for OS X
  • Install the ext plugin for Fuse
  • Find the partition you want to mount with: diskutil list
  • Make a mount point – not sure on Mac OS X where is the best place, but I added /mnt/sdcard
  • Mount with:


    [code]sudo fuse-ext2 /dev/disk1s2 /mnt/sdcard[/code]

  • (replace with the /dev/ to your device)

I’m not sure if it’s best practice on the Mac to mount with sudo, but this worked for me for what I needed to do. Fuse mounts on ext are r/o by default, but there is experimental r/w support that can be enabled, check the docs.

Done!

Sometimes the simplest solutions are the best solutions

How many times have you seen or written code like this (in any language):

[code]
if(someFlag){
someFlag = false;
}
else{
someFlag = true;
}
[/code]

I’ve written code myself like this many times, and seen it in many places too. Usually for toggling display of some content: “if it’s hidden, show it; otherwise, hide it”.

Recently I’ve been spending a lot of time learning and coding an app using AngularJS and I keep seeing this pattern repeatedly in many code examples:

[code]

someFlag = !someFlag;

[/code]

When I first saw a statement like this it took me a couple of seconds to understand the purpose, but then when it clicked I laughed out loud in one of those ‘ahah!’ moments, as the outcome of this code is exactly the same as the code above.

When we translate design to code, sometimes thinking in logical, procedural steps hurts the ability to translate to code that best uses the features of the language or platform that you are running on. Sometimes the simplest solutions really are the best solutions, although maybe it takes a different thought process to get there.