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

pylons routes

>>> m = Mapper() >>> m.resource('location', 'locations', ... parent_resource=dict(member_name='region', ... collection_name='regions')) >>> # path_prefix is "regions/:region_id" >>> # name prefix is "region_" >>> url('region_locations', re…

基礎データ 郵便番号、駅データ postgres

基礎データ[PostgreSQL] 郵便番号辞書をデータベースに投入する手順 Kawanet Blog II/ウェブリブログ駅データ、緯度経度つき 駅データ 無料ダウンロード 『駅データ.jp』

php PEAR Cache_Lite

ファイルベースのキャッシュhttp://pear.php.net/manual/ja/package.caching.cache-lite.php http://pear.php.net/manual/ja/package.caching.cache-lite.cache-lite.cache-lite.phphttp://logic.stepserver.jp/data/archives/334.html require_once('Cache/…

python de slug スラグ

import re,string replacement = '-' text = 'bitter sweet & love' slug_str = re.sub('[%s]+' % re.escape(string.punctuation + string.whitespace), replacement, text) slug_str = slug_str.strip(replacement) print slug_str bitter-sweet-love

SQL ALTER TABLE

PostgreSQL関連メモ - adiary開発日誌 目的 SQL NOT NULLを付ける ALTER TABLE table ALTER COLUMN [col] SET NOT NULL NOT NULLを外す ALTER TABLE table ALTER COLUMN [col] DROP NOT NULL DEFAULTを付ける ALTER TABLE table ALTER COLUMN [col] SET DEFA…

python 真偽値

if と真偽値 | すぐに忘れる脳みそのためのメモ 空文字・空リストは 偽 。

IPMI 監視

サーバのエラーランプの内容をOSから確認する。IPMI FreeBSD FreeBSD - CPUの温度など、ハードウェアの状態を知る。IPMI | テクニカルイルカルテBIOS・準備 # kldload ipmi(確認) # kldstat 起動時に自動的にロードする場合は以下を追加。vi /boot/loader.co…

first() one()

Page not found — SQLAlchemy 1.3 Documentation first() Return the first result of this Query or None if the result doesn’t contain any row. This results in an execution of the underlying query.one() Return exactly one result or raise an exc…

lazy はキャッシュしない方が

The issue I ran into with the above code dealt with related tables. The default behavior for SQLAlchemy is for related table attributes to be lazy-loaded. Once the orm object has been detached from session, the related attribute no longer …

sqlalchemy

("param:").params(param=arg) はプレースホルダ "%s" % (arg) は置換 なので前者はエスケープあり、後者はなし → 確認params()を使った場合のsubquery()の動作http://www.braindonor.net/coding-blog/sqlalchemy-and-memcached/151/

postgres temp function

PostgreSQL:一時関数 create temp function | 作業日報 一時的な関数を利用したい場合は pg_tempスキーマを利用できる、但しVer 8.2.4以降。 drop function if exists pg_temp.test(int);create function pg_temp.test(int) returns integer as $$ begin ret…

postgres 年齢計算

やっべー これは便利だ。 - しすてむ さんぽみち。 age(datetime,datetime) 例: age('now','1957-06-13'::datetime) ::datetime がきかないときは ::timestamp で試して見ましょう! ↑は何歳何ヶ月・・・みたいにでるので 年齢だけとりたい場合は下記のよう…

コンテンツ

(a) 1人の消費できるコンテンツ量 > (b) 過去に制作されたコンテンツ(a)は寿命、(b)は増加、リセットされることはない 古典とのパイの奪い合い ライブ、ust 手売り コンテンツや技術が0円になっていく時代に僕らはどう生きていくのか? - teruyastarはかく…

mrtg snmp

snmp+mrtgの設定のメモ — ありえるえりあ 監視対象のサーバに snmpd をたてる 設定ファイル生成 cfgmaker 複数サーバを指定可能 インデックスページ作成 indexmaker

SQL ORDER BY 条件

全ては時の中に… : 【SQL】ORDER BY句に指定する項目を条件によって変更する SELECT * FROM 商品テーブル ORDER BY CASE WHEN 優先 IS NOT NULL THEN 整列順序 END, 商品分類, 商品コードpostgresqlもokhttp://memo.jj-net.jp/250 ORDER BY句には条件式が記…

httpd.conf KeepAlive

株式会社スタイルズ http://nosa.cocolog-nifty.com/sanonosa/2004/06/keepalive.htmlバーチャルホストごとに設定 ちなみに、KeepAlive の設定は、Apache であればバーチャルホストごとに変えることができます。 VirtualHost ディレクティブの中に、KeepAliv…

参考

http://neta.ywcafe.net/001049.html via http://neta.ywcafe.net/000960.html via http://www.nonsensecorner.com/wp25/?p=3895

postgresql 全文検索

textsearch_ja : 形態素解析方式 全文検索 textsearch_senna : N-gram方式 全文検索 形態素解析方式 △辞書のメンテ N-gram方式 △検索結果のノイズ Ngram(N-gram)とは何か & 形態素解析との比較テキスト検索の方法とインデックス | Let's Postgres 単語検索で…

awk tips

awk 1行目をスキップ awk 'NR>1 {print}' file データファイル処理に便利なUNIXコマンド awk シングルクォーテーションを出力 この時、シングルクォーテーションをそのまま書いても awk では解釈してくれないので、8 進数のエスケープシーケンスである「\04…

awk 複数行を1行に

#はコメントとして除く $ awk -v ORS=' ' '!/^#/ {print}' file file を aaa bbb #ccc ddd こう aaa bbb ddd awkで改行を空白に変換 - ケーズメモ パターンにマッチしない行を表示するスクリプト - 下手の考え休むに似たり

SQL UPDATE 結合

http://ja.wikipedia.org/wiki/UPDATE_(SQL)#.E7.B5.90.E5.90.88 UPDATE t1 SET a1 = 2 FROM t2 WHERE t1.a2 = t2.b2 AND t2.b1 = 0;

PostgreSQL order by field

PostgreSQL で order by fieldhttp://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks Source: http://stackoverflow.com/questions/1309624/simulating-mysqls-order-by-field-in-postgresql When we can explicitly to specify some order, we should to…

Apache accf_http

http://www.skymerica.com/blog/yotsumoto/arch/2007/06/09/000797.htmlロード # kldload accf_http.ko 確認 $ kldstat Id Refs Address Size Name 1 2 0xffffffff80100000 c02250 kernel 2 1 0xffffffff80d03000 14d0 accf_http.koロードされてない場合 $ k…

urldecode

http://www.whizkidtech.redprince.net/urlendec/awk の場合 http://geni.ath.cx/unix.html#_awk

pylons

コントローラの __before__ とキャッシュ class UserController(BaseController): def __before__(self): return True @beaker_cache(expire=180, type='memory') def index(self): return "This is the index." __before__() はキャッシュされず毎回呼ばれ…