我正在尝试使用最近发布的armv7的ghc二进制文件来启动和运行raspberry pi 2,可在此处获取:
https://www.haskell.org/ghc/download_ghc_7_10_2#linux_armv7
这说它是用debian jesse构建的,所以我在我的pi2上安装了debian jesse.我成功安装了ghc - 至少ghci工作.但是没有阴谋,显然ghc 7.10.2要求阴谋1.22+.debian版本的cabal类似于1.16(并且还将安装ghc 7.6.x).所以我正在尝试使用bootstrap.sh脚本从源代码安装cabal-install.下载mtl包并构建一个'Setup'可执行文件,然后尝试执行它.但安装程序exe失败了"非法指令".
根据下载页面,需要'gold'链接器.我补充说,这样做
ln -s
which gold~/bin/ld
并设置我的路径包括〜/ bin.遗憾的是,结果相同.
接下来,我尝试用金重新安装ghc二进制文件(我认为).所以作为root:
> ln -s `which gold` /usr/local/bin/ld
> cd ghc-7.10.2
> make install
Run Code Online (Sandbox Code Playgroud)
ghc再次成功安装,但构建cabal-install的结果是相同的:
bburdette@jessie-rpi:~/code/cabal/cabal-install$ ./bootstrap.sh
Using gcc for C compiler. If this is not what you want, set CC.
Using /usr/lib/gcc/arm-linux-gnueabihf/4.9/collect2 instead.
Checking installed packages for ghc-7.10.2...
deepseq is already installed and the version is ok.
binary is already installed and the version is ok.
time is already installed and …Run Code Online (Sandbox Code Playgroud) 我希望我的clojure程序有一个可以运行的脚本目录 - 每个脚本都是我用load-file执行的clojure代码.这将在未来发生,以便脚本在其自己的线程中运行.
问题是我从未看到脚本中的任何错误消息.如果脚本失败,则无法知道出了什么问题.我认为这是因为未来的线程中没有异常处理.我可以将异常处理放入脚本中,如下所示,它可以工作:
;; script code
(try
(println (/ 10 0))
(catch Exception e
(println "Exception: " (.getMessage e))))
Run Code Online (Sandbox Code Playgroud)
但是,我宁愿在加载文件周围加上异常处理,因此我不必在脚本本身中进行异常处理:
(defn handleexes [f]
(try
(f)
(catch Exception e
(println "exception: " (.getMessage e)))))
(defn start-script-play [name]
(println "starting script: " name)
(let [f (future (handleexes (load-file (str "./scripts/" name))))]
(swap! scripts (fn [s] (assoc s name f)))))
Run Code Online (Sandbox Code Playgroud)
所以我在handlexes中调用load-file.这不起作用 - 主要是.当我运行包含自己的异常处理程序的脚本时,它会工作,如上所述!没有脚本中的异常处理程序,没有.奇怪的.
好吧无论如何,所以我的问题是这里到底发生了什么?
我想将Elm用于我的Web前端,而Rust则用于服务器.但是,我遇到了一个问题,即elm-socketio的websockets版本不适用于rust-websocket.据我所知elm-socketio有websockets版本"2.0.0"(我发现搜索socketio.js与elm-socketio一起使用的字符串),而rust-websocket的版本为"13".在Rust中,当收到不匹配的版本时会发生异常.我注释掉版本检查只是为了看看会发生什么,我得到了这个:
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RequestError("Missing Sec-WebSocket-Key header")', src/libcore/result.rs:731
Run Code Online (Sandbox Code Playgroud)
所以我想我的问题是,如果没有重要的工作,这两个可以相互合作吗?是否真的有2.0.0版本的websockets,与RFC6455不同,这是rust-websocket所指的(并且版本为"13")?
我无法在Domina的touchstart活动中获得'touch'或'changedTouches'列表.
这是我的:需要的东西:
(ns myproj
(:require-macros [hiccups.core :as h])
(:require [domina :as dom]
[hiccups.runtime :as hiccupsrt]
[domina.events :as ev]
[cljs.reader :refer [read-string]]
[wsosc :as wo]
[clojure.browser.repl :as repl]
))
Run Code Online (Sandbox Code Playgroud)
这是我的touchstart事件处理程序:
(defn touchstart [evt]
; store event in an atom for repl access
(swap! de (fn [x] evt))
; print something to html to show a result (no console on the phone)
(dom/set-text! (dom/by-id "result") (str "blah" evt))
; hopefully someday extract touch coordinates here.
(let [rct (.getBoundingClientRect (dom/by-id "osccanvas"))
;touchlist1 (get …Run Code Online (Sandbox Code Playgroud)