Clojureを仕事で使った経験をメモしておきます。 2015年の冬に本番稼働したシステムのため、使用したライブラリ等については、必ずしも現在の流行に沿っていないと思います。
- スタッフがウェブブラウザによりアクセスし、ログインして使用する業務システム
- 商品管理、売上管理、支払管理etc..
- DBテーブル数80程度
- 画面数200程度
| mysqldump -u user -p -h 127.0.0.1 --skip-lock-tables --single-transaction db | gzip > dump_`date +"%Y%m%d%H%M%S"`.sql.gz |
| ;; 引数の個数(アリティ)でわける方法 | |
| (defn myfunc1 | |
| ([arg] (myfunc1 arg "default")) | |
| ([arg opt] (format "arg=[%s] opt=[%s]" arg opt))) | |
| (myfunc1 "argument") | |
| ; => "arg=[argument] opt=[default]" | |
| (myfunc1 "argument" "option") | |
| ; => "arg=[argument] opt=[option]" |
ログを読んだだけではわからなかったものをメモ
2018-07-11 00:33:16 ERROR [codedeploy-agent(4374)]: Error validating the SSL configuration: Invalid server certificate
2018-07-11 00:33:16 ERROR [codedeploy-agent(4374)]: booting child: error during start or run: SystemExit - Stopping CodeDeploy agent due to SSL validation error. - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:64:in `abort
SSL証明書がどうとか書いてあるが、ネットワーク不通でも出る
2018-07-11 12:25:50 INFO [codedeploy-agent(21035)]: [Aws::CodeDeployCommand::Client 0 240.175208 3 retries] poll_host_command(host_identifier:"arn:aws:ec2:ap-northeast-1:xxxxxxxxx:instance/i-xxxxxx") Seahorse::Client::NetworkingError end of file reached
dockerのホストOSになぜか接続できず。 原因は、接続元ネットワークとdockerのブリッジネットワークがかぶっていたため。
https://qiita.com/chroju/items/5bff99d1c2c792575d32
AWS上でVPC Peeringを行う環境だったため
| $person = ['name' => 'matsutani']; | |
| if ($name = $person['name'] ?? null) { | |
| echo "hello, ${name}.\n"; | |
| } else { | |
| echo "you are anonymous.\n"; | |
| } |
| <?php | |
| define('PASSWORD_LENGTH', 6); | |
| function randGet($chars) { | |
| $n = rand(0, strlen($chars) - 1); | |
| return $chars[$n]; | |
| } | |
| function genpwd($length) { | |
| $alpha = 'abcdefghijklmnopqrstuwxyz'; |
| (ns myapp.component.session-cleaner | |
| (:require [com.stuartsierra.component :as component] | |
| [jdbc-ring-session.cleaner :refer [start-cleaner stop-cleaner]])) | |
| (defrecord SessionCleaner [db] | |
| component/Lifecycle | |
| (start [component] | |
| (if-not (:cleaner component) | |
| (assoc component :cleaner (start-cleaner (:spec db))) | |
| component)) |
| (ns try-typed.core | |
| (:require [clojure.core.typed :refer :all])) | |
| ; String型の引数をとりnilを返す | |
| (ann foo [String -> nil]) | |
| (defn foo | |
| "I don't do a whole lot." | |
| [x] | |
| (println x "Hello, World!")) |
| <?php | |
| //... | |
| //tableGatewayインスタンスからAdapterを取得する場合 | |
| $adapter = $this->tableGateway->getAdapter(); | |
| //ServiceManagerからAdapterを取得する場合 | |
| $sm = $this->getServiceLocator(); | |
| $adapter = $sm->get('Zend\Db\Adapter\Adapter'); |