This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use 'clojure.set) | |
(def new-roles #{{:id 3 :name "pmo"} {:id 2 :name "engineer"} {:id 5 :name "pa"} {:id 1 :name "contributor"}}) | |
(def existing-roles #{{:id 5 :name "pa"} {:id 0 :name "guest"}}) | |
(defn updated-new-roles [nr er] | |
(into (difference nr er) (intersection er nr))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; A CS Research Topic Generator | |
;; in clojure based on: | |
;; http://www.cs.purdue.edu/homes/dec/essay.topic.generator.html | |
(ns com.alenribic.topic-generator | |
(:use [clojure.contrib.str-utils :only (str-join)] | |
[clojure.contrib.seq-utils :only (rand-elt)])) | |
(defn compute-article | |
[word capitalize?] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns com.myapp.service.web | |
(:gen-class) | |
(:use [compojure] | |
[compojure.http response]) | |
(:import [org.springframework.web.context ContextLoaderListener] | |
[org.springframework.web.context.support | |
WebApplicationContextUtils] | |
[com.myapp.core.model Label])) | |
(defn test-create-label [request] | |
(do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn test-create-label [request] | |
(do | |
(let [spring-ctx | |
(WebApplicationContextUtils/getWebApplicationContext (request :servlet-context)) | |
label-dao (.getBean spring-ctx "labelDao") | |
new-label (doto (new Label) | |
(.setName "Label 1") | |
(.setDescription "testing"))] | |
(.create label-dao new-label) | |
(.read label-dao (.getId new-label))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xmlns:jee="http://www.springframework.org/schema/jee" | |
xmlns:util="http://www.springframework.org/schema/util" | |
xmlns:tx="http://www.springframework.org/schema/tx" | |
xmlns:aop="http://www.springframework.org/schema/aop" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> | |
... | |
<filter> | |
<filter-name>lazyLoadingFilter</filter-name> | |
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR log - / | |
org.hibernate.SessionException: Session is closed! | |
at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72) | |
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:558) | |
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550) | |
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546) | |
at com.billdozr.core.persist.dao.impl.GenericDaoHibernateImpl.create(GenericDaoHibernateImpl.java:47) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.myapp.core.persist.dao.GenericDao; | |
import com.myapp.core.persist.dao.finder.FinderArgumentTypeFactory; | |
import com.myapp.core.persist.dao.finder.FinderExecutor; | |
import com.myapp.core.persist.dao.finder.FinderNamingStrategy; | |
import com.myapp.core.persist.dao.finder.impl.SimpleFinderArgumentTypeFactory; | |
import com.myapp.core.persist.dao.finder.impl.SimpleFinderNamingStrategy; | |
import org.hibernate.Query; | |
import org.hibernate.Session; | |
import org.hibernate.SessionFactory; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn test-create-label [request] | |
(let [spring-ctx | |
(WebApplicationContextUtils/getWebApplicationContext (request :servlet-context)) | |
label-dao (.getBean spring-ctx "labelDao") | |
new-label (Label.)] | |
(doto new-label | |
(.setName "Label 1") | |
(.setDescription "testing")) | |
(.create label-dao new-label) | |
(.read label-dao (.getId new-label)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/compojure/http/middleware.clj b/src/compojure/http/middleware.clj | |
index eb0c276..b79e544 100644 | |
--- a/src/compojure/http/middleware.clj | |
+++ b/src/compojure/http/middleware.clj | |
@@ -32,9 +32,9 @@ | |
existing headers." | |
[handler headers] | |
(fn [request] | |
- (let [response (handler request) | |
- merged-headers (merge (:headers response) headers)] |
OlderNewer