Visual Path Finding

Visual Path Finding

PathFinding.js.

Advertisements

Using In Clause with MyBatis and Scala

Had a bit of struggle to get this to work, logging the solution here so that it will be helpful to someone else. I am using Scala 2.9.1 and mybatis-scala-core 1.0.0.

val findOpenGroups = new SelectListBy[GroupIds,Group] {
def xsql = SELECT h.xxxxxx AS id,
h.xxxxxx AS launchedDate
FROM USA_xxxx_xxxx_xxxx h
WHERE h.new_status = 'Open'
AND h.id IN
<foreach item="item" collection="ids" open="(" separator="," close=")"> 
                {"#{item}"}
            </foreach> 
}

GroupIds is a simple class, just make sure you are using the java.util.List.

class GroupIds(val ids:java.util.List[Int]){}

UPDATE
Frank Martínez pointed out to me that you can also do {"item" ?} instead of {"#{item}"} but you will need to import org.mybatis.scala.mapping.Binding._ Thanks Frank.

Neo4j: Running Embedded Server with WebConsole

Took me couple of hours to figure this out so blogging it, hopefully it helps someone else.

If you are running Neo4j in embedded mode, you can still get the web console, data browser and other goodies, they do mention this in the manual but what they don’t mention is that you will need 2 extra jars to do this neo4j-server.jar and neo4j-server-static-web.jar and these are not available on neo’s repo, so you will have to clone their source from git and build it locally.

Add them to your pom.xml

<dependency>
  <groupId>org.neo4j.app</groupId>
  <artifactId>neo4j-server</artifactId>
  <version>1.5.M01</version>
</dependency>
<dependency>
 <groupId>org.neo4j.app</groupId>
 <artifactId>neo4j-server</artifactId>
 <version>1.5.M01</version>
 <classifier>static-web</classifier>
</dependency>

Notice the “classifier” in the above code. Below is the code for how you would start it.

EmbeddedGraphDatabase db = new EmbeddedGraphDatabase(<path>);
bootstrapper = new WrappingNeoServerBootstrapper(db);
bootstrapper.start();

UPDATE
Once you get the web console you will be able to run Cypher queries but not Gremlin, to be able to run Gremlin queries too include it into your classpath.

<dependency>
        <groupId>com.tinkerpop</groupId>
	<artifactId>gremlin</artifactId>
	<version>1.3</version>
	<type>jar</type>
	<exclusions>
		<!-- Sail support not needed -->
		<exclusion>
			<groupId>com.tinkerpop.blueprints</groupId>
			<artifactId>blueprints-sail-graph</artifactId>
		</exclusion>
		<!-- Maven support in groovy not needed -->
		<exclusion>
			<groupId>org.codehaus.groovy.maven</groupId>
			<artifactId>gmaven-plugin</artifactId>
		</exclusion>
		<!-- "readline" not needed - we only expose gremlin through webadmin -->
		<exclusion>
			<groupId>jline</groupId>
			<artifactId>jline</artifactId>
		</exclusion>
	</exclusions>
</dependency>

Not impressed with Lion

Been using OS X Lion @ home for a couple of weeks and I am not impressed. Tiger (which I use for work) feels clean and light gets out of your way almost like a waiter that keeps your glass full without you ever noticing.

Lion on the other hand feels like a needy high maintenance girlfriend that tries to grab your attention all the time. Really do I need my emails thrown on a pile ? Why do I need a grey background for my email to show a thread (good thing I have a 17 inch screen). And why does my calendar have to look like an old leather binder ? With a look of torn pages on top ? Why does my $2000 mac be reduced to look like this ? And the pop up dialog boxes feel like they are going to fly off the screen and hit me in the face. Feels more clunky and resource intensive. And come on why does my terminal have a busy icon on the top ? What the heck is it doing ? I am not even typing anything. By the way Apple there is something called oh I don’t know ‘history’ in the shell that tells me what I did before I don’t need you to remember and show it to me every time I reopen a terminal.

You know what this reminds me off ? The transition from Win ’98 to XP, oh Snap!

Maven Integration Tests

Ever forget to add @Ignore to your integration test and have the rest of the team complain or create a different project just to hold the integration tests, well no more.

With the maven failsafe plugin, you no longer need to ignore your integration tests. This plugin will pick up any tests that have *IT*.java in them and run it for you.

Continue to run you regular tests with ‘mvn clean install’, if you want to run your integration test run ‘mvn failsafe:integration-test  failsafe:verify’

Don’t forget to remove the @Ignore and rename your tests to *IT.java.