Skip to content

Instantly share code, notes, and snippets.

## websocket_app.erl
-module(websocket_app).
-behaviour(application).
-export([start/2]).
-export([stop/1]).
=INFO REPORT==== 9-Mar-2014::03:03:41 ===
application: websocket
exited: {bad_return,
{{websocket_app,start,[normal,[]]},
{'EXIT',
{{badmatch,{error,{already_started,<0.53.0>}}},
[{websocket_app,start,2,
[{file,"src/websocket_app.erl"},{line,26}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},{line,272}]}]}}}}
Erlang/OTP 17 [RELEASE CANDIDATE 2] [erts-6.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V6.0 (abort with ^G)
(websocket_example@127.0.0.1)1> application:stop(websocket).
=INFO REPORT==== 8-Mar-2014::02:51:11 ===
application: websocket
exited: stopped
type: permanent
ok
{application, hello_erlang, [
{description, "Hello world with Cowboy!"},
{vsn, "0.1.0"},
{modules, []},
{registered, [hello_erlang_sup]},
{applications, [
kernel,
stdlib,
cowboy
]},
PROJECT = websocket
DEPS = cowboy erldn
dep_cowboy = pkg://cowboy master
dep_erldn = https://github.com/txrev319/erldn.git master
The following code
(defn do-stuff [msg]
(hmatch msg
[:dog age name] (println "got a dog with age " age " and name " name)
[:cat cute? legs] (println "got a cat that is " cute? " cute and has " legs "legs")
[other] (println "got an unrecognized animal of type " other ))
becomes:
Compiling "resources/public/out/main.js" from ["cljs"]...
Compiling "resources/public/out/main.js" failed.
clojure.lang.ExceptionInfo: failed compiling file:cljs/util/reactive.cljs
core.clj:4327 clojure.core/ex-info
compiler.clj:990 cljs.compiler/compile-file
compiler.clj:1051 cljs.compiler/compile-root
closure.clj:398 cljs.closure/compile-dir
closure.clj:437 cljs.closure/eval2650[fn]
closure.clj:301 cljs.closure/eval2578[fn]
closure.clj:451 cljs.closure/eval2637[fn]
java.lang.StackOverflowError
at clojure.lang.RT.length(RT.java:1646)
at clojure.lang.RT.seqToArray(RT.java:1587)
at clojure.lang.ASeq.toArray(ASeq.java:146)
at clojure.lang.RT.toArray(RT.java:1565)
at clojure.core$to_array.invoke(core.clj:333)
at clojure.core$format.doInvoke(core.clj:5178)
at clojure.lang.RestFn.invoke(RestFn.java:460)
at clojure.core$fn__5497.invoke(core_print.clj:380)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
catcher(N) ->
try generate_exception(N) of
Val -> {N, normal, Val}
catch
throw: X -> {N, caught, thrown, X};
exit:X -> {N, caught, exited, X};
error:X -> {N, caught, error, X}
end.
(defun switch-to-buffer-if-exists (nm)
(if (get-buffer nm)
(switch-to-buffer nm)
(message (format "Buffer %s does not exist" nm))))
(defun switch-to-buffer-if-exists-cmd (nm)
(lambda ()
(interactive)
(switch-to-buffer-if-exists nm)))