Jim Cheung

Friday, May 01, 2015

I thought I was burnout, but after a week of doing nothing with computer, felt bored, super bored.

Try to pick up reading again, and do some little programming when I'm free. still stay away from news.

Sunday, May 03, 2015

picking up clojure again, reading Living Clojure.

this time is easier, maybe I still remember what I read from those lisp books...

Thursday, May 07, 2015

almost finish Living Clojure, will probably read the macro chapter later. it's a nice book, can start working on real world project after reading it.

I think I'll focus on clojure for now, it combines lisp, java (jvm), go (core/async) and javascript (clojurescript), which are languages I've been learning for the last year.

Seven Web Frameworks in Seven Weeks talks about two clojure frameworks, ring and immutant (actually they are both libraries, not really a framework), I may take a look at them and also compojure.


Thinking about upgrade to http2, in java world, jetty and undertow both implemented http2. however, TLS is one problem (no browser is willing to support non-TLS http2). anyways, wait for nginx probably.


Orgzly, org-mode on android. Tried, pretty good. Still need to find a better way to sync files (it supports dropbox, git repo is coming).

Saturday, May 09, 2015

quite a few posts about "old programmers" recently


tried Facebook PathPicker, quite nice.

Monday, May 11, 2015

reading this long thread: What is the appeal of dynamically-typed languages? : programming

one thing I was wondering is why clojure is dynamically typed? (surely Rich Hickey has his reason for this decision). clojure has been mentioned quite a lot in this thread.

also found this comment useful for quick start a Reagent project:

lein new reagent my-app
cd my-app
lein ring server
// server started and browser opened

// in a different terminal
lein figwheel
// start clojurescript compiler and watch for changes

then change to src/cljs/my_app/core.cljs will instantly reflected in the browser autometically. (cool ~)

the commenter is creator of Luminus framework, and wrote Web Development with Clojure, which is on my reading list already.

Tuesday, May 12, 2015

for the http2 upgrade, nginx may need to wait 11 months, so will try tatsuhiro-t/nghttp2 first, using dockerfile from dajobe/docker-nghttp2


saw Swagger while reading news, looks good. here is there ui component: swagger-api/swagger-ui

there is a ring wrapper for clojure: metosin/ring-swagger

for php: Swagger-PHP, and Laravel: slampenny/Swaggervel

also found some tools for my clojure stack:

other things just use java, pretty much what I need for now.

The Clojure Toolbox has more links.

Wednesday, May 13, 2015

for a long time I use jackrabbit webdav clinet, today I just tried lookfirst/sardine, and it's a lot cleaner and easy.

String baseUrl = "https://webdav.example.com/folder";
Sardine sardine = SardineFactory.begin("username", "password");
List<DavResource> resources = sardine.list(baseUrl);
resources.stream().forEach(System.out::println);

String filename = "file.txt";
InputStream is = sardine.get(baseUrl + filename);
Files.copy(is, Paths.get(filename));

(note, for a simple GET, use curl is easier)

Friday, May 15, 2015

Javaslang is a component that brings more functional to java, interesting.

but i'm already very satisfied with java 8. more and more of my scripting tasks have been moved to java 8 and clojure. now it's more simple to write, runs everywhere and standalone (all in one jar), it can also give you concurrency anytime you want.

Sunday, May 17, 2015

the big news of course is Announcing Rust 1.0, it's funny that everything is positive before a language hits 1.0, then people start complaining, suddenly everybody hates it. just like ruby, nodejs, go. I don't have time for rust right now, and still too soon to jump in.


I don't feel like coding nodejs anymore, but Electron is interesting. when Light Table came out, I already feel that it's the way to do cross platform.


for clojure descjop is a quick way to setup a electron (atom-shell) project, just follow the steps I can have a hello world desktop app up and running, how nice.


continuing adding tools to my website stack, will add a redis as cache and message queue. I can setup a rabbitmq / kafka / nsq, but redis is simple and good enough. ptaoussanis/carmine · GitHub is a redis client for clojure.

Thursday, May 21, 2015

my thrid attempt on reading Clojure Programming, still find it challenging. anyways, keep trying.

Friday, May 22, 2015

there's an article (Advantages of monolithic version control) talks about putting all stuffs in a big repo, which I found makes sense to my projects.


got confused about the usage of ->, ->>, comp, but found a good explaination here:

(from Can someone explain Clojure Transducers to me in Simple terms? - Stack Overflow)

they all do the same:

nested calls

(reduce + (filter odd? (map #(+ 2 %) (range 0 10))))

functional composition

(def xform
  (comp
    (partial filter odd?)
    (partial map #(+ 2 %))))
(reduce + (xform (range 0 10)))

threading macro

(defn xform [xs]
  (->> xs
       (map #(+ 2 %))
       (filter odd?)))
(reduce + (xform (range 0 10)))

With transducers:

(def xform
    (comp
        (map #(+ 2 %))
        (filter odd?)))
    (transduce xform + (range 0 10))

and another explaination of "why":

(from Difference between arrow and double arrow macros in Clojure - Stack Overflow)

As a rule, when a function works on a singular subject, that subject is the first argument (e.g., conj, assoc). When a function works on a sequence subject, that subject is the last argument (e.g., map, filter).

So, -> and ->> are documented as threading the first and last arguments respectively, but it is also useful to think of them as applying to singular or sequential arguments respectively.

For example, we can consider a vector as a singular object:

(-> [1 2 3]
    (conj 4)         ; (conj [1 2 3] 4)
    (conj 5)         ; (conj [1 2 3 4] 5)
    (assoc 0 0))     ; (assoc [1 2 3 4 5] 0 0)
=> [0 2 3 4 5]

Or we can consider it as a sequence:

(->> [1 2 3]
    (map inc)        ; (map inc [1 2 3])
    (map inc)        ; (map inc (2 3 4))
    (concat [0 2]))  ; (concat [0 2] (3 4 5))
=> (0 2 3 4 5)

Monday, May 25, 2015

I pick Selmer as templating language after reading Choosing a templating language in clojure

for a new created compojure app, its standalone jar file is about 7M, smaller than I expected.

will put it in a docker container - I didn't think container is good for jvm app, since it is already running in a vm. but now I think maybe it's not a bad idea, the architecture is different now, things are decoupled to many small standalone components, use docker to manage them is easy and clean.

Tuesday, May 26, 2015

I don't quite understand transducer yet, even after some readings:

I think there will be more on transducers when clojure 1.7 releases, just skip it for now.


There's a super cool firefox add-on: Window Master, very useful when you have more than one monitors.

Wednesday, May 27, 2015

lispy is a paredit-like emacs package for editing lisp codes, but using vi key bindings. however, I found it doesn't work well with evil-mode.

evil-lisp-state is another one, but extra keystrokes for the leader comination prefix.

Thursday, May 28, 2015

reading Read Lisp Hackers, I really like it, especially Pascal Costanza's chapter.

one of the interviewer, Edi Weitz, is writing a book: Common LISP Recipes: A Problem-Solution Approach

Friday, May 29, 2015

reading some old issues of Linux Journal, on November 2014 Issue it introduced ZBackup, simple, very *nix. I will use it as my backup tool.

the other article on using ssh-agent to store authentication keys and allowing normal users sudo to a special account then they can access remote servers, also an interesting one.

Saturday, May 30, 2015

lein is slow, I tried drip but seems not helping, may try something simular later.

Blog Archive