add perf benchmarks for single vs many rows

--- perf/asphalt/test/perf.clj
+++ perf/asphalt/test/perf.clj
@@ -93,8 +93,8 @@
              (a/update conn r-delete nil))))))))

-(deftest bench-select
-  (testing "Select row"
+(deftest bench-select-one
+  (testing "Select one row"
     (let [data {:name "Joe Coder"
                 :salary 100000
                 :dept "Accounts"}]
@@ -103,15 +103,41 @@
       ;; bench c.j.j normal with asphalt
       (jdbc/with-db-connection [db-con db-spec]
         (i/with-connection [conn u/orig-ds]
-          (c/compare-perf "select-row"
-            (jdbc/query db-con [s-select])
-            (a/query a/fetch-rows conn s-select nil)
-            (a/query a/fetch-rows conn t-select nil)
-            (a/query a/fetch-rows conn r-select nil))))
+          (c/compare-perf "select-single-row-as-map"
+            (first (jdbc/query db-con [s-select]))
+            (first (a/query a/fetch-maps conn s-select nil))
+            (first (a/query a/fetch-maps conn t-select nil))
+            (first (a/query a/fetch-maps conn r-select nil)))))
       ;; bench c.j.j `:as-arrays? true` with asphalt
       (jdbc/with-db-connection [db-con db-spec]
         (i/with-connection [conn u/orig-ds]
-          (c/compare-perf "select-row-as-arrays"
+          (c/compare-perf "select-single-row-as-vector"
+            (first (jdbc/query db-con [s-select] {:as-arrays? true}))
+            (a/query a/fetch-single-row conn s-select nil)
+            (a/query a/fetch-single-row conn t-select nil)
+            (a/query a/fetch-single-row conn r-select nil)))))))
+
+
+(deftest bench-select-many
+  (testing "Select many rows"
+    (let [data {:name "Joe Coder"
+                :salary 100000
+                :dept "Accounts"}]
+      (i/with-connection [conn u/orig-ds]
+        (dotimes [i 100]
+          (a/update conn t-insert data)))
+      ;; bench c.j.j normal with asphalt
+      (jdbc/with-db-connection [db-con db-spec]
+        (i/with-connection [conn u/orig-ds]
+          (c/compare-perf "select-many-rows-as-maps"
+            (jdbc/query db-con [s-select])
+            (a/query a/fetch-maps conn s-select nil)
+            (a/query a/fetch-maps conn t-select nil)
+            (a/query a/fetch-maps conn r-select nil))))
+      ;; bench c.j.j `:as-arrays? true` with asphalt
+      (jdbc/with-db-connection [db-con db-spec]
+        (i/with-connection [conn u/orig-ds]
+          (c/compare-perf "select-many-rows-as-vectors"
             (jdbc/query db-con [s-select] {:as-arrays? true})
             (a/query a/fetch-rows conn s-select nil)
             (a/query a/fetch-rows conn t-select nil)


add install native task

add install native task

--- src/cake/tasks/compile.clj
+++ src/cake/tasks/compile.clj
@@ -2,8 +2,9 @@
   (:use cake cake.core cake.ant cake.file
         [cake.project :only [verbose? debug? log]]
         [cake.utils.find-namespaces :only [find-clojure-sources-in-dir read-file-ns-decl]]
-        [cake.utils :only [os-name os-arch]]
-        [cake.utils.useful :only [pluralize]])
+        [cake.utils :only [os-name os-arch sudo]]
+        [cake.utils.useful :only [pluralize]]
+	[cake.ant :only [fileset-seq]])
   (:import [org.apache.tools.ant.taskdefs Copy Javac Java]))

 (defn compile-java [src]
@@ -77,3 +78,8 @@
 ;; add actions to compile-native if you need to compile native libraries
 ;; see http://github.com/lancepantz/tokyocabinet for an example
 (deftask compile-native)
+
+(deftask install-native
+  (let [files (vec (map str (fileset-seq {:dir (file "lib" "native")
+					  :includes "*"})))]
+    (apply sudo "cp" (conj files "/usr/local/lib/"))))


nicer docs and map-key extraction

nicer docs and map-key extraction

--- src/celestial/provider.clj
+++ src/celestial/provider.clj
@@ -12,6 +12,7 @@
 (ns celestial.provider
   "common providers functions"
     (:require
+      [flatland.useful.map :refer (dissoc-in*)]
       [subs.core :refer (validation when-not-nil)]
       [supernal.sshj :refer (ssh-up?)]
       [celestial.model :refer (hypervisor)]
@@ -44,7 +45,7 @@
      (apply juxt (map select kys)))))

 (defn os->template
-  "Os key to vmware template"
+  "Os key to template/VM/image"
   [hyp]
   (fn [os]
     (let [ks [hyp :ostemplates os]]
@@ -80,6 +81,9 @@
                (catch Throwable e false))
             {:type ::ssh-failed :timeout timeout} "Timed out while waiting for ssh"))

+(defn map-key [m from to]
+  (dissoc-in* (assoc-in m to (get-in m from)) from))
+
 ; common validations
 (validation :ip
     (when-not-nil (partial re-find #"\d+\.\d+\.\d+\.\d+") "must be a legal ip address"))


Revert "skip trasact! for speed"

Revert "skip trasact! for speed"

This reverts commit 0b2e02607ea2f495f9ec6b676cd77e665eeffdc9.

--- src/chat/client/store.cljs
+++ src/chat/client/store.cljs
@@ -182,8 +182,8 @@
 (defn set-new-message!
   [thread-id content]
   (if (get-in @app-state [:threads thread-id])
-    (swap! app-state assoc-in [:threads thread-id :new-message] content)
-    (swap! app-state assoc-in [:new-thread-msg thread-id] content)))
+    (transact! [:threads thread-id :new-message] (constantly content))
+    (transact! [:new-thread-msg thread-id] (constantly content))))

 (defn add-message! [message]
   (maybe-create-thread! (message :thread-id))


determine-org-settings-subpage shouldn't lead to the plan page.

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -214,11 +214,11 @@
              (= subpage :plan))
         :containers

-        ;; Redirect :containers, :organizations, :billing, and :cancel to the overview page
+        ;; Redirect :organizations, :billing, and :cancel to the overview page
         ;; for piggiebacked plans.
         (and plan
              (not (pm/can-edit-plan? plan org-name))
-             (#{:containers :organizations :billing :cancel} subpage))
+             (#{:organizations :billing :cancel} subpage))
         :overview

         :else subpage))


update ws-ldn-3

update ws-ldn-3

--- src/thi/ng/site/workshop/core.cljs
+++ src/thi/ng/site/workshop/core.cljs
@@ -16,13 +16,13 @@
     :audience "Beginner/intermediate embedded device programming"
     :capacity 6
     :id       "WS-LDN-3"
-    :price    "£350.00 (+ 20% VAT in UK only), incl. STM32F40x discovery board"
+    :price    "£200.00 (+ 20% VAT in UK only), incl. STM32F401 discovery board"
     :topics   ["ARM Cortex-M overview" "Embeded C programming with Eclipse & GCC toolchain" "Debugging" "STM Hardware Abstraction Layer" "GPIO" "Multitasking & interrupts" "USB device basics" "Digital Audio & DSP fundamentals" "MIDI over USB" "Music theory" "Generative music techniques"]
     :shopify  {:store    "thi-ng-store.myshopify.com"
                :product  "DIY Synth: Getting started with bare-metal ARM programming"
                :handle   "diy-synth-getting-started-with-bare-metal-arm-programming"
                :cart     "7746648005:1"
-               :discount {:id "EARLY-LDN-3" :percent "15%" :num 3}}
+               :discount nil #_{:id "WS-LDN-3-LATE" :percent "50%"}}
     :extras   [:div
                [:p "Work-in-progress sound samples: " [:a {:href "https://soundcloud.com/forthcharlie/sets/stm32f4"} "soundcloud.com/forthcharlie/sets/stm32f4"]]
                [:iframe
@@ -114,7 +114,7 @@
             [:tr
              [:th "Discount:"]
              [:td.discount
-              (:percent disc) " off for first " (:num disc) " participants"
+              (:percent disc) " off" (if-let [n (:num disc)] (str " for first " num " participants"))
               [:br] "Checkout code: " [:strong (:id disc)]]]))
         [:tr [:th] [:td (if (:soldout ws) [:strong "SOLD OUT"] [shopify-button (:shopify ws)])]]]]
       (:extras ws)]


Refactors Power Counters.

Refactors Power Counters.

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -18,6 +18,12 @@
    :msg "give the Runner 1 tag"
    :effect (effect (tag-runner :runner 1))})

+(def add-power-counter
+  "Adds 1 power counter to the card."
+  {:label "Add 1 power counter"
+   :msg "add 1 power counter"
+   :effect (effect (add-prop card :counter 1))})
+
 (defn trace-ability
   "Run a trace with specified base strength.
    If successful trigger specified ability"
@@ -50,6 +56,13 @@
   {:label (str "Gain " credits " [Credits]")
    :msg (str "gain " credits " [Credits]")
    :effect (effect (gain :credit credits))})
+
+(defn power-counter-ability
+  "Does specified ability using a power counter."
+  [{:keys [label msg] :as ability}]
+  (assoc ability :label (str "Hosted power counter: " label)
+                 :msg (str msg " using 1 power counter")
+                 :counter-cost 1))

 ;;; For Advanceable ICE
@@ -326,12 +339,8 @@

    "Data Raven"
    {:abilities [give-tag
-                {:msg "give the Runner 1 tag using 1 power counter"
-                 :counter-cost 1
-                 :effect (effect (tag-runner 1))}
-                (trace-ability 3 {:label "Add 1 power counter"
-                                  :msg "add 1 power counter"
-                                  :effect (effect (add-prop card :counter 1))})]}
+                (power-counter-ability give-tag)
+                (trace-ability 3 add-power-counter)]}

    "Dracō"
    {:prompt "How many power counters?"
@@ -566,12 +575,10 @@
    (morph-ice "Sentry" "Code Gate" trash-program)

    "Mamba"
-   {:abilities [(do-net-damage 1)
-                {:msg "do 1 net damage using 1 power counter"
-                 :counter-cost 1 :effect (effect (damage :net 1 {:card card}))}
+   {:abilities [(power-counter-ability (do-net-damage 1))
+                (do-net-damage 1)
                 {:msg "start a Psi game"
-                 :psi {:not-equal {:msg "add 1 power counter"
-                                   :effect (effect (add-prop :runner card :counter 1))}}}]}
+                 :psi {:not-equal add-power-counter}}]}

    "Markus 1.0"
    {:abilities [trash-installed end-the-run]}
@@ -746,16 +753,15 @@
    {:abilities [{:req (req (= current-ice card))
                  :label "Reveal all cards in the Runner's Grip"
                  :msg (msg "reveal " (join ", " (map :title (:hand runner))))}
-                (trace-ability 3 {:label "Place 1 power counter on Snoop"
-                                  :msg "place 1 power counter on Snoop"
-                                  :effect (effect (add-prop card :counter 1))})
                 {:req (req (> (:counter card 0) 0))
                  :counter-cost 1
                  :label "Hosted power counter: Reveal all cards in Grip and trash 1 card"
-                 :msg (msg "look at all cards in Grip and trash " (:title target))
+                 :msg (msg "look at all cards in Grip and trash " (:title target)
+                           " using 1 power counter")
                  :choices (req (:hand runner))
                  :prompt "Choose a card to trash"
-                 :effect (effect (trash target))}]}
+                 :effect (effect (trash target))}
+                (trace-ability 3 add-power-counter)]}

    "Snowflake"
    {:abilities [{:msg "start a Psi game"
@@ -858,12 +864,8 @@
                 end-the-run]}

    "Viktor 2.0"
-   {:abilities [{:msg "do 1 brain damage using 1 power counter"
-                 :counter-cost 1
-                 :effect (effect (damage :brain 1 {:card card}))}
-                (trace-ability 2 {:label "Add 1 power counter"
-                                  :msg "add 1 power counter"
-                                  :effect (effect (add-prop card :counter 1))})
+   {:abilities [(power-counter-ability (do-brain-damage 1))
+                (trace-ability 2 add-power-counter)
                 end-the-run]}

    "Viper"


Add ability to run server on custom port.

--- src/clj/quil_site/core.clj
+++ src/clj/quil_site/core.clj
@@ -29,8 +29,8 @@
       json/wrap-json-response
       stacktrace/wrap-stacktrace))

-(defn run []
-  (run-jetty handler {:port 8080}))
+(defn run [port]
+  (run-jetty handler {:port (Integer/parseInt port)}))

 (comment


Use transaction when delete a file

Use transaction when delete a file

--- src/clj/salava/file/db.clj
+++ src/clj/salava/file/db.clj
@@ -1,11 +1,12 @@
 (ns salava.file.db
   (:require [slingshot.slingshot :refer :all]
+            [clojure.java.jdbc :as jdbc]
             [clojure.java.io :as io]
             [clojure.string :refer [split blank?]]
             [yesql.core :refer [defqueries]]
             [salava.core.i18n :refer [t]]
             [salava.core.helper :refer [dump]]
-            [salava.core.util :refer [get-db map-sha256]]))
+            [salava.core.util :refer [get-db get-datasource map-sha256]]))

 (defqueries "sql/file/queries.sql")

@@ -40,18 +41,24 @@
   (let [usage (file-usage ctx path)
         data-dir (get-in ctx [:config :core :data-dir])
         full-path (str data-dir "/" path)]
-    (if-not (and data-dir (.exists (io/as-file full-path)))
-      (throw+ "File does not exist"))
-    (if (= usage 0)
+    (if (empty? data-dir)
+      (throw+ "Data directory does not exist"))
+    (if (and (= usage 0) (.exists (io/as-file full-path)))
       (io/delete-file full-path))))
+
+(defn remove-file-with-db! [db file-id]
+  (delete-file! {:id file-id} db)
+  (delete-file-tags! {:file_id file-id} db)
+  (delete-files-block-file! {:file_id file-id} db))

 (defn remove-user-file! [ctx file-id user-id]
   (try+
     (let [{:keys [owner path]} (select-file-owner-and-path {:id file-id} (into {:result-set-fn first} (get-db ctx)))]
       (if-not (= owner user-id)
         (throw+ "Current user is not owner of the file"))
-      (delete-file! {:id file-id} (get-db ctx))
-      (delete-files-block-file! {:file_id file-id} (get-db ctx))
+      (jdbc/with-db-transaction
+        [tr-cn (get-datasource ctx)]
+        (remove-file-with-db! {:connection tr-cn} file-id))
       (remove-file! ctx path)
       {:status "success" :message (t :file/Filedeleted) :reason (t :file/Filedeleted)})
     (catch Object _


Field hiding on the add/edit page.

Field hiding on the add/edit page.

--- src/cljs/bookmarx/add.cljs
+++ src/cljs/bookmarx/add.cljs
@@ -10,16 +10,18 @@
             [cljs.core.async :refer [<!]]
             [bookmarx.header :as header]))

-(defn row [label input]
+(defn row
+  [label input]
   [:div.row
    [:div.col-md-2 ^{:key label} [:label label]]
    [:div.col-md-5 ^{:key input} input]])

 (def form-template
   [:div
-   [row "Folder?" [:input.form-control {:field :checkbox :id :folder?}]]
+   [:div {:field :container :visible? #(:add? %)}
+    [row "Folder?" [:input.form-control {:field :checkbox :id :folder?}]]]
    [row "Name" [:input.form-control {:field :text :id :bookmark/name}]]
-   [:div {:field :container :visible? #(:folder? %)}
+   [:div {:field :container :visible? #(not (:folder? %))}
      [row "URL" [:input.form-control {:field :text :id :bookmark/url}]]
      [row "Rating" [:input.form-control {:field :text :id :bookmark/rating}]]
    ]])
@@ -34,5 +36,5 @@
   []
   [:div {:class "col-sm-12"}
    [header/header]
-   (let [doc (if (session/get :add) (atom (session/get :add)) (atom {}))]
+   (let [doc (if (session/get :add) (atom (session/get :add)) (atom {:add? true}))]
      [editor doc [bind-fields form-template doc]])])


Make dummy-data larger

Make dummy-data larger

--- src/cljs/kulive/model.cljs
+++ src/cljs/kulive/model.cljs
@@ -4,7 +4,7 @@
             [re-frame.core :as re-frame])
   (:require-macros [reagent.ratom  :refer [reaction]]))

-(def dummy-data {"DISS352-00" {:kr {:professor "이지수", :r false, :number "DISS352-00", :name " 국제법특강I(영강)", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :schedule ["화(1) 국제관322" "\n목(1) 국제관322"], :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=3928&dept_cd=3931&cour_cd=DISS352&cour_cls=00&cour_nm=국제법특강I(영강)"}, :en {:professor nil, :schedule ["Tue(1) 138-322" "\nThu(1) 138-322"], :r false, :number "DISS352-00", :name "SPECIAL TOPICS IN INTERNATIONAL LAW I(English)", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=3928&dept_cd=3931&cour_cd=DISS352&cour_cls=00&cour_nm=SPECIAL TOPICS IN INTERNATIONAL LAW I(English)"}},"EDBA231-02" {:kr {:professor "박철", :r true, :number "EDBA231-02", :name " 마케팅원론", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :schedule ["월(9) 33-221" "\n목(1-2) 33-325"], :x true, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0293&dept_cd=4633&cour_cd=EDBA231&cour_cls=02&cour_nm=마케팅원론"}, :en {:professor "Cheol Park", :r true, :number "EDBA231-02", :name "PRINCIPLES OF MARKETING", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :schedule ["Mon(9) 33-221" "\nThu(1-2) 33-325"], :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0293&dept_cd=4633&cour_cd=EDBA231&cour_cls=02&cour_nm=PRINCIPLES OF MARKETING"}},"KFBT253-00" {:kr {:professor "김영준", :r true, :number "KFBT253-00", :name " 세포생물학", :w false, :l false, :classification "기본전공선택 ", :credit-hours "3(  3)", :schedule ["수(3-4) 7-217" "\n목(4) 9-615A"], :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4554&cour_cd=KFBT253&cour_cls=00&cour_nm=세포생물학"}, :en {:professor "Young Jun Kim", :r true, :number "KFBT253-00", :name "CELL BIOLOGY", :w false, :l false, :classification "Basic Major", :credit-hours "3(  3)", :schedule ["Wed(3-4) 7-217" "\nThu(4) 9-615A"], :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4554&cour_cd=KFBT253&cour_cls=00&cour_nm=CELL BIOLOGY"}},"BUSS207-03" {:kr {:professor "김우찬", :r false, :number "BUSS207-03", :name " 재무관리(영강)", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :schedule ["화(1) 현차관B204" "\n목(1) 현차관B204"], :x false, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0140&dept_cd=0142&cour_cd=BUSS207&cour_cls=03&cour_nm=재무관리(영강)"}, :en {:professor "Kim, Woochan", :r false, :number "BUSS207-03", :name "FINANCIAL MANAGEMENT(English)", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :schedule ["Tue(1) 151-B204" "\nThu(1) 151-B204"], :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0140&dept_cd=0142&cour_cd=BUSS207&cour_cls=03&cour_nm=FINANCIAL MANAGEMENT(English)"}},"CHEM300-01" {:kr {:professor "이광렬", :r true, :number "CHEM300-01", :name " 전공심화연구I", :w false, :l false, :classification "전공선택 ", :credit-hours "3(  6)", :schedule [], :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0209&dept_cd=0213&cour_cd=CHEM300&cour_cls=01&cour_nm=전공심화연구I"}, :en {:professor "Kwangyeol Lee", :r true, :number "CHEM300-01", :name "UNDERGRADUATE ADVANCED RESEARCH I", :w false, :l false, :classification "Major Elective", :credit-hours "3(  6)", :schedule [], :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0209&dept_cd=0213&cour_cd=CHEM300&cour_cls=01&cour_nm=UNDERGRADUATE ADVANCED RESEARCH I"}}})
+(def dummy-data {"DISS352-00" {:kr {:professor "이지수", :schedule ["화(1) 국제관322" "\n목(1) 국제관322"], :r false, :number "DISS352-00", :name " 국제법특강I(영강)", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=3928&dept_cd=3931&cour_cd=DISS352&cour_cls=00&cour_nm=국제법특강I(영강)"}, :en {:professor nil, :schedule ["Tue(1) 138-322" "\nThu(1) 138-322"], :r false, :number "DISS352-00", :name "SPECIAL TOPICS IN INTERNATIONAL LAW I(English)", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=3928&dept_cd=3931&cour_cd=DISS352&cour_cls=00&cour_nm=SPECIAL TOPICS IN INTERNATIONAL LAW I(English)"}}, "EDBA231-02" {:kr {:professor "박철", :schedule ["월(9) 33-221" "\n목(1-2) 33-325"], :r true, :number "EDBA231-02", :name " 마케팅원론", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :x true, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0293&dept_cd=4633&cour_cd=EDBA231&cour_cls=02&cour_nm=마케팅원론"}, :en {:professor "Cheol Park", :schedule ["Mon(9) 33-221" "\nThu(1-2) 33-325"], :r true, :number "EDBA231-02", :name "PRINCIPLES OF MARKETING", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0293&dept_cd=4633&cour_cd=EDBA231&cour_cls=02&cour_nm=PRINCIPLES OF MARKETING"}}, "KFBT253-00" {:kr {:professor "김영준", :schedule ["수(3-4) 7-217" "\n목(4) 9-615A"], :r true, :number "KFBT253-00", :name " 세포생물학", :w false, :l false, :classification "기본전공선택 ", :credit-hours "3(  3)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4554&cour_cd=KFBT253&cour_cls=00&cour_nm=세포생물학"}, :en {:professor "Young Jun Kim", :schedule ["Wed(3-4) 7-217" "\nThu(4) 9-615A"], :r true, :number "KFBT253-00", :name "CELL BIOLOGY", :w false, :l false, :classification "Basic Major", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4554&cour_cd=KFBT253&cour_cls=00&cour_nm=CELL BIOLOGY"}}, "BUSS207-03" {:kr {:professor "김우찬", :schedule ["화(1) 현차관B204" "\n목(1) 현차관B204"], :r false, :number "BUSS207-03", :name " 재무관리(영강)", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :x false, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0140&dept_cd=0142&cour_cd=BUSS207&cour_cls=03&cour_nm=재무관리(영강)"}, :en {:professor "Kim, Woochan", :schedule ["Tue(1) 151-B204" "\nThu(1) 151-B204"], :r false, :number "BUSS207-03", :name "FINANCIAL MANAGEMENT(English)", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0140&dept_cd=0142&cour_cd=BUSS207&cour_cls=03&cour_nm=FINANCIAL MANAGEMENT(English)"}}, "CHEM300-01" {:kr {:professor "이광렬", :schedule [], :r true, :number "CHEM300-01", :name " 전공심화연구I", :w false, :l false, :classification "전공선택 ", :credit-hours "3(  6)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0209&dept_cd=0213&cour_cd=CHEM300&cour_cls=01&cour_nm=전공심화연구I"}, :en {:professor "Kwangyeol Lee", :schedule [], :r true, :number "CHEM300-01", :name "UNDERGRADUATE ADVANCED RESEARCH I", :w false, :l false, :classification "Major Elective", :credit-hours "3(  6)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0209&dept_cd=0213&cour_cd=CHEM300&cour_cls=01&cour_nm=UNDERGRADUATE ADVANCED RESEARCH I"}}, "ELED241-00" {:kr {:professor "황지연", :schedule ["화(2) 사대신관 124" "\n목(2) 사대신관 124"], :r true, :number "ELED241-00", :name " 영미아동문학강독(영강)", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0234&dept_cd=0241&cour_cd=ELED241&cour_cls=00&cour_nm=영미아동문학강독(영강)"}, :en {:professor "Ji Yeon Hwang", :schedule ["Tue(2) 110-124" "\nThu(2) 110-124"], :r true, :number "ELED241-00", :name "READINGS IN ENGLISH CHILDREN'S LITERATURE(English)", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0234&dept_cd=0241&cour_cd=ELED241&cour_cls=00&cour_nm=READINGS IN ENGLISH CHILDREN'S LITERATURE(English)"}}, "ENGL421-03" {:kr {:professor "이종임", :schedule ["화(5) 교양관 402" "\n목(5) 교양관 402"], :r true, :number "ENGL421-03", :name " 영미문학특수과제Ⅰ(영강)", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0146&cour_cd=ENGL421&cour_cls=03&cour_nm=영미문학특수과제Ⅰ(영강)"}, :en {:professor "Jong-Im Lee", :schedule ["Tue(5) 108-402" "\nThu(5) 108-402"], :r true, :number "ENGL421-03", :name "SPECIAL TOPICS IN BRITISH AND AMERICAN LITERATURE(English)", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0146&cour_cd=ENGL421&cour_cls=03&cour_nm=SPECIAL TOPICS IN BRITISH AND AMERICAN LITERATURE(English)"}}, "COSE496-00" {:kr {:professor "한정현", :schedule [], :r false, :number "COSE496-00", :name " 현장실습II", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  0)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5720&dept_cd=5722&cour_cd=COSE496&cour_cls=00&cour_nm=현장실습II"}, :en {:professor "HAN, JUNGHYUN", :schedule [], :r false, :number "COSE496-00", :name "INTERNSHIP PROGRAM II", :w false, :l true, :classification "Major Elective", :credit-hours "3(  0)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5720&dept_cd=5722&cour_cd=COSE496&cour_cls=00&cour_nm=INTERNSHIP PROGRAM II"}}, "LSSS471-00" {:kr {:professor "배상우", :schedule ["수(8-9) 33-324"], :r false, :number "LSSS471-00", :name " 스포츠이벤트실습(영강)", :w false, :l true, :classification "전공선택 ", :credit-hours "1(  2)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS471&cour_cls=00&cour_nm=스포츠이벤트실습(영강)"}, :en {:professor "Sang Woo Bae", :schedule ["Wed(8-9) 33-324"], :r false, :number "LSSS471-00", :name "SPORT EVENT FIELDWORK(English)", :w false, :l true, :classification "Major Elective", :credit-hours "1(  2)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS471&cour_cls=00&cour_nm=SPORT EVENT FIELDWORK(English)"}}, "KHSU230-00" {:kr {:professor "전옥희", :schedule ["금(1-2) 하나과학관 B117호"], :r true, :number "KHSU230-00", :name " 생화학", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4669&dept_cd=4893&cour_cd=KHSU230&cour_cls=00&cour_nm=생화학"}, :en {:professor "Ok-Hee Jeon", :schedule ["Fri(1-2) B117"], :r true, :number "KHSU230-00", :name "BIOCHEMISTRY", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4669&dept_cd=4893&cour_cd=KHSU230&cour_cls=00&cour_nm=BIOCHEMISTRY"}}, "CSIE309-02" {:kr {:professor "정용화", :schedule ["화(5-6) 7-324" "\n목(2) 7-310"], :r true, :number "CSIE309-02", :name " 알고리즘", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4548&cour_cd=CSIE309&cour_cls=02&cour_nm=알고리즘"}, :en {:professor "Yongwha Chung", :schedule ["Tue(5-6) 7-324" "\nThu(2) 7-310"], :r true, :number "CSIE309-02", :name "ALGORITHM", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4548&cour_cd=CSIE309&cour_cls=02&cour_nm=ALGORITHM"}}, "LING481-00" {:kr {:professor "김성도", :schedule ["화(5) 교육관307" "\n목(5) 교육관307"], :r true, :number "LING481-00", :name " 언어학특강I", :w false, :l false, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=4391&cour_cd=LING481&cour_cls=00&cour_nm=언어학특강I"}, :en {:professor "Kim Sung Do", :schedule ["Tue(5) 140-307" "\nThu(5) 140-307"], :r true, :number "LING481-00", :name "TOPICS IN LINGUISTICS I", :w false, :l false, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=4391&cour_cd=LING481&cour_cls=00&cour_nm=TOPICS IN LINGUISTICS I"}}, "ELED217-01" {:kr {:professor "Grace Kim", :schedule ["월(5) 교육관312" "\n수(5) 교육관312"], :r false, :number "ELED217-01", :name " 영어교과논리및논술(영강)", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0234&dept_cd=0241&cour_cd=ELED217&cour_cls=01&cour_nm=영어교과논리및논술(영강)"}, :en {:professor "Grace Kim", :schedule ["Mon(5) 140-312" "\nWed(5) 140-312"], :r false, :number "ELED217-01", :name "ENGLISH READING AND WRITING(English)", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0234&dept_cd=0241&cour_cd=ELED217&cour_cls=01&cour_nm=ENGLISH READING AND WRITING(English)"}}, "MEDI414-00" {:kr {:professor "이혜원", :schedule [], :r false, :number "MEDI414-00", :name " 마취통증의학임상실습", :w false, :l false, :classification "전공선택 ", :credit-hours "2(  0)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0226&dept_cd=0229&cour_cd=MEDI414&cour_cls=00&cour_nm=마취통증의학임상실습"}, :en {:professor "Hye Won Lee", :schedule [], :r false, :number "MEDI414-00", :name "ANESTHESIOLOGY & PAIN MEDICINE CLERKSHIP", :w false, :l false, :classification "Major Elective", :credit-hours "2(  0)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0226&dept_cd=0229&cour_cd=MEDI414&cour_cls=00&cour_nm=ANESTHESIOLOGY & PAIN MEDICINE CLERKSHIP"}}, "BUSS207-08" {:kr {:professor "김민수", :schedule ["금(1-2) 공학관 369"], :r true, :number "BUSS207-08", :name " 재무관리", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :x false, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0140&dept_cd=0142&cour_cd=BUSS207&cour_cls=08&cour_nm=재무관리"}, :en {:professor "Kim, Min-Su", :schedule ["Fri(1-2) 240-369"], :r true, :number "BUSS207-08", :name "FINANCIAL MANAGEMENT", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0140&dept_cd=0142&cour_cd=BUSS207&cour_cls=08&cour_nm=FINANCIAL MANAGEMENT"}}, "POLI228-00" {:kr {:professor "김현경", :schedule ["화(3-4) 교양관 104" "\n목(3-4) 교양관 104"], :r false, :number "POLI228-00", :name " 일본정치론(영강)", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x false, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0197&dept_cd=0199&cour_cd=POLI228&cour_cls=00&cour_nm=일본정치론(영강)"}, :en {:professor "Hyun Kyoung Kim", :schedule ["Tue(3-4) 108-104" "\nThu(3-4) 108-104"], :r false, :number "POLI228-00", :name "JAPANESE POLITICS AND SOCIETY(English)", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0197&dept_cd=0199&cour_cd=POLI228&cour_cls=00&cour_nm=JAPANESE POLITICS AND SOCIETY(English)"}}, "SAEK431-00" {:kr {:professor "김법민", :schedule [], :r true, :number "SAEK431-00", :name " 스포츠종목별트레이닝론VII", :w false, :l false, :classification "전공필수 ", :credit-hours "1(  2)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0234&dept_cd=0237&cour_cd=SAEK431&cour_cls=00&cour_nm=스포츠종목별트레이닝론VII"}, :en {:professor "Kim, Beop-Min", :schedule [], :r true, :number "SAEK431-00", :name "TRAINING THEORY FOR SPORTS EVENT VII", :w false, :l false, :classification "Major Required", :credit-hours "1(  2)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0234&dept_cd=0237&cour_cd=SAEK431&cour_cls=00&cour_nm=TRAINING THEORY FOR SPORTS EVENT VII"}}, "NMCH345-01" {:kr {:professor "이상민", :schedule ["토(1-3) 9-214c"], :r true, :number "NMCH345-01", :name " 전공연구실험I", :w false, :l true, :classification "전공선택 ", :credit-hours "1(  3)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4547&cour_cd=NMCH345&cour_cls=01&cour_nm=전공연구실험I"}, :en {:professor "Lee, Sangmin", :schedule ["Sat(1-3) 9-214c"], :r true, :number "NMCH345-01", :name "EXPERIMENTAL RESEARCH STUDY I", :w false, :l true, :classification "Major Elective", :credit-hours "1(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4547&cour_cd=NMCH345&cour_cls=01&cour_nm=EXPERIMENTAL RESEARCH STUDY I"}}, "LSSS357-01" {:kr {:professor "이현섭", :schedule ["수(5-6) 7-216" "\n수(8) 7-216"], :r true, :number "LSSS357-01", :name " 스포츠영상공학론", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS357&cour_cls=01&cour_nm=스포츠영상공학론"}, :en {:professor "LEE, Hyun Seob", :schedule ["Wed(5-6) 7-216" "\nWed(8) 7-216"], :r true, :number "LSSS357-01", :name "SPORT MOTION ANALYSIS", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS357&cour_cls=01&cour_nm=SPORT MOTION ANALYSIS"}}, "KORE223-00" {:kr {:professor "강헌국", :schedule ["월(2) 교양관 201" "\n수(2) 교양관 201"], :r true, :number "KORE223-00", :name " 현대소설론", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0145&cour_cd=KORE223&cour_cls=00&cour_nm=현대소설론"}, :en {:professor "Kang Hun Kook", :schedule ["Mon(2) 108-201" "\nWed(2) 108-201"], :r true, :number "KORE223-00", :name "MODERN KOREAN FICTION", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0145&cour_cd=KORE223&cour_cls=00&cour_nm=MODERN KOREAN FICTION"}}, "DISS242-00" {:kr {:professor "민태은", :schedule ["화(5) 국제관215" "\n목(5) 국제관215"], :r false, :number "DISS242-00", :name " 북미지역입문(영강)", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=3928&dept_cd=3931&cour_cd=DISS242&cour_cls=00&cour_nm=북미지역입문(영강)"}, :en {:professor "Min, Taeeun", :schedule ["Tue(5) 138-215" "\nThu(5) 138-215"], :r false, :number "DISS242-00", :name "CONTEMPORARY NORTH AMERICA(English)", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=3928&dept_cd=3931&cour_cd=DISS242&cour_cls=00&cour_nm=CONTEMPORARY NORTH AMERICA(English)"}}, "LSSS225-08" {:kr {:professor "박기주", :schedule ["화(9-10) "], :r true, :number "LSSS225-08", :name " 하이엔드스포츠I", :w false, :l true, :classification "전공선택 ", :credit-hours "1(  2)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS225&cour_cls=08&cour_nm=하이엔드스포츠I"}, :en {:professor ".", :schedule ["Tue(9-10)"], :r true, :number "LSSS225-08", :name "HIGH-AND SPORTS I", :w false, :l true, :classification "Major Elective", :credit-hours "1(  2)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS225&cour_cls=08&cour_nm=HIGH-AND SPORTS I"}}, "CIEN458-03" {:kr {:professor "정주노", :schedule ["금(8) 9-102" "\n금(10-11) 9-102"], :r true, :number "CIEN458-03", :name " 기전융합CapstoneDesign", :w true, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4551&cour_cd=CIEN458&cour_cls=03&cour_nm=기전융합CapstoneDesign"}, :en {:professor "Joono Cheong", :schedule ["Fri(8) 9-102" "\nFri(10-11) 9-102"], :r true, :number "CIEN458-03", :name "CAPSTONE DESIGN OF MECHATRONICS CONVERGING TECHNOLOGY", :w true, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4460&dept_cd=4551&cour_cd=CIEN458&cour_cls=03&cour_nm=CAPSTONE DESIGN OF MECHATRONICS CONVERGING TECHNOLOGY"}}, "MEDI402-00" {:kr {:professor "최성혁", :schedule [], :r false, :number "MEDI402-00", :name " 응급의학임상실습", :w false, :l false, :classification "전공필수 ", :credit-hours "2(  0)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0226&dept_cd=0229&cour_cd=MEDI402&cour_cls=00&cour_nm=응급의학임상실습"}, :en {:professor "CHOI, Sung Hyuk", :schedule [], :r false, :number "MEDI402-00", :name "EMERGENCY MEDICINE CLERKSHIP", :w false, :l false, :classification "Major Required", :credit-hours "2(  0)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0226&dept_cd=0229&cour_cd=MEDI402&cour_cls=00&cour_nm=EMERGENCY MEDICINE CLERKSHIP"}}, "ARCH329-01" {:kr {:professor "김강수", :schedule ["월(1-2) 공학관 368"], :r true, :number "ARCH329-01", :name " 건축환경계획I", :w false, :l true, :classification "전공필수 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0217&dept_cd=4887&cour_cd=ARCH329&cour_cls=01&cour_nm=건축환경계획I"}, :en {:professor "KIM, Kang Soo", :schedule ["Mon(1-2) 240-368"], :r true, :number "ARCH329-01", :name "ARCHITECTURAL ENVIRONMENTAL PLANNING I", :w false, :l true, :classification "Major Required", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0217&dept_cd=4887&cour_cd=ARCH329&cour_cls=01&cour_nm=ARCHITECTURAL ENVIRONMENTAL PLANNING I"}}, "LSSS307-00" {:kr {:professor "이규상", :schedule ["목(2-3) 7-217" "\n목(5) 7-217"], :r true, :number "LSSS307-00", :name " 운동과스포츠의학", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x false, :campus "세종", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS307&cour_cls=00&cour_nm=운동과스포츠의학"}, :en {:professor "lee ku", :schedule ["Thu(2-3) 7-217" "\nThu(5) 7-217"], :r true, :number "LSSS307-00", :name "SPORTS AND EXERCISE MEDICINE", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=5685&dept_cd=5683&cour_cd=LSSS307&cour_cls=00&cour_nm=SPORTS AND EXERCISE MEDICINE"}}, "KHBE423-00" {:kr {:professor "박용두", :schedule ["목(5-6) 하나과학관 B120호"], :r true, :number "KHBE423-00", :name " 조직공학및약물전달시스템", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4669&dept_cd=5037&cour_cd=KHBE423&cour_cls=00&cour_nm=조직공학및약물전달시스템"}, :en {:professor "Park, Yongdoo", :schedule ["Thu(5-6) B120"], :r true, :number "KHBE423-00", :name "TISSUE ENGINEERING AND DRUG DELIVERY SYSTEM", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=4669&dept_cd=5037&cour_cd=KHBE423&cour_cls=00&cour_nm=TISSUE ENGINEERING AND DRUG DELIVERY SYSTEM"}}, "STAT203-00" {:kr {:professor "임화경", :schedule ["금(5-6) 정경관202강의실"], :r true, :number "STAT203-00", :name " 통계프로그래밍입문", :w false, :l true, :classification "전공선택 ", :credit-hours "3(  3)", :x false, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0197&dept_cd=0201&cour_cd=STAT203&cour_cls=00&cour_nm=통계프로그래밍입문"}, :en {:professor "Lim Hwa Kyung", :schedule ["Fri(5-6) 131-202"], :r true, :number "STAT203-00", :name "INTRODUCTION TO STATISTICAL PROGRAMMING", :w false, :l true, :classification "Major Elective", :credit-hours "3(  3)", :x false, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0197&dept_cd=0201&cour_cd=STAT203&cour_cls=00&cour_nm=INTRODUCTION TO STATISTICAL PROGRAMMING"}}, "HOEW363-00" {:kr {:professor "원태준", :schedule ["금(5-6) 서관 224A"], :r true, :number "HOEW363-00", :name " 영국문화사(영강)", :w false, :l false, :classification "전공선택 ", :credit-hours "3(  3)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0803&cour_cd=HOEW363&cour_cls=00&cour_nm=영국문화사(영강)"}, :en {:professor "Won Tae Joon", :schedule ["Fri(5-6) 103-224A"], :r true, :number "HOEW363-00", :name "BRITISH HISTORY(English)", :w false, :l false, :classification "Major Elective", :credit-hours "3(  3)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0803&cour_cd=HOEW363&cour_cls=00&cour_nm=BRITISH HISTORY(English)"}}, "PSYC206-02" {:kr {:professor "정현선", :schedule ["화(8) 서관 123"], :r true, :number "PSYC206-02", :name " 심리통계실습", :w false, :l true, :classification "전공필수 ", :credit-hours "1(  1)", :x true, :campus "안암", :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanView.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0151&cour_cd=PSYC206&cour_cls=02&cour_nm=심리통계실습"}, :en {:professor "CHUNG, Hyun Sun", :schedule ["Tue(8) 103-123"], :r true, :number "PSYC206-02", :name "INTRODUCTORY PSYCHOLOGICAL STATISTICS AND PRACTICUM", :w false, :l true, :classification "Major Required", :credit-hours "1(  1)", :x true, :href "http://infodepot.korea.ac.kr/lecture1/lecsubjectPlanViewEng.jsp?year=2015&term=1R&grad_cd=0136&col_cd=0143&dept_cd=0151&cour_cd=PSYC206&cour_cls=02&cour_nm=INTRODUCTORY PSYCHOLOGICAL STATISTICS AND PRACTICUM"}}})

 ;; Utils
 (defn course-hm->str [[id data]]


reset input value on focus to place cursor at end of input

--- src/cljs/todomvc/core.cljs
+++ src/cljs/todomvc/core.cljs
@@ -52,6 +52,7 @@
    [:input (merge
             {:type "text"
              :value @value
+             :on-focus #(set! (-> % .-target .-value) @value)
              :on-change #(reset! value (-> % .-target .-value))}
             props)]))


Pass proper parameters to colorpicker on colores page.

--- src/uxbox/ui/dashboard/colors.cljs
+++ src/uxbox/ui/dashboard/colors.cljs
@@ -187,7 +187,9 @@
             :on-change on-change
             :value (or (:hex @local) color "")
             :type "text"}]]
-         (colorpicker #(swap! local merge %))
+         (colorpicker {:picker {:width 205 :height 205}
+                       :bar {:width 15 :height 205}
+                       :callback #(swap! local merge %)})
          [:input#project-btn.btn-primary
           {:value "+ Add color"
            :on-click submit


render all variables in arity message when there are no req'ed vars

--- src/datascript/parser.cljc
+++ src/datascript/parser.cljc
@@ -165,8 +165,8 @@
 (defn flatten-rule-vars [rule-vars]
   (concat
     (when (:required rule-vars)
-      [(mapv :symbol (:required rule-vars))]
-      (mapv :symbol (:free rule-vars)))))
+      [(mapv :symbol (:required rule-vars))])
+    (mapv :symbol (:free rule-vars))))

 (defn rule-vars-arity [rule-vars]
   [(count (:required rule-vars)) (count (:free rule-vars))])


Start work on partition-level update logic.

--- src/merkle_db/partition.clj
+++ src/merkle_db/partition.clj
@@ -345,3 +345,99 @@

       ; Otherwise, divide up into one or more valid serialized partitions.
       :else (from-records store part (tablet/read-all virtual-tablet)))))
+
+
+(defn update-partitions!
+  "Consume a sequence of tuples containing partitions and associated patch
+  changes to return an updated sequence of partitions. Each tuple has the form
+  `[first-key partition-data changes]`. The partition data may be either a link
+  to an existing node or a virtual tablet which was carried into the inputs.
+
+  The result of the update is one of:
+
+  - `nil` if all partitions were removed by the changes.
+  - A virtual tablet if there are not enough records in the result to create a
+    valid half-full partition.
+  - A sequence of tuples of `[first-key partition-link]` giving the updated
+    serialized partitions."
+  [store params partitions]
+  (let [limit (or (::limit params) default-limit)
+        half-full (int (Math/ceil (/ limit 2)))
+        valid? #(or (mdag/link? %) (<= half-full (::record/count %) limit))
+        to-tablet (fn to-tablet
+                    [x]
+                    (cond
+                      (mdag/link? x)
+                        (-> (mdag/get-data store x)
+                            (read-all)
+                            (tablet/from-records))
+                      (= tablet/data-type (:data/type x))
+                        x
+                      (= data-type (:data/type x))
+                        (tablet/from-records (read-all x))
+                      nil nil))
+        merge-parts (fn merge-parts
+                      [a b]
+                      (if (and a b)
+                        (tablet/join (to-tablet a) (to-tablet b))
+                        (or a b)))]
+    (loop [result []
+           pending nil
+           inputs partitions]
+      (if (seq inputs)
+        ; Process next partition in the sequence.
+        (let [[first-key part changes] (first inputs)]
+          ; pending: nil, underflow, intermediate, overflow-by-half
+          ; part: link, tablet
+          ; changes: nil, some
+          ; part+changes: nil, link, tablet
+
+          ; case [pending part changes]:
+          ;
+          ; [nil link nil]
+          ; no changes to the already-serialized partition, add directly to result
+          ;
+          ; [pending link changes]
+          ; load link, apply changes and join with pending:
+          ; - identical to the original records from link => emit renamed link
+          ; - empty => (recur result nil (next inputs))
+          ; - underflow => (recur result tablet (next inputs))
+          ; - overflow by half => make a full partition and recur with half-full tablet
+          ;
+          ; [pending tablet changes]
+          ; apply changes to tablet and join with pending:
+          ; - empty => (recur result nil (next inputs))
+          ; - underflow => (recur result tablet (next inputs))
+          ; - overflow by half => make a full partition and recur with half-full tablet
+          ,,,)
+
+        ; No more partitions to process.
+        (cond
+          ; No pending data to handle, we're done.
+          (nil? pending)
+            result
+
+          ; Not enough records left to create a valid partition!
+          (< (count (tablet/read-all pending)) half-full)
+            (if-let [prev (peek result)]
+              ; Load last result link and redistribute into two valid partitions.
+              (->> (merge-parts prev pending)
+                   (tablet/read-all)
+                   (from-records store params)
+                   (map-indexed
+                     #(vector (::record/first-key %1)
+                              (mdag/link (format "part-%03d" (+ (count result) %2))
+                                         (meta %))))
+                   (into result))
+              ; No siblings, so return virtual tablet for carrying.
+              pending)
+
+          ; Enough records to make one or more valid partitions.
+          :else
+            (->> (tablet/read-all pending)
+                 (from-records store params)
+                 (map-indexed
+                   #(vector (::record/first-key %1)
+                            (mdag/link (format "part-%03d" (+ (count result) %2))
+                                       (meta %))))
+                 (into result)))))))


Did some cleanup around references.

Did some cleanup around references.

--- src/blutwurst/core.clj
+++ src/blutwurst/core.clj
@@ -5,9 +5,9 @@
 					logf tracef debugf infof warnf errorf fatalf reportf with-level
 					spy get-env]]
             [blutwurst.database :refer [retrieve-table-graph]]
-            [blutwurst.planner]
-            [blutwurst.tuple-generator]
-            [blutwurst.tuple-formatter]
+            [blutwurst.planner :refer [create-data-generation-plan]]
+            [blutwurst.tuple-generator :refer [generate-tuples-for-plan]]
+            [blutwurst.tuple-formatter :refer [format-rows]]
             [blutwurst.sink :refer [make-sink]])
   (:gen-class))

@@ -34,14 +34,14 @@
   (with-level :fatal
       (let [parsed-input (parse-opts args cli-options)
             spec (build-spec (:options parsed-input))
-            format-rows (partial blutwurst.tuple-formatter/format-rows spec)
+            format-rows (partial format-rows spec)
             sink (make-sink spec)]
         (trace spec)

         (-> spec
             retrieve-table-graph
-            blutwurst.planner/create-data-generation-plan
-            blutwurst.tuple-generator/generate-tuples-for-plan
+            create-data-generation-plan
+            generate-tuples-for-plan
             format-rows
             sink)
         )))


Reset logging level to the highest.

Reset logging level to the highest.

--- src/blutwurst/core.clj
+++ src/blutwurst/core.clj
@@ -30,7 +30,7 @@
 (defn -main
   "Main command line interface that will pass in arguments and kick off the data generation process."
   [& args]
-  (with-level :trace
+  (with-level :fatal
       (let [parsed-input (parse-opts args cli-options)
             spec (build-spec (:options parsed-input))
             format-rows (partial blutwurst.tuple-formatter/format-rows spec)]


Fix a bug where a nil build info map caused a null pointer exception for a build definition with no builds

--- src/build_mon/core.clj
+++ src/build_mon/core.clj
@@ -66,18 +66,19 @@
   (str "/favicon_" (name state) ".ico"))

 (defn get-favicon-path-for-multiple-build-definitions [build-info-maps]
-  (let [current-states (map :state build-info-maps)
+  (let [current-states (remove nil? (map :state build-info-maps))
         sorting-map (into {} (map-indexed (fn [idx itm] [itm idx]) states-ordered-worst-first))]
     (get-favicon-path (first (sort-by sorting-map current-states)))))

 (defn build-monitor-for-build-definition-ids [account project token request build-definition-ids]
-  (let [refresh-interval (refresh-interval (:query-params request))
+  (let [build-info-maps (remove nil? (map #(retrieve-build-info account project token %) build-definition-ids))
+        build-definition-ids-with-build-info (remove nil? (map :build-definition-id build-info-maps))
+        refresh-interval (refresh-interval (:query-params request))
         refresh-info (when refresh-interval
                        {:refresh-interval refresh-interval
-                        :build-definition-ids build-definition-ids})]
-    (when (> (count build-definition-ids) 0)
-      (let [build-info-maps (map #(retrieve-build-info account project token %) build-definition-ids)
-            favicon-path (get-favicon-path-for-multiple-build-definitions build-info-maps)]
+                        :build-definition-ids build-definition-ids-with-build-info})]
+    (when (not-empty build-info-maps)
+      (let [favicon-path (get-favicon-path-for-multiple-build-definitions build-info-maps)]
         {:status 200
          :headers {"Content-Type" "text/html; charset=utf-8"}
          :body (html/generate-build-monitor-html build-info-maps refresh-info favicon-path)}))))


Renamed to prog-frame.

Renamed to prog-frame.

--- src/cbfg/world/t1.cljs
+++ src/cbfg/world/t1.cljs
@@ -18,35 +18,35 @@
                           ;   :net-connect-ch => ch
                           ;   :res-ch => ch }

-(def prog-curr (atom {:servers {}    ; { server-addr => ports }.
-                      :clients {}})) ; { client-addr => client-info }.
-
-(def prog-history (atom [])) ; Each event is [ts label @prog-curr].
-
-(def run-world       (atom nil))
-(def run-world-hover (atom nil))
+(def prog-frame ; The last / current prog-frame.
+  (atom {:servers {}    ; { server-addr => ports }.
+         :clients {}})) ; { client-addr => client-info }.
+
+(def prog-frame-hover (atom nil))
+
+(def prog-history (atom [])) ; Each event is [ts label @prog-frame].

 ; -------------------------------------------------------------------

-(defn render-world [prog-curr owner]
+(defn render-prog-frame [prog-frame owner]
   (apply dom/ul nil
          (map (fn [[k v]] (dom/li nil (str k ":" (count v))))
-              prog-curr)))
-
-(defn on-event-focus [ts label prog-curr]
-  (reset! run-world-hover prog-curr)
+              prog-frame)))
+
+(defn on-event-focus [ts label prog-frame]
+  (reset! prog-frame-hover prog-frame)
   (.add gdom/classes (gdom/getElement "world-container") "hover"))

 (defn on-event-blur []
-  (reset! run-world-hover nil)
+  (reset! prog-frame-hover nil)
   (.remove gdom/classes (gdom/getElement "world-container") "hover"))

 (defn render-events [app owner]
   (apply dom/ul nil
-         (map (fn [[ts label prog-curr]]
-                (dom/li #js {:onMouseEnter #(on-event-focus ts label prog-curr)
+         (map (fn [[ts label prog-frame]]
+                (dom/li #js {:onMouseEnter #(on-event-focus ts label prog-frame)
                              :onMouseLeave #(on-event-blur)}
-                        (str ts (apply str label) prog-curr)))
+                        (str ts (apply str label) prog-frame)))
               app)))

 (defn render-clients [app owner]
@@ -56,17 +56,17 @@
               (keys (:clients app)))))

 (defn init-roots []
-  (om/root render-world run-world
+  (om/root render-prog-frame prog-frame
            {:target (. js/document (getElementById "world"))})
-  (om/root render-world run-world
+  (om/root render-prog-frame prog-frame
            {:target (. js/document (getElementById "world-map"))})
-  (om/root render-world run-world-hover
+  (om/root render-prog-frame prog-frame-hover
            {:target (. js/document (getElementById "world-hover"))})
-  (om/root render-world run-world-hover
+  (om/root render-prog-frame prog-frame-hover
            {:target (. js/document (getElementById "world-map-hover"))})
   (om/root render-events prog-history
            {:target (. js/document (getElementById "events"))})
-  (om/root render-clients prog-curr
+  (om/root render-clients prog-frame
            {:target (. js/document (getElementById "controls-clients"))}))

 ; ------------------------------------------------
@@ -126,8 +126,8 @@
                            (merge (map #(listen-el (gdom/getElement %) "click")
                                        (keys cbfg.world.lane/cmd-handlers))))
               expand-ch (listen-el (gdom/getElement (str el-prefix "-html")) "click")
-              prog (get-el-value "prog")
-              prog-js (str "with (cbfg.world.t1) {" prog "}")
+              prog-in (get-el-value "prog")
+              prog-js (str "with (cbfg.world.t1) {" prog-in "}")
               prog-res (try (js/eval prog-js) (catch js/Object ex ex))]
           (world-cmd-loop world cbfg.world.lane/cmd-handlers cmd-ch
                           req-ch (:res-ch @prog-base)
@@ -135,7 +135,7 @@
           (act-loop cmd-dispatch-loop world [num-dispatches 0]
                     (when-let [msg (atake cmd-dispatch-loop req-ch)]
                       (when-let [client-req-ch
-                                 (get-in @prog-curr [:clients (:client msg) :req-ch])]
+                                 (get-in @prog-frame [:clients (:client msg) :req-ch])]
                         (aput cmd-dispatch-loop client-req-ch msg))
                       (recur (inc num-dispatches))))
           (println :prog-res prog-res)
@@ -167,7 +167,7 @@
 ; --------------------------------------------

 (defn prog-event [label f]
-  (let [pc (swap! prog-curr f)]
+  (let [pc (swap! prog-frame f)]
     (swap! prog-history #(conj % [(count %) label pc]))))

 (defn kv-server [server-addr & ports]


write a do notation macro

write a do notation macro

--- src/monad/clojure/monad.clj
+++ src/monad/clojure/monad.clj
@@ -269,4 +269,38 @@

 (apply concat (for [a [8 10]
                     b (half-double a)]
-                (inc-int b)))+                (inc-int b)))
+
+;;make youself a do notation
+
+(def list-m {
+             :return (fn [v] (list v))
+             :bind (fn [mv f]
+                     (mapcat f mv))
+             })
+
+(let [bind (:bind list-m)
+      return (:return list-m)]
+  (bind [1 2 3]
+        (fn [a]
+          (bind [4 5]
+                (fn [b]
+                  (return [a b]))))))
+
+(defn m-steps [m [name val & bindings] body]
+  (println (str name val (vec bindings)))
+  (if (seq bindings)
+    `(-> ~val
+         ((:bind ~m) (fn [~name]
+                       ~(m-steps m (vec bindings) body))))
+    `(-> ~val
+         ((:bind ~m) (fn [~name]
+                       ((:return ~m) ~body))))))
+
+(defmacro do-m [m bindings body]
+  (m-steps m bindings body))
+
+(do-m list-m
+      [a [1 2 3]
+       b [4 5]]
+      [a b])


back to foreach for the moment

back to foreach for the moment

--- src/neo4j_meetup/import.clj
+++ src/neo4j_meetup/import.clj
@@ -26,6 +26,18 @@
     { :year (t/year event-date)
       :month (t/month event-date)
       :day (t/day event-date) }))
+
+(defn create-member-topics [member]
+  (let [query (str "MATCH (m:MeetupProfile {id: {person}.id})
+                    FOREACH(topic IN {topics} |
+                      MERGE (t:Topic {id: topic})
+                      MERGE (m)-[:INTERESTED_IN]->(t))")
+        params {:person {
+                         :id (:id member)
+                         }
+                :topics (map :id (:topics member))
+                }]
+    (tx/statement query params)))

 (defn create-member [member]
   (let [social-media (:other_services member)
@@ -41,11 +53,7 @@
                     MATCH (year:Year {year: {timetree}.year }),
                           (year)-[:HAS_MONTH]->(month {month: {timetree}.month }),
                           (month)-[:HAS_DAY]->(day {day: {timetree}.day })
-                    CREATE (m)-[:JOINED_ON]->(day)
-                    WITH m, p
-                    UNWIND {topics} AS topic
-                    MATCH (t:Topic {id: topic})
-                    MERGE (m)-[:INTERESTED_IN]->(t) "
+                    CREATE (m)-[:JOINED_ON]->(day) "
                     (if (:twitter social-media)
                       "MERGE (twitter:Twitter {id: {socialmedia}.twitter.identifier })
                        MERGE (p)-[:HAS_TWITTER_ACCOUNT]->(twitter) "
@@ -63,7 +71,6 @@
                 :groupid (:groupid member)
                 :timetree (as-timetree (:joined member))
                 :socialmedia social-media
-                :topics (map :id (:topics member))
                 }]
     (tx/statement query params)))

@@ -108,7 +115,7 @@
 " {}))

 (defn create-time-tree [start-year end-year]
-  (db/tx-api-single "
+ (db/tx-api-single "
     WITH range({start}, {end}) AS years, range(1,12) as months
     FOREACH(year IN years |
       MERGE (y:Year {year: year})
@@ -284,8 +291,13 @@
                                flatten
                                (clojure.core/set))))

-(comment (defn -main [& args]
-           (timed #(import-topics (member-files "data/members-2014-05-14")) "topics")))
+(comment (defn import-topics [member-files]
+           (->>  member-files
+                 (take 1)
+                 (map #(load-json (.getPath %)))
+                 (mapcat (fn [data] (map #(count ( :topics %)) data)))
+                 (reduce +)
+                 )))

 (defn -main [& args]
   (let [member-files
@@ -294,11 +306,11 @@
     (timed #(create-time-tree 2011 2014) "time-tree")
     (timed #(import-topics member-files) "topics")
     (timed #(db/tx-api create-group (load-json "data/groups-2014-05-14.json")) "groups")
-    (doseq [file member-files]
-      (timed #(db/tx-api create-member
-                         (map (fn [data] ( merge {:groupid (extract-group-id file)} data))
-                              (load-json (.getPath file))))
-             (str "members of " (extract-group-id file))))
+    (doseq [file  member-files]
+      (let [coll (map (fn [data] (merge {:groupid (extract-group-id file)} data))
+                              (load-json (.getPath file)))]
+        (timed #(db/tx-api create-member coll) (str "members of " (extract-group-id file)))
+        (timed #(db/tx-api create-member-topics coll) (str "members topics of " (extract-group-id file)))))
     (timed #(db/tx-api create-event  (load-json "data/events-2014-05-13.json")) "events")
     (timed #(db/tx-api create-rsvp (rsvps-with-responses (load-json "data/rsvps-2014-05-13.json"))) "rsvps")
     (timed #(link-credo-venues) "credo venues")))


Convert vertices to Clojure maps in sql results

--- src/clj/cglossa/db.clj
+++ src/clj/cglossa/db.clj
@@ -1,16 +1,29 @@
 (ns cglossa.db
   (:require [clojure.string :as str]
             [clojurewerkz.ogre.core :as q])
-  (:import (com.tinkerpop.blueprints.impls.orient OrientGraphFactory)
-           (com.orientechnologies.orient.core.sql OCommandSQL)))
+  (:import [com.tinkerpop.blueprints.impls.orient OrientGraphFactory]
+           [com.orientechnologies.orient.core.sql OCommandSQL]))

 (defn get-graph
-  ([] (get-graph true))
+  ([]
+   (get-graph true))
   ([transactional?]
    (let [factory (OrientGraphFactory. "remote:localhost/Glossa" "admin" "admin")]
      (if transactional? (.getTx factory) (.getNoTx factory)))))

-(defn query
+(defn vertex->map [v]
+  (as->
+    ;; Get all the key-value pairs for the OrientVertex
+    (.getProperties v) $
+    ;; Convert them to a Clojure hash map
+    (into {} $)
+    ;; @rid is just a temporary key for the result object, so remove it
+    (dissoc $ "@rid")
+    ;; The value of the 'rid' property is actually the entire OrientVertex object,
+    ;; but we just want it to be the string representation of its @rid (e.g. "12:0")
+    (update $ "rid" #(.. % getIdentity toString))))
+
+(defn sql-query
   "Takes an SQL query and optionally a map of parameters, runs it against the
   OrientDB database, and returns the query result as a seq. The params argument
   is a hash map with the following optional keys:
@@ -35,7 +48,7 @@
           :sql-params [\"bokmal\"]
           :strings    {:out \"HasMetadataCategory\"}})"
   ([sql]
-   (query sql {}))
+   (sql-query sql {}))
   ([sql params]
    (let [graph      (get-graph)
          t          (or (:target params) (:targets params))
@@ -52,5 +65,5 @@
                         (str/replace #"\&(\w+)" #(get strings (keyword (second %))))
                         (str/replace #"#TARGETS?" (str "[" (str/join ", " targets) "]")))
          cmd        (OCommandSQL. sql*)
-         ]
-     (seq (.. graph (command cmd) (execute sql-params))))))
+         results    (.. graph (command cmd) (execute sql-params))]
+     (map vertex->map results))))


Functions to parse integers, floats, and Booleans

--- src/clouseau/utils.clj
+++ src/clouseau/utils.clj
@@ -82,3 +82,19 @@
     [^java.lang.Exception exception]
     (.getMessage exception))

+(defn parse-int
+    "Parse the given string as an integer number."
+    [^String string]
+    (java.lang.Integer/parseInt string))
+
+(defn parse-float
+    "Parse the given string as a float number."
+    [^String string]
+    (java.lang.Float/parseFloat string))
+
+(defn parse-boolean
+    "Parse the given string as a boolean value."
+    [string]
+    (or (= string "true")
+        (= string "True")))
+


Code readability.

Code readability.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -290,8 +290,7 @@
                                                (entry-res/list-entries-for-user-replies conn org-id allowed-board-uuids user-id :asc
                                                 now :before 0 follow-data (:seen-at replies-seen) {:count true :unseen true}))
                                               false)
-                             board-reps (map #(board-rep/render-board-for-collection slug % draft-entry-count)
-                                          full-boards)
+                             board-reps (map #(board-rep/render-board-for-collection slug % draft-entry-count) full-boards)
                              authors (:authors org)
                              author-reps (map #(org-rep/render-author-for-collection org % (:access-level ctx)) authors)
                              has-sample-content? (> (entry-res/sample-entries-count conn org-id) 1)]


use more readable names

use more readable names

--- src/overtone/inst/synth.clj
+++ src/overtone/inst/synth.clj
@@ -11,10 +11,10 @@

 (definst ping
   [note {:default 72 :min 0 :max 120 :step 1}
-   a    {:default 0.02 :min 0.001 :max 1 :step 0.001}
-   b    {:default 0.3 :min 0.001 :max 1 :step 0.001}]
+   attack {:default 0.02 :min 0.001 :max 1 :step 0.001}
+   decay {:default 0.3 :min 0.001 :max 1 :step 0.001}]
   (let [snd (sin-osc (midicps note))
-        env (env-gen (perc a b) :action FREE)]
+        env (env-gen (perc attack decay) :action FREE)]
     (* 0.1 env snd)))

 (definst tb303


WIP hacking emitter

WIP hacking emitter

--- src/oxcart/emitter/core.clj
+++ src/oxcart/emitter/core.clj
@@ -12,7 +12,9 @@
         start with this for now."
    :author "Reid McKenzie"
    :added "0.0.12"}
-  (:require [oxcart
+  (:require [clojure.string :as s]
+            [clojure.java.io :as io]
+            [oxcart
              [util :refer [var-name var->ns var->name]]
              [passes :as passes :refer [require-pass whole-ast->forms]]
              [pattern :as pattern]]
@@ -23,7 +25,12 @@
             [oxcart.passes.defs
              :refer [locate-var-as-value]]
             [clojure.tools.emitter.jvm.transform
-             :refer [-compile]]))
+             :refer [-compile]]
+            [clojure.tools.analyzer.jvm.utils
+             :refer [primitive? prim-or-obj] :as j.u]
+            [clojure.tools.emitter.jvm.emit
+             :refer [emit-line-number
+                     emit-constants]]))

 (defn var->class [x]
   {:pre  [(var? x)]
@@ -31,11 +38,27 @@
   (str (var->ns x) "." (var->name x)))

 (defn write-class
-  [classname bytecode])
+  "(λ ClassName → Bytecode) → Nil
+
+  Writes the given bytecode to a file named by the ClassName and
+  *compile-path*. Requires that *compile-path* be set. Returns Nil."
+  [classname bytecode]
+  {:pre [(bound? *compile-path*)]}
+  (let [rel   (s/split classname #"\.")
+        class (last rel)
+        rel   (butlast rel)]
+    (-> (io/file (str *compile-path* "/"
+                      (s/join "/" rel))
+                 (str class ".class"))
+        (spit bytecode)))
+  nil)
+
+(def supported-ops
+  #{:instance-call :static-call :do :const :static-field :fn-method :def :fn})

 (defn dispatch-fn
-  []
-  )
+  [{:keys [op] :as node}]
+  (get supported-ops op :unsupported))

 (defmulti -emit
   "(λ AST) → OpSeq
@@ -45,6 +68,145 @@

   OpSeq is (Seq (Σ Op Opseq))"
   dispatch-fn)
+
+(defn label []
+  (keyword (gensym "label__")))
+
+(defmethod -emit :fn-method
+  [{:keys [params tag fixed-arity variadic? body env]}
+   {:keys [class] :as frame}]
+  (let [arg-tags               (mapv (comp prim-or-obj :tag) params)
+        return-type            (prim-or-obj tag)
+        tags                   (conj arg-tags return-type)
+        prim-interface         (j.u/prim-interface tags)
+
+        primitive?             (some primitive? tags)
+
+        method-name            (cond
+                                variadic? :doInvoke
+                                primitive? :invokePrim
+                                :else
+                                :invoke)
+
+        ;; arg-types
+        [loop-label end-label] (repeatedly label)
+
+        code
+        `[[:start-method]
+          [:local-variable :this :clojure.lang.AFunction nil ~loop-label ~end-label :this]
+          ~@(mapcat (fn [{:keys [name arg-id o-tag tag]}]
+                      `[~[:local-variable name tag nil loop-label end-label name]
+                        ~@(when-not (= tag o-tag)
+                            [[:load-arg arg-id]
+                             [:check-cast tag]
+                             [:store-arg arg-id]])])
+                  params)
+          [:mark ~loop-label]
+          ~@(emit-line-number env loop-label)
+          ~@(emit body (assoc frame
+                         :loop-label  loop-label
+                         :loop-locals params))
+          [:mark ~end-label]
+          [:return-value]
+          [:end-method]]]
+
+    ;; should emit typed only when there's an interface, otherwise it's useless
+
+    `[{:op     :method
+       :attr   #{:public}
+       :method [(into [method-name] arg-tags) return-type]
+       :code   code}
+      (when primitive?
+        {:op        :method
+         :attr      #{:public}
+         :interface prim-interface
+         :method    [(into [:invoke] (repeat (count params) :java.lang.Object))
+                     :java.lang.Object]
+         :code      `[[:start-method]
+                      [:load-this]
+                      ~@(mapcat (fn [{:keys [tag]} id]
+                                  `[~[:load-arg id]
+                                    ~@(emit-cast Object tag)])
+                                params (range))
+                      ~[:invoke-virtual (into [(keyword class "invokePrim")] arg-tags) return-type]
+                      ~@(emit-cast return-type Object)
+                      [:return-value]
+                      [:end-method]]})]))
+
+(defmethod -emit :def
+  [{:keys [init var]}]
+  (-> (-emit init)
+      (assoc :class-name (var->class var))))
+
+(defn emit-fn-class
+  [{:keys [class-name methods variadic? constants closed-overs env
+           annotations super interfaces op fields class-id]
+    :as ast}]
+  (let [constants          (->> constants
+                                (remove #(let [{:keys [tag type]} (val %)]
+                                           (or (primitive? tag)
+                                               (#{:string :bool} type))))
+                                (into {}))
+
+        consts             (vals constants)
+
+        constant-table     (zipmap (mapv :id consts) consts)
+
+        consts             (mapv (fn [{:keys [id tag]}]
+                                   {:op   :field
+                                    :attr #{:public :final :static}
+                                    :name (str "const__" id)
+                                    :tag  tag})
+                                 consts)
+
+        ctor-types         (into (if meta [:clojure.lang.IPersistentMap] [])
+                                 (mapv :tag closed-overs))
+
+        class-ctors        [{:op     :method
+                             :attr   #{:public :static}
+                             :method [[:<clinit>] :void]
+                             :code   `[[:start-method]
+                                       [:return-value]
+                                       [:end-method]]}
+                            {:op     :method
+                             :attr   #{:public}
+                             :method `[[:<init> ~@ctor-types] :void]
+                             :code   `[[:start-method]
+                                       [:load-this]
+                                       [:invoke-constructor [~(keyword (name super) "<init>")] :void]
+                                       [:return-value]
+                                       [:end-method]]}]
+
+        variadic-method    (when variadic?
+                             (let [required-arity (->> methods (filter :variadic?) first :fixed-arity)]
+                               [{:op     :method
+                                 :attr   #{:public}
+                                 :method [[:getRequiredArity] :int]
+                                 :code   [[:start-method]
+                                          [:push (int required-arity)]
+                                          [:return-value]
+                                          [:end-method]]}]))]
+
+    {:op          :class
+     :attr        #{:public :super :final}
+     :annotations annotations
+     :class-name  class-name
+     :name        (s/replace class-name \. \/)
+     :super       (s/replace (name super) \. \/)
+     :interfaces  interfaces
+     :fields      consts
+     :methods     (concat class-ctors
+                          variadic-method
+                          (mapcat #(-emit %) methods))}))
+
+(defmethod -emit :fn
+  [{:keys [form internal-name variadic?] :as ast}]
+  (let [class-name (str (namespace-munge *ns*) "$" (munge internal-name))
+        super      (if variadic? :clojure.lang.RestFn :clojure.lang.AFunction)
+        ast        (assoc ast
+                     :class-name class-name
+                     :super super)]
+    (emit-fn-class ast)))

 (defn emit-class
   "(λ Def-AST) → Class-AST
@@ -80,12 +242,14 @@
                            whole-ast->forms
                            (keep #(and (pattern/def? %)
                                        (reach (pattern/def->var %)))))]
+
     ;; compile & write the set of used classes
     (doseq [ast reach-defs]
-      (let [{:keys [class-name] :as class-ast} (-> ast emit-class)
-            class-bc                           (-> class-ast -compile)]
+      (let [{:keys [class-name] :as class-ast} (emit-class ast emit)
+            class-bc                           (-compile class-ast)]
         (write-class class-name class-bc)))

+    ;; compile & write the bootstrap class
     (let [class-name (var->ns entry)
           class-ast  {}
           class-bc   (-> class-ast -compile)]


Add gist embedding in markdown via %gist<id> notation.

--- src/flatland/templates.clj
+++ src/flatland/templates.clj
@@ -12,12 +12,19 @@
           (map #(clojure.string/split % #": ")
                (clojure.string/split yaml  #"\n"))))

+(defn- gistify
+  "Replaces %gist[id] in markdown w/ appropriate html."
+  [content]
+  (clojure.string/replace content
+                          #"%gist([\da-z]+)"
+                          "

"))
+
 (defn- slurp-md
   "Takes a Markdown file and returns a map with the content and yaml data."
   [post-file]
   (let [text (slurp post-file)]
     (let [[data content] (clojure.string/split text #"\n---\n" 2)]
-      (assoc (parse-yaml data) :content (md-to-html-string content)))))
+      (assoc (parse-yaml data) :content (md-to-html-string (gistify content))))))

 ;; Read posts from resources/posts and parse them into maps (keys :yaml, :content),
 ;; storing them in one large map keyed by name (WITHOUT .md extension)


actions can be enabled/disabled visually

--- src/frontend/devtools.cljs
+++ src/frontend/devtools.cljs
@@ -7,7 +7,8 @@
 (ns frontend.devtools
   (:require [reagent.core :as r]
             [cljs.pprint]
-            [cljs.core.match :refer-macros [match]]))
+            [cljs.core.match :refer-macros [match]]
+            [com.rpl.specter :as s]))

 (defn init
   "Creates a fresh dev-model instance."
@@ -16,7 +17,7 @@
    :initial-model-saved? false
    ; list of [id signal]
    :signals              (list)
-   ; list of [id source-signal-id action]
+   ; list of {id source-signal-id enabled? action}
    :actions              (list)})

 (defn -signal-event
@@ -25,7 +26,29 @@

 (defn -action-event
   [source-signal-id action]
-  [(random-uuid) source-signal-id action])
+  {:id               (random-uuid)
+   :source-signal-id source-signal-id
+   :enabled?         true
+   :action           action})
+
+(defn -update-actions*
+  "model must be immutable."
+  [model pred f & args]
+  (s/transform [:actions s/ALL pred]
+               #(apply f % args)
+               model))
+
+(defn -update-action
+  "model must be immutable."
+  [model id f & args]
+  (apply -update-actions* model #(= (:id %) id) f args))
+
+(defn -toggle-action
+  "dev-model is a ratom."
+  [dev-model id]
+  (swap! dev-model
+         -update-action id
+         update :enabled? not))

 (defn -devtools-view
   "dev-model must be a ratom."
@@ -48,10 +71,17 @@
              [:span [:strong (pr-str (first signal))] " " (clojure.string/join " " (rest signal))]
              [:span [:strong (pr-str signal)]])

-           (for [[id _signal-id_ action] (filter #(= (second %) signal-id) (:actions @dev-model))]
+           (for [{:keys [id enabled? action]} (filter #(= (:source-signal-id %) signal-id)
+                                                      (:actions @dev-model))]
              ^{:key id}
-             [:div {:style {:margin-left "10px"}}
+             [:div {:style {:margin-left "10px"
+                            :color       (if enabled? "inherit" "grey")}}
               "⇣"
+              [:button {:style    {:cursor          "pointer"
+                                   :text-decoration "underline"}
+                        :on-click #(-toggle-action dev-model id)}
+               (if enabled? "OFF" "ON")]
+
               (if (coll? action)
                 [:div
                  [:strong (pr-str (first action))] " " (clojure.string/join " " (rest action))]


Perform schema validation for clj (validation in cljs is *extremely* slow atm)

--- test/asciinema/player/vt_test.cljc
+++ test/asciinema/player/vt_test.cljc
@@ -12,7 +12,8 @@
             #?(:clj [asciinema.player.test-macros :refer [property-tests-multiplier]])
             [asciinema.player.vt :as vt :refer [parse make-vt feed feed-one feed-str get-params initial-saved-cursor compact-lines]]))

-(use-fixtures :once schema.test/validate-schemas)
+#?(:clj
+   (use-fixtures :once schema.test/validate-schemas))

 (def vt-80x24 (make-vt 80 24))


Update deflogical test for insert multiple facts

--- test/clj/libx/deflogical_test.cljc
+++ test/clj/libx/deflogical_test.cljc
@@ -6,6 +6,8 @@
 (defn rule-props [expansion]
   (second (nth expansion 2)))

+;; Because names for deflogical are generated we skip the part of the
+;; expansion that includes the name
 (deftest deflogical-test
   (testing "Single fact"
     (is (=
@@ -17,23 +19,25 @@
                   [[?e :quux]])))
           (rule-props
             (macroexpand
-              '(defrule x
+              '(defrule some-generated-name
                  [:baz (= ?e (:e this))]
                  [:quux (= ?e (:e this))]
                  =>
-                 (libx.util/insert! [-1 :foo "bar"]))))))))
-  ;(testing "Multiple facts"
-  ;  (let [output   (macroexpand
-  ;                   '(deflogical
-  ;                      [[-1 :foo "bar"] [-2 :foo "baz"]]
-  ;                      [[?e :baz]]
-  ;                      [[?e :quux]]))
-  ;        expected (macroexpand
-  ;                   '(defrule my-logical
-  ;                      [:baz (= ?e (:e this))]
-  ;                      [:quux (= ?e (:e this))]
-  ;                      =>
-  ;                      (insert-all! [[-1 :foo "bar"] [-2 :foo "baz"]])))]
-  ;    (is (= output expected)))))
+                 (libx.util/insert! [-1 :foo "bar"])))))))
+  (testing "Multiple facts"
+    (is (=
+          (rule-props
+            (macroexpand
+             '(deflogical
+                [[-1 :foo "bar"] [-2 :foo "baz"]] :-
+                [[?e :baz]]
+                [[?e :quux]])))
+          (rule-props
+            (macroexpand
+              '(defrule some-generated-name
+                 [:baz (= ?e (:e this))]
+                 [:quux (= ?e (:e this))]
+                 =>
+                 (libx.util/insert! [[-1 :foo "bar"] [-2 :foo "baz"]]))))))))

-(run-tests)+(run-tests)


more tests

more tests

--- test/corpusmaker/test_entities.clj
+++ test/corpusmaker/test_entities.clj
@@ -72,4 +72,16 @@
           (let [[resource value type] (first results)]
             (is (= "http://dbpedia.org/resource/!!!" resource))
             (is (= "!!! is a dance-punk band" (.substring value 0 24)))
-            (is (= "http://dbpedia.org/ontology/Organisation" type))))))))
+            (is (= "http://dbpedia.org/ontology/Organisation" type)))
+          (let [[resource value type] (second results)]
+            (is (= "http://dbpedia.org/resource/!!!Fuck_You!!!" resource))
+            (is (= "!!!Fuck You!!! is an EP" (.substring value 0 23)))
+            (is (= "http://dbpedia.org/ontology/Work" type)))
+          (let [[resource value type] (nth results 2)]
+            (is (= "http://dbpedia.org/resource/!!!Fuck_You!!!_and_Then_Some" resource))
+            (is (= "!!!Fuck You!!! and Then Some is a 1996 reissue" (.substring value 0 46)))
+            (is (= "http://dbpedia.org/ontology/Work" type)))
+          (let [[resource value type] (last results)]
+            (is (= "http://dbpedia.org/resource/\"C\"_Is_for_Corpse" resource))
+            (is (= "\"C\" Is for Corpse is the third novel" (.substring value 0 36)))
+            (is (= "http://dbpedia.org/ontology/Work" type))))))))


test suppress-incomplete-morphology-errors in future

--- src/babel/francais/morphology/verbs.clj
+++ src/babel/francais/morphology/verbs.clj
@@ -165,7 +165,10 @@
      ;; </third person plural future>

      :else
-     (throw (Exception. (str "get-string: futuro regular inflection: don't know what to do with input argument: " (strip-refs word)))))))
+     (let [message (str "get-string: futuro regular inflection: don't know what to do with input argument: " (strip-refs word))]
+       (if (= true suppress-incomplete-morphology-errors)
+         (do (log/warn message)
+             (throw (Exception. message))))))))

 (defn imperfect [word]
   (let [infinitive (reflexive-to-infinitive (get-in word [:français]))


added security headers

added security headers

--- src/blog/web_server/web_server_impl.clj
+++ src/blog/web_server/web_server_impl.clj
@@ -4,6 +4,22 @@
             [ring.middleware.params :as params]
             [ring.middleware.flash :as flash]
             [ring.adapter.jetty :as jetty]))
+
+
+; prevent framing (clickjacking)
+
+(defn wrap-anti-framing [handler]
+  (fn [req]
+    (let [resp (handler req)]
+      (assoc-in resp [:headers "X-Frame-Options"] "DENY"))))
+
+
+; prevent content type sniffing
+
+(defn wrap-anti-content-type-sniffing [handler]
+  (fn [req]
+    (let [resp (handler req)]
+      (assoc-in resp [:headers "X-Content-Type-Options"] "nosniff"))))

 ; content-type and charset middleware
@@ -71,8 +87,11 @@
       (wrap-extended-request)
       (wrap-content-type)
       (flash/wrap-flash)
-      (session/wrap-session)
-      (params/wrap-params)))
+      (session/wrap-session {:cookie-attrs {;:secure true
+                                            :http-only true}})
+      (params/wrap-params)
+      (wrap-anti-content-type-sniffing)
+      (wrap-anti-framing)))

 (defn start-impl [{old-server :server next :next port :port :as this}]
   (if old-server


raise treats last argument as data for ex-info which must be map

--- src/datascript/db.cljc
+++ src/datascript/db.cljc
@@ -457,7 +457,7 @@

   (-index-range [db attr start end]
     (when-not (indexing? db attr)
-      (raise "Attribute" attr "should be marked as :db/index true"))
+      (raise "Attribute" attr "should be marked as :db/index true" {}))
     (validate-attr attr (list '-index-range 'db attr start end))
     (btset/slice (.-avet db) (resolve-datom db nil attr start nil)
                  (resolve-datom db nil attr end nil))))


Add missing copyright preamble on poly1305.clj

--- src/clojure/buddy/core/mac/poly1305.clj
+++ src/clojure/buddy/core/mac/poly1305.clj
@@ -1,3 +1,18 @@
+;; Copyright 2013-2015 Andrey Antukh <niwi@niwi.be>
+;;
+;; Licensed under the Apache License, Version 2.0 (the "License")
+;; you may not use this file except in compliance with the License.
+;; You may obtain a copy of the License at
+;;
+;;     http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+
+
 (ns buddy.core.mac.poly1305
   "Poly1305-AES is a cryptographic message authentication code
 (MAC) written by Daniel J. Bernstein. It can be used to verify the


Cosmetic improvements on auth handlers namespace.

Use more shorter namespace aliases.

--- src/clojure/catacumba/handlers/auth.clj
+++ src/clojure/catacumba/handlers/auth.clj
@@ -25,10 +25,9 @@
 (ns catacumba.handlers.auth
   "Authentication and Authorization facilities for catacumba
   using funcool/buddy "
-  ;; TODO: rename to shorter ns aliases
-  (:require [catacumba.impl.handlers :as handlers]
-            [catacumba.impl.routing :as routing]
-            [catacumba.impl.context :as context]
+  (:require [catacumba.impl.handlers :as hs]
+            [catacumba.impl.routing :as rt]
+            [catacumba.impl.context :as ct]
             [catacumba.impl.http]
             [catacumba.helpers :as hp]
             [buddy.sign.jws :as jws]
@@ -153,14 +152,14 @@
   {:pre [(pos? (count backends))]}
   (fn [context]
     (-> (hp/promise #(do-auth context backends %))
-        (hp/then #(context/delegate context %)))))
+        (hp/then #(ct/delegate context %)))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Adapters
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-(defmethod routing/attach-route :auth
+(defmethod rt/attach-route :auth
   [^Chain chain [_ & backends]]
   (let [^Handler handler (-> (apply auth backends)
-                             (handlers/adapter))]
+                             (hs/adapter))]
     (.all chain handler)))


func: config error log

func: config error log

--- src/clojure/zensols/actioncli/parse.clj
+++ src/clojure/zensols/actioncli/parse.clj
@@ -9,6 +9,10 @@
 (def ^:dynamic *dump-jvm-on-error*
   "Bind this from the REPL to avoid a system exit when testing the CLI."
   true)
+
+(def ^:dynamic *log-error*
+  "Log exceptions in [[handle-exception]]."
+  false)

 (defa- program-name-inst "prog")

@@ -46,7 +50,7 @@
   "Handle exceptions thrown from CLI commands."
   [e]
   (let [msg (.getMessage e)]
-    (log/error e "command line parse error")
+    (if *log-error* (log/error e "command line parse error"))
     (if (instance? java.io.FileNotFoundException e)
       (binding [*out* *err*]
         (println (format "%s: io error: %s" (program-name) msg)))


fix dotimes and while compilation

fix dotimes and while compilation

--- src/kondolisp/compiler.clj
+++ src/kondolisp/compiler.clj
@@ -302,12 +302,16 @@
 	  ;;
 	  ('while pred & body)	(let [retry-label (gensym),
 				      end-label (gensym)]
-				  `(~retry-label
+				  `((:VM_IVAL ~(make-nil))
+                                    ~retry-label
+                                    (:VM_PUSH)
 				    ~@(compile-pass1 pred)
 				    (:VM_BIFN ~end-label)
+                                    (:VM_POP)
 				    ~@(apply concat (map compile-pass1 body))
 				    (:VM_JMP ~retry-label)
-				    ~end-label))
+				    ~end-label
+                                    (:VM_POP)))
 	  ;;
 	  ('dotimes (var num) & body)
 	  (let [end-label (gensym),
@@ -316,6 +320,7 @@
 	      (:VM_BIND ~(make-sym var))
 	      ~retry-label
 	      ~@(apply concat (map compile-pass1 body))
+              (:VM_PUSH)
 	      (:VM_VREF ~(make-sym var))
 	      (:VM_PUSH)
 	      (:VM_IVAL ~(make-num 1))
@@ -326,8 +331,10 @@
 	      (:VM_IVAL ~(make-num num))
 	      (:VM_LE)
 	      (:VM_BIF ~end-label)
+              (:VM_POP)
 	      (:VM_JMP ~retry-label)
 	      ~end-label
+              (:VM_POP)
 	      (:VM_UNBIND 1)))
 	  ;;
 	  _	(compile-funcall (first exp) (rest exp)))


Hide entry form when there are entries.

Hide entry form when there are entries.

--- src/lab_notebook/core.cljs
+++ src/lab_notebook/core.cljs
@@ -61,16 +61,17 @@
         (apply dom/div nil
           (for [entry (:entries cursor)]
             (om/build item-view entry)))
-        (dom/div nil
-          (dom/h3 nil "New entry")
-          (om/build item-form {}
-            {:opts {:on-save (fn [summary date-time notes]
-                               (om/transact! cursor :entries
-                                 (fn [entries]
-                                   ((fnil conj []) entries
-                                    {:summary summary
-                                     :date-time date-time
-                                     :notes notes}))))}}))))))
+        (when (empty? (:entries cursor))
+          (dom/div nil
+            (dom/h3 nil "New entry")
+            (om/build item-form {}
+              {:opts {:on-save (fn [summary date-time notes]
+                                 (om/transact! cursor :entries
+                                   (fn [entries]
+                                     ((fnil conj []) entries
+                                      {:summary summary
+                                       :date-time date-time
+                                       :notes notes}))))}})))))))

 (defn app-container [cursor component]
   (reify


compile works now

compile works now

--- src/leiningen/protobuf.clj
+++ src/leiningen/protobuf.clj
@@ -1,4 +1,5 @@
 (ns leiningen.protobuf
+  (:refer-clojure :exclude [compile])
   (:use [clojure.java.shell :only [sh]]
         [clojure.string :only [join]]
         [leiningen.help :only [help-for]]
@@ -16,7 +17,7 @@
                "http://protobuf.googlecode.com/files/protobuf-%s.zip"
                version)))

-(defn- unzip [source target-dir]
+(defn- unzip [source target-dir]
   (let [zip (ZipFile. source)
         entries (enumeration-seq (.entries zip))
         target-file #(io/file target-dir (.getName %))]
@@ -68,7 +69,9 @@
   (flush)
   (join (.readPassword (System/console))))

-(defn fetch []
+(defn fetch
+  "Fetch protocol-buffer source and unzip it."
+  []
   (when-not (.exists (io/file srcdir))
     (with-open [stream (.openStream url)]
       (io/copy stream (io/file zipfile)))
@@ -104,6 +107,7 @@
             :dir srcdir :in password)))))

 (defn protoc
+  "Create .java and .class files from the provided .proto files."
   ([project protos] (protoc project protos "build/protosrc"))
   ([project protos dest]
      (when (or (> (modtime "proto") (modtime dest))
@@ -117,20 +121,26 @@
              :dir "proto"))
        (javac (assoc project :java-source-path dest)))))

-(defn compile-protos
-  "Compile protocol buffer files located in proto dir."
-  ([project] (compile-protos project (proto-files (io/file "proto"))))
-  ([project files]
-     (install)
-     (protoc project files)))
-
-(defn google
+(defn compile-google-protobuf
+  "Compile com.google.protobuf.*"
   [project]
   (let [proto-files (io/file "proto/google/protobuf")]
     (.mkdirs proto-files)
     (io/copy (io/file (str srcdir "/src/google/protobuf/descriptor.proto"))
              (io/file proto-files "descriptor.proto")))
-  (protoc project ["google/protobuf/descriptor.proto"] (str srcdir "/java/src/main/java")))
+  (protoc project
+          ["google/protobuf/descriptor.proto"]
+          (str srcdir "/java/src/main/java")))
+
+(defn compile
+  "Compile protocol buffer files located in proto dir."
+  ([project] (compile project (proto-files (io/file "proto"))))
+  ([project files]
+     (install)
+     (fetch)
+     (when (= "protobuf" (:name project))
+       (compile-google-protobuf project))
+     (protoc project files)))

 (defn ^{:doc "Tasks for installing and uninstalling protobuf libraries."
         :help-arglists '([subtask & args])
@@ -139,8 +149,6 @@
   ([project] (println (help-for "protobuf")))
   ([project subtask & args]
      (case subtask
-       "google"    (apply google project args)
-       "fetch"     (apply fetch args)
        "install"   (apply install args)
        "uninstall" (apply uninstall args)
-       "compile"   (apply compile-protos project args))))+       "compile"   (apply compile project args))))


Reformatted docstring of «scale-mv-context-with»

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/fca/many_valued_contexts.clj
+++ src/conexp/fca/many_valued_contexts.clj
@@ -301,9 +301,9 @@

     [att_1 att_2 ...] scale,

-  where att_i is an attribute of the given context and scale determines a call to a known scale. The
-  variable values will be bound to the corresponding values of each attribute and may be used when
-  constructing the scale. For example, you may use this macro with
+  where att_i is an attribute of the given context and scale determines a call to a known
+  scale. The variable «values» will be bound to the corresponding values of each attribute
+  and may be used when constructing the scale. For example, you may use this macro with

     (scale-mv-context-with ctx
       [a b c]  (nominal-scale values)


Another bug fix

Another bug fix

--- src/expound/specs.cljc
+++ src/expound/specs.cljc
@@ -1,6 +1,6 @@
 (ns expound.specs
-  (:require #?(:cljs [expound.alpha :as expound :include-macros true]
-               :clj [expound.alpha :as expound])))
+  (:require #?(:cljs [expound.alpha :as ex :include-macros true]
+               :clj [expound.alpha :as ex])))

 ;;;; public specs ;;;;;;


Only copy audio from non-original sources

--- src/video_server/ffmpeg.clj
+++ src/video_server/ffmpeg.clj
@@ -116,9 +116,9 @@

 (defn audio-to-encode
   "Returns the best audio stream to use for the target codec."
-  [audio-streams codec]
+  [audio-streams original? codec]
   (let [audio (reverse (sort-by #(parse-long (:bit_rate %)) audio-streams))]
-    (or (first (filter #(= (-> % :codec_name) codec) audio))
+    (or (and (not original?) (first (filter #(= (-> % :codec_name) codec) audio)))
         (first (filter #(= (-> % :disposition :default) 1) audio))
         (first audio))))

@@ -138,8 +138,8 @@
 (defn audio-encoder-options
   "Returns the ffmpeg options for encoding / copying the aac audio
   stream."
-  [audio-streams index codec]
-  (let [audio (audio-to-encode audio-streams codec)
+  [audio-streams index original? codec]
+  (let [audio (audio-to-encode audio-streams original? codec)
         exists (= (:codec_name audio) codec)]
     (conj ["-map" (str "0:" (:index audio))
            (str "-c:a:" index) (if exists "copy" codec)]
@@ -149,11 +149,11 @@
 (defn audio-options
   "Returns the ffmpeg options for encoding / copying the audio
   streams."
-  [{:keys [audio-streams]}]
-  (into (audio-encoder-options audio-streams 0 "aac")
-        (when-let [audio (audio-to-encode audio-streams "ac3")]
+  [{:keys [audio-streams original?]}]
+  (into (audio-encoder-options audio-streams 0 original? "aac")
+        (when-let [audio (audio-to-encode audio-streams original? "ac3")]
           (when (> (:channels audio) 2)
-            (audio-encoder-options audio-streams 1 "ac3")))))
+            (audio-encoder-options audio-streams 1 original? "ac3")))))

 (defn subtitle-options
   "Returns the ffmpeg options for copying the subtitle streams."