Is the World Ready for Self-driving cars?
Self driving electric cars will kill the oil industry.
Is the World Ready for Self-driving cars?
Self driving electric cars will kill the oil industry.
Crows trained to discard cigarette butts.
Seashore mallow as a biofuel.
Download ~/bin/lein.bat and run to setup. lein.bat has a variable to indicate the version being used. This can be changed to up/downgrade. Keep old versions of clojure should an upgrade break things.
~/.m2 contains the repository.
cd into the project directory and $lein deps to install/upgrade dependencies.
run lein clean occasionally
lein clean - delete build artifacts
lein deps - download dependencies, including clojure
lein javac - compile java code in project
Open core.clj
C-c M-j to cider-jack-in; repl prompt is XXX.core>
C-c C-e to evaluate an expression.
M-x occur ‘defn’ will open a new buffer with all method definitions listed. Click on one to go to it.
M-x imenu
(require ‘cider)
;;from: http://blog.jenkster.com/2013/12/a-cider-excursion.html
(defun cider-namespace-refresh ()
(interactive)
(cider-interactive-eval
“(require ‘clojure.tools.namespace.repl)
(clojure.tools.namespace.repl/refresh)”))
;;also see http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
(define-key clojure-mode-map (kbd “M-r”) ‘cider-namespace-refresh)
Clojure integration with R
Download and unzip SQLITE into a directory. I used c:\program files\sqlite3. This path will need to be referred to as c:\progra~1\sqlite3 in your lisp code and any batch files. Be sure to also download the associated executable file, which provides about 27 “dot” utility commands. Test that the systems works by creating a table and populating with data. To get started, create a batch file that starts SQLITE with the database name of interest, which is passed to the executable as a parameter. To create the database named “mydb”, the contents of sqlite.bat would be:
1 | c:\progra~1\sqlite\sqlite3.exe mydb |
At the sqlite prompt both dot and SQL commands can be submitted. To retain a record of the commands used to create your database, place them in a plain text file and then use the .read command to read that file into SQLITE. Here are the contents of my “create-tables.txt” file:
1 | CREATE TABLE ab ( |
To execute, read in create-tables.txt at the sqlite prompt:
1 | sqlite> .read "create-tables.txt" |
You can check that the table was created with the .schema command. Next insert a value. Either type it directly at the sqlite prompt, or read it from a file.
1 | INSERT INTO ab VALUES ( NULL,'Tau 46', 'human', 'mouse', 'Santa Cruz', 'sc-32274', 'IgG1', 'hu;mu;rat', 'western;ip;if','unknown'); |
And query it out:
1 | sqlite> SELECT * FROM ab; |
If you retrieve your row, you are all set to move on. Note that the assigned value of ab_id is NULL. Let the database assign the autoincrement field.
;;__________________________________________________________________________
;;;; Programming - SQLite
(add-hook ‘sql-mode-hook
‘(lambda ()
(interactive)
(sql-set-product ‘sqlite)
(sql-product-interactive sql-product)
;;(sql-connect-preset ‘pool-a))
(define-key sql-mode-map [f5] ‘sql-send-region)
(define-key sql-mode-map [f4] ‘sql-send-buffer)))
;;(add-hook ‘sql-interactive-mode-hook
;; )
;;(add-hook ‘sql-set-sqli-hook
;;Hook for reacting to changes of sql-buffer
;; (setq sql-database “~/owncloud/misc/pm/pm.sqlite”)
;; )
(setq sql-connection-alist
‘((pool-a
(sql-product ‘sqlite)
(sql-server “1.2.3.4”)
(sql-user “me”)
(sql-password “mypassword”)
(sql-database “~/syncd/prog/plate-manager/pm.sqlite”))))
(defun sql-connect-preset (name)
“Connect to a predefined SQL connection listed in sql-connection-alist'" (eval
(let ,(cdr (assoc name sql-connection-alist))
(flet ((sql-get-login (&rest what)))
(sql-product-interactive sql-product)))))
;; (add-hook ‘sql-interactive-mode-hook ‘my-sql-save-history-hook)
Men prefer debt-free virgins without tattoos
Explicates the problems of women going to college. “…Universities are definitely not safe places for women!…”
800 mile range
50 gallons water
Locking differential
~$3000 to ship to Halifax
7.5 foot width
Can navigate through 3 feet of water
This post will describe installation and interaction with rethinkDB using Javascript/Node.js. Ultimately I want to hook rethinkDB to Shiny. I am working on Debian/Jessie. Currently (August, 2017) rethinkDB will not install on Stretch.
1 | #echo "deb http://download.rethinkdb.com/apt `lsb_release -cs` main" | tee /etc/apt/sources.list.d/rethinkdb.list |
Start the server with the command “rethinkdb” at a terminal prompt. By default administrative tools are available at localhost:8080/.
cd to the working directory then install a node project
1 | mbc@dc7700s: cd ./syncd/prog/shiny/music |
Set the conn variable and interact with the database
1 | mbc@dc7700s:~/syncd/prog/shiny/music$ node |
Insert
1 | r.db('shiny').table('music').insert([{artist:'Boston', |
Update
1 | r.db('shiny').table('music'). |
Show all
1 | r.db('shiny').table('music').distinct().run(connection, function(err, result) { |
Delete all
1 | r.db('shiny').table('music').delete().run(connection, function(err, result) { |
The ‘launch.browser’ option to runApp() deals with the random port assigned by Shiny.
1 |
|
Aestivation: Aliens are hibernating until the average temperature of the universe cools a bit more which will make their information processing more efficient.