Shammer's Philosophy

My private adversaria

2016-01-01から1年間の記事一覧

rewrite http-read-line of http://d.hatena.ne.jp/shammer/20160320/p1

In the article Lisp HTTP Client handling chunked responses - Shammerism, I wrote a HTTP client which can handle chunked response. In this article, the function whose name is http-read-line uses do loop, but I would like to rewrite as recur…

Lisp repeat-string

I wrote this article to concatenate some character without dotimes, using with-output-to-string instead. But, I noticed more easy way to recursive function. Here is a last version. (defun str (x) (typecase x (cons (concatenate 'string (str…

How to add same character repeatedly without dotimes?

Sometimes I want to add some character repeatedly like generating something depended on how many there are. For example, organizing a file name with sequence numbers which might be different length, the length of sequence number 0 is 1, bu…

my is-dot-cons is a bad function...

I wrote is-dot-cons to check if it is a dot cons written at Is normal cons? Is dot cons? - Shammerism, but it has a bug. This function is not considered the following cons. ("100" . '(10 20 30))This is a dot cons, but cdr is not atom, so m…

Is normal cons? Is dot cons?

There is a case to want to know that the cons is normal cons or dotted cons. In detail, the cons is like ("A" "B") or ("A" . "B"). These cons have a difference how to handle right element. If the cons is like ("A" "B"), the function cadr c…

Using find-if instead of remove-if-not

This is a continuous article of remove-if と remove-if-not を理解する - Shammerism and find と remove-if-not - Shammerism. Lisp functions end-with -not would be deprecated in the future, so I have to get used to use functions which are not…

Lisp HTTP Client handling chunked responses

I wrote an HTTP client with ClozureCL, and this can handle chunked response. (defparameter *remote-host* "d.hatena.ne.jp") (defparameter *remote-port* 80) (defparameter *client-stream* nil) (defmacro connect-operation (&rest body) `(with-o…

Bash Shell Script my pocket reference - 20160316

Updated from Bash Shell Script my pocket reference - 20151206 - Shammerism. Added the way how to check if the valuable is not blank and others. if 文 sample if basic if [ $# -ne 1 ];then echo "Usage: $0 [123]"; exit 1; fi if [ $1 -eq 1 ];t…

Waiting until network enabled

If I have something to do when the host launched and it requires network, I have to consider that network access not prepared when the something invoked. It is useful to wait network preparation completed. This is a sample. while true; do …

Test connecting PostgreSQL DB from tomcat8

This is an continued article of PostgreSQL JDBC Driver on tomcat8 - Shammerism. There is a JSP tag library to connect Database and showing the search result. There are a lot of links, one of them is https://www.tutorialspoint.com/jsp/jsp_s…

PostgreSQL JDBC Driver on tomcat8

I setup DB Application on tomcat8, host OS is Debian Jessie and JavaVM is OpenJDK 1.7.0_151. At first, I used JDBC Driver which can be installed with apt-get, but it doesn't work fine. I saw a stack trace which is began with "java.lang.Abs…

eval-whenを試す

スクリプトとして実行された場合のみ実行したいという処理をどうすればいいか。どうやらeval-whenを使用すればこれができそうに思った。過去にちょっとだけ見たことがあるようだ。パッケージ名の取得でコケた・・・ - Shammerismでちょっとだけ言及している…

Windowsでstatic routeを保存できない?

Windowsのルート情報はroute Add とかで設定できる。そして、-p オプションを使用することでルーティング情報を再起動後も保持できるようだ。 自分の検証用Windows 7 に複数のNICがあるものがあり、当然片方だけにDefault Gatewayを設定している。そして、必…

Install DDSKK 15.2 into Emacs 24.5.1 on Mavericks

I upgraded my Emacs in my Mavericks environment. I installed ddskk in /Application/Emacs.app, so I have to re-install ddskk also. I did the procedure like /Applications/Emacs 以下に SKK をインストール - Shammerism, but editing SKK-CFG is n…

Resolved the issue of 2016-02-12

I wrote the issue several days ago, the article is Could not create connection to www.emacswiki.org:443 - Shammerism. I can make this issue resolved by updating openssl via brew. The procedure is below. brew update brew upgrade openssl sud…

Could not create connection to www.emacswiki.org:443

Since a few days ago, I faced with the problem when Emacs launching. The error message is below. error in process filter: Could not create connection to www.emacswiki.org:443I have no idea what is the root cause. But I can avoid this error…

CLI command execution automation

I wrote an article about sshpass as Automate the operation started from ssh login - Shammerism, but I found an easier way. Step is below. Create a file written in the CLI commands which I would like to execute cat $ABOVE_FILE | sshpass -p …

Change character encoding to UTF-8

This is an second version of 文字コードをまとめて変換するスクリプト - Shammerism. The before article handles multiple files at one time, but this version handles only 1 file. #!/bin/bash NKF_CHECK=`which nkf | wc | awk '{print $1}'`; if [ …

Install Clozure CL 1.11 to Debian wheezy running as Xen VM

I tried to install Clozure CL 1.11 into my Debian wheezy running as Xen VM. At first, I tried the way as well as Install Clozure CL 1.10 to Debian wheezy - Shammerism, but it finished with Error. root@tora2017:/usr/local/src/ccl/lisp-kerne…

文字列を16進数の配列に変換する

Socket 通信をバイトでやりとりするときに、文字列をそのまま16進数の文字列に変換したいことがあるのでそれを書いてみた。想定では、0から9、aからfのいずれかの1文字、2文字で一つの16進数を表現すること、先頭から読み込むと先頭が1バイトの時に正確な値…

How to send long http header requests with curl?

This is a memo for me. $ HEADER="X-Header: X" $ for i in `seq 1 65535`;do HEADER="${HEADER}X";done $ curl -v -H "${HEADER}" http://www.test.local/The parameter should be enclosed with double quote. Without enclosing double quote, curl can …

Socket server sample with string-output-stream returns response from text files

string-output-streamをサーバーで使ってみる - Shammerismを改良し、応答をファイルから読み出したデータで返すことにする。あらかじめ、x.txtという名前のファイルを用意しておく。 $ echo 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy…