通常4KB。
確認方法は以下の通り
$ getconf PAGESIZE
こっちでもOK
perl -e 'use POSIX; print POSIX::sysconf(POSIX::_SC_PAGESIZE)'
〜Linux/Solaris関連の作業メモ〜
通常4KB。
確認方法は以下の通り
$ getconf PAGESIZE
こっちでもOK
perl -e 'use POSIX; print POSIX::sysconf(POSIX::_SC_PAGESIZE)'
<table border="1" width="500" style="border: 1px #000000 solid; border-collapse: collapse; border-spacing: 0;"> <tbody> <tr> <td align="center" bgcolor="#c0c0c0">項目</td> <td align="center" bgcolor="#c0c0c0">説明</td> <td align="center" bgcolor="#c0c0c0">備考</td> </tr> <tr> <td align="center">テスト1</td> <td align="center">hoge</td> <td align="center">hage</td> </tr> <tr> <td align="center">テスト2</td> <td align="center">foo</td> <td align="center">bar</td> </tr> </tbody> </table>
項目 | 説明 | 備考 |
テスト1 | hoge | hage |
テスト2 | foo | bar |
面倒なのでかなり適当
/* =============================================== */
/** 01. Text - フォント・リンク */
/* ----------------------------------------------- */
* {
word-break: break-all;
}
body
, textarea {
font-family: "Hiragino Kaku Gothic Pro","ヒラギノ角ゴ Pro W3","MS Pゴシック",sans-serif;
}
メモメモ
<HR width="80%" align="left" color="red"> # <HR>には終了タグは不要
表示結果:
ああああ ああああ
ああああ
ああああ
utf-8を指定する場合の指定方法(以下どれでもOK)
# coding: utf-8 # coding=utf-8 # -*- coding: utf-8 -*- # vim: fileencoding=utf-8
サブクラスを作ったらこんなエラーが検出された。→ (解決)
TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given)
使用コード:
このコードは問題なかった。
#!/usr/bin/python # vim: fileencoding=utf-8 class hoge: def set_values(self, val): self.values = val def prt_values(self): print self.values
このコードに不備があった
#!/usr/bin/python # vim: fileencoding=utf-8 import hoge class sub_hoge(hoge): ←ココが× def prt_values(self): print 'value.subclass => "%s"' % self.values x = sub_hoge() x.set_values('hogehoge') x.prt_values()
結論としては、スーパクラスの呼び出し方が過っていたので正しく修正。
オンラインマニュアルに記載があった。
正しい例:
import モジュール名 class サブクラス名 (モジュール名.スーパークラス名):
使用例に当てはめると:
import hoge class sub_hoge (hoge.hoge): # モジュール名とクラス名が同じなので、ちょっと気持ち悪い
その他、解決法:
上記のように「モジュール名.クラス名」では無く、「クラス名」で直接使えるようになる。こっちの方がすっきり掛けるが複数のモジュールをロードする場合は、モジュール名を明示的に記述した方が見通しが良くなりそう。
from モジュール名 import スーパークラス名 class サブクラス名 (スーパークラス名):
スーパクラスとサブクラスを1つのファイル内で定義した場合は、モジュールの名の記載が不要となる為、最初の失敗例の記述と同等になる。
hogeクラスのサブクラスとしてsub_hogeを定義:
#!/usr/bin/python # vim: fileencoding=utf-8 class hoge: def set_values(self, val): self.values = val def prt_values(self): print self.values class sub_hoge(hoge): def prt_values(self): print 'value.subclass => "%s"' % self.values x = sub_hoge() x.set_values('hogehoge') x.prt_values()
実行結果:
value.subclass => "hogehoge"
これは想定どおり
各クラスごとモジュールファイルとして分割したらタイトルのエラーが発生
TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given)
ubuntu10.04で実施
$ aptitude install pychecker $ $ pychecker hoge.py # こんな感じで引数にテスト対象プログラムを指定 Processing module hoge (hoge.py)... Warnings... None
http://i2bskn.hateblo.jp/entry/20120325/1332659360
ここからダウンロードして".vim"ディレクトリに格納
$ cd /tmp; pwd $ wget http://www.vim.org/scripts/download_script.php?src_id=11062 $ mv download_script.php\?src_id\=11062 pydiction-1.2.zip $ unzip pydiction-1.2.zip $ mkdir -p ~/.vim/after/ftplugin/ $ cp pydiction-1.2/python_pydiction.vim ~/.vim/after/ftplugin/ $ mkdir -p ~/.vim/dict $ cp pydiction-1.2/complete-dict ~/.vim/dict/ $ cp pydiction-1.2/pydiction.py ~/.vim/dict/
$ cat <py > #!/usr/bin/python > # vim: fileencoding=utf-8 > END $ mv py ~/.vim/skel/
" ------- " Python filetype plugin on autocmd FileType python :map:!pychecker % autocmd FileType python :map :!python % autocmd FileType python let g:pydiction_location = '~/.vim/dict/complete-dict' autocmd FileType python setl autoindent autocmd FileType python setl smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class autocmd FileType python setl expandtab tabstop=4 shiftwidth=4 softtabstop=4 function! s:ExecPy() exe "!" . &ft . " %" :endfunction command! Exec call ExecPy() autocmd FileType python map :call ExecPy() augroup SkeletonAu autocmd! autocmd BufNewFile *.*py 0r $HOME/.vim/skel/py augroup END
利便性を重視(セキュリティを無視)してanonymousでもファイルアップロードができるように変更。
(実現方法は色々ありそうだけど未調査。パラメータを思いつきで変更)
FTPサーバにcentos5.5標準のvsftpd、サーバにUbuntu10.04を使用
$ cat /etc/redhat-release CentOS release 5.5 (Final) $ uname -a Linux testsrv 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
インストールとか
$ sudo yum install vsftpd # インストール $ sudo service vsftpd start # 起動 $ sudo chkconfig vsftpd on # 自動起動on
アップロードしようにも権限が無いというエラー発生。ディレクトリもpubディレクトリには移れるが書き込み権限がない。
hoge@clientsrv:$ ftp testsrv Connected to testsrv. 220 (vsFTPd 2.0.5) Name (testsrv:hoge): anonymous 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> put test.txt local: test.txt remote: test.txt 200 PORT command successful. Consider using PASV. 550 Permission denied. ftp> ftp> cd ../ 250 Directory successfully changed. # 成功したように見えてディレクトリはホームディレクトリから変わらず・・・ ftp> pwd 257 "/" ftp> ls 200 PORT command successful. Consider using PASV. 150 Here comes the directory listing. drwxr-xr-x 2 0 0 4096 May 25 2010 pub 226 Directory send OK. ftp> cd pub # pubディレクトリには移れる 250 Directory successfully changed. ftp> ls 200 PORT command successful. Consider using PASV. 150 Here comes the directory listing. 226 Directory send OK. ftp> put test.txt local: test.txt remote: test.txt 200 PORT command successful. Consider using PASV. 550 Permission denied. # が、書き込み権限(もしくはUpload権限?)が無い為NG
anonymousのアップロードに必要そうなパラメータを有効化
$ sudo vi /etc/vsftpd/vsftpd.conf anonymous_enable=YES # デフォルトで有効化されていたので変更なし anon_upload_enable=YES # コメントを外す(Fileのアップロードを可能にする) $ sudo service vsftpd restart # サービスを再起動
ftp接続時に見えるpubディレクトリのパーミッションを書き込み可能に変更
$ sudo ll -d /var/ftp/pub/ drwxr-xr-x 2 root root 4096 5月 26 2010 /var/ftp/pub/ $ sudo chmod 777 /var/ftp/pub/ $ sudo ll -d /var/ftp/pub/ drwxrwxrwx 2 root root 4096 5月 26 2010 /var/ftp/pub
ftp> cd pub # pubディレクトリに移動して... 250 Directory successfully changed. ftp> ls 200 PORT command successful. Consider using PASV. 150 Here comes the directory listing. 226 Directory send OK. ftp> put test.txt # 転送→OK local: test.txt remote: test.txt 150 Ok to send data. 226 File receive OK. 101 bytes sent in 0.01 secs (10.5 kB/s)
$ ll /var/ftp/pub/ 合計 4 -rw------- 1 ftp ftp 101 4月 20 12:47 test.txt # ftpユーザが所有者となる
たぶん、ログインディレクトリなど関連するパラメータも変更要。時間の都合により未調査。
$ sudo vi /etc/vsftpd/vsftpd.conf ftp_username=hoge # 追記 $ sudo service vsftpd restart
hoge@clientsrv:$ ftp testsrv Connected to testsrv. 220 (vsFTPd 2.0.5) Name (testsrv:hoge): anonymous 331 Please specify the password. Password: 500 OOPS: vsftpd: refusing to run with writable anonymous root Login failed. ftp> ls 421 Service not available, remote server has closed connection ftp> bye
このページを参考にCSSの設定を変更した。
/*** blockquote & pre */ div.article-body blockquote , div.article-body pre { padding: 15px 20px; margin: 5px 0; font-size: 100%; overflow: auto; # この行を追記 }
edworld