Common Lisp

Aserve でURLリダイレクト

こちらのチュートリアルを参考How to do redirects using AllegroServe http://franz.com/support/tutorials/aserve-redirect-tutorial.htm (publish :path "/new" :content-type "text/html" :function #'(lambda (req ent) (with-http-response (req ent :…

AserveにMIMEタイプを追加する

SVG(Scalable Vector Graphics)のMIMEタイプを追加するためAserveの以下のファイルを編集。dists/quicklisp/software/portableaserve-20150923-git/aserve/publish.cl ("image/svg+xml" "svg") ("image/svg+xml" "svgz")

Aserveでフォームから入力データを受け取る

SBCL & Aserve でHTMLフォームよりデータを受け取る処理です。HTMLフォーム <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>テスト</title> </head> <body> <form action="/app/form.html" method="post"> <h3>フォームテスト</h3><br> 名前<br> <input type="text" name="name" size="40"><br><br> 性別<br> </form></body></html>

CLSQLでMySQLを使う

1. MySQLのユーザとDBの作成# mysql mysql> GRANT ALL PRIVILEGES ON *.* TO testuser@localhost IDENTIFIED BY 'password' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES;mysql> CREATE DATABASE testdb CHARACTER SET utf8;# mysql -p -u testuser testdb※…

CLSQLでPostgreSQLを使う

1. PostgreSQLのユーザとDBの作成# su - postgres $ createuser -P testuser $ createdb -O testuser testdb $ psql -h localhost -U testuser testdb※接続が正常にできることを確認2. ライブラリのシンボリックリンク作成CLSQLで実際にDBに接続するときにli…

Aserveを常駐プロセス(デーモン)にする

main.lispを編集 (ql:quickload "aserve") (ql:quickload :swank) (defpackage cl-web (:use :cl :swank :net.aserve)) (in-package :cl-web) (require :aserve) (NET.aserve:start :port 5000) (swank:create-server :port 4005 :style :spawn :dont-close …

Aserve & CL-EMB

Aserve でテンプレートエンジンの CL-EMB を使ってみました。hello.tmplを作成 <html> <head><title>テストページ</title></head> <body> <% @var name %> </body> </html> Lipsコード (defun to-octets-string (str) (let* ((arr (sb-ext:string-to-octets str :external-format sb-impl::*default-external-format…

Aserve & Swank によるホットデプロイ

サーバ側 (ql:quickload "aserve") (ql:quickload :swank) (defpackage cl-web (:use :cl :swank :net.aserve)) (in-package :cl-web) (require :aserve) (net.aserve:start :port 5000) (net.aserve:publish :path "/" :content-type "text/html; charset=U…

Aserveで日本語(マルチバイト)表示

Aserveで日本語(マルチバイト)を表示しようとするとできなかったのでこちらのサイトを参考にしました。http://hirodanjyuro.blogspot.jp/2010/06/blog-post.html (defun to-octets-string (str) (let* ((arr (sb-ext:string-to-octets str :external-forma…

ApacheとAserveの連携

http://xxx.xxx.xxx/cl/にアクセスしたときにポート5000でリッスンしているAserveと連携するよう設定します。Apacheの設定ファイル /etc/httpd/conf/httpd.conf の最後に以下の2行を追加しApache再起動します。ProxyPass /cl/ http://localhost:5000/ ProxyP…

AserveでHello World!

Aserveを使ってHTMLを生成してページを表示します。 (ql:quickload "aserve") (require :aserve) (net.aserve:start :port 5000) (net.aserve:publish :path "/" :content-type "text/html; charset=UTF-8" :function #'(lambda (req ent) (net.aserve:with-…

Common Lisp開発環境の構築

ASUS EeeBook Windows 10 32bit環境にCommon Lispの環境を構築1. Clozure CLのインストール http://ccl.clozure.com/ダウンロードページよりWindows用のzipをダウンロードし解凍する。解凍後、環境変数のPathに追加する。解凍場所 C:\Program Files\ccl2. NT…