Skip to content

Instantly share code, notes, and snippets.

@ctataryn
ctataryn / gist:1373562
Created November 17, 2011 16:16
sbt probs
import sbt._
import Keys._
import com.github.siasia.WebPlugin
object Build extends sbt.Build {
import Dependencies._
lazy val myProject = Project(
"billratecalc",
file("."),
@ctataryn
ctataryn / gist:1394605
Created November 25, 2011 22:51
Korma H2
(ns quadbot.persistence
(:use [korma.db])
(:use [korma.core])
(:use [clojure.test]))
(defdb mydb {:classname "org.h2.Driver"
:subprotocol "h2"
:subname "jdbc:h2:~/test"
:user "sa"
:password ""})
@ctataryn
ctataryn / gist:1394615
Created November 25, 2011 22:57
Korma Stacktrace
quadbot.client=> (use 'quadbot.persistence :reload-all)
nil
quadbot.client=> (insert-select)
WARN com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2 20111125 165018,291 com.mchange.v2.resourcepool.BasicResourcePool ] com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1bfa1ba1 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
org.h2.jdbc.JdbcSQLException: Error opening database: "Could not load properties /Users/craiger/src/OSS/quadbot/h2:~/test.lock.db" [8000-161]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.store.FileLock.getExceptionFatal(FileLock.java:431)
at org.h2.store.FileLock.load(FileLock.java:261)
at org.h2.store.FileLock.checkServer(FileLock.java:214)
@ctataryn
ctataryn / gist:1395874
Created November 26, 2011 15:39
Clojure Map problem
quadbot.client=> (use 'quadbot.persistence :reload-all)
nil
quadbot.client=> (def ident (invoke-with-connection insert-users2))
#'quadbot.client/ident
quadbot.client=> (println ident)
{:SCOPE_IDENTITY() 29}
nil
quadbot.client=> (:SCOPE_IDENTITY() ident)
{:SCOPE_IDENTITY() 29}
quadbot.client=> (first ident)
@ctataryn
ctataryn / gist:1401486
Created November 28, 2011 18:46
Clojure Create Tables
(ns my.ns
(:use [korma.db])
(:use [korma.core])
(:require [clojure.java.jdbc :as sql]))
(def dbspec {:classname "org.h2.Driver"
:subprotocol "h2"
:subname "~/db/myapp"
:user "sa"
:password ""})
@ctataryn
ctataryn / git-svn-cheatsheet.txt
Created November 29, 2011 17:35
git-svn cheat sheet
#to INSTALL: download source and type checkinstall -D instead of make install
sudo checkinstall -D
#if you want an entire repo with *all history*
git-svn clone https://my.server/repo/myproj/trunk
###### if you want only a subset of history #########
#initialize a working folder to be used with git-svn
git-svn init https://my.server/repo/myproj/trunk
@ctataryn
ctataryn / gist:1641475
Created January 19, 2012 18:02
null filter
[ ============= WSDL ================]
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://ws.mlc.mb.ca/playerManagement/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="playerManagement"
targetNamespace="http://ws.mlc.mb.ca/playerManagement/">
<wsdl:types>
<xsd:schema targetNamespace="http://ws.mlc.mb.ca/playerManagement/" xmlns:pm="http://ws.mlc.mb.ca/playerManagement/">
<xsd:element name="wsPlayer">
@ctataryn
ctataryn / gist:1672199
Created January 24, 2012 19:56
Aggregate Entities
@Entity(name="Player")
public class PlayerImpl implements Player {
@Id
@Column(name="PlayerId")
private Integer id = -1;
private PersonName name = new PersonNameImpl();
.
.
.
}
@ctataryn
ctataryn / gist:1672625
Created January 24, 2012 21:01
JPA Interface problem...
@Entity(name = "Player")
public class PlayerImpl implements Player {
@Id
@Column(name = "PlayerId")
private Integer id = -1;
@Embedded
private PersonName name; //to get this to work, I have to re-type this as PersonNameImpl and cast in the setter
public PersonName getName() {
@ctataryn
ctataryn / gist:1684974
Created January 26, 2012 20:42
CXF Client
@Test
public void testRetrieveById() {
//uses the localhost:8080/PlayerManagement address from the WSDL <soap:address> element
PlayerManagement client = new PlayerManagement_Service().getPlayerManagementSOAP();
WsPlayer player = client.retrievePlayerById(1);
assertNotNull(player);
assertEquals("Dollie", player.getFirstName());
}