This file contains 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 java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; |
This file contains 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 tt) | |
(defn deduct-money-from-accnt | |
[a1-ref a2-ref {:keys [ensure1 ensure2]}] | |
(dosync | |
(when ensure1 (ensure a1-ref)) | |
(when ensure2 (ensure a2-ref)) | |
(let [sum (- (+ @a1-ref @a2-ref) 200)] | |
(when (>= sum 0) |
This file contains 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
(dotimes [_ 10] | |
(let [a (ref -100) | |
f1 (future (dosync (println "Trying T1") | |
(if (= @a 10) | |
(ref-set a @a) | |
(do (Thread/sleep 4000) | |
(println "Done T1"))))) | |
_ (Thread/sleep 1000) | |
f2 (future (dosync (println "Trying T2") | |
(ref-set a 15)))] |
This file contains 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 with-login-check | |
[handler] | |
(fn [request] | |
(if (logged-in? request) | |
(handler request) | |
{:status 403 | |
:headers {"Content-Type" "text/xml"} | |
:body "<forbidden/>"}))) | |
(defn create-routes [] |
This file contains 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 a) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defn clj-mk-ref | |
[data] | |
(ref {:version 0 | |
:data data})) | |
(defn clj-sync-write |
This file contains 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
/* | |
* expression_evaluator.cpp | |
* | |
* Created on: Mar 13, 2011 | |
* Author: ka | |
*/ | |
#define BOOST_SPIRIT_QI_DEBUG | |
#include <boost/config/warning_disable.hpp> |
This file contains 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 java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
class AProp implements Comparable<AProp>{ | |
private final int a; | |
public AProp(int a){ | |
this.a = a; | |
} | |
@Override | |
public int compareTo(AProp other) { |
This file contains 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- print-map [m print-one w] | |
(#'clojure.core/print-sequential | |
"{" | |
(fn [e ^java.io.Writer w] | |
(do (print-one (key e) w) (.append w " ") (print-one (val e) w))) | |
", " | |
"}" | |
(seq m) w)) |
This file contains 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
package com.mxgraph.examples.swing; | |
import javax.swing.JFrame; | |
import com.mxgraph.layout.mxGraphLayout; | |
import com.mxgraph.layout.mxOrganicLayout; | |
import com.mxgraph.swing.mxGraphComponent; | |
import com.mxgraph.view.mxGraph; | |
@SuppressWarnings("serial") |
This file contains 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 java.util.Random; | |
import java.util.concurrent.*; | |
import lombok.Memoize; | |
public class MemoizeTest { | |
@Memoize | |
public static int test(final int k){ | |
System.out.println("test " + k); | |
return k+2; |
OlderNewer