2012年4月18日 (水)

yum エラー No module named grabber

bittorrentを入れましたら、python-twitterが必要だすといふことで、つれずれなるままにインストールしておりましたら、YUM が使えなくなりました。 Σ( ̄ロ ̄lll) ギエー

[root@localhost bin]# yum search ssh
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named grabber

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.6.4 (r264:75706, Jun 4 2010, 18:20:16)
[GCC 4.4.4 20100503 (Red Hat 4.4.4-2)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq

こりゃ再インストールかと思いましたが、
http://mobile.centos.org/modules/newbb/viewtopic.php?topic_id=29191&forum=27
より
rm -rf /usr/lib/python2.6/site-packages/BTL-0.31dev-py2.6.egg/urlgrabber
しましたら、yumが動くようになりました。

|

2012年4月 1日 (日)

Easychair-style.zipとMikTexへ移行

とある経緯でEasyChair-style.zipを使うことになりましたが、winshell + /usr/local/binな組み合わせでは動きませぬので、焦りまくった (;´Д`)

最近はMikTexといふのを使うらしい。。
MikTexをインストールし、ユーザ指定プログラム(program calls)で、latexをc:program files\miktex\bin\platexのようにmikTex下のplatexに帰ると、足りないstyファイルをその都度インストールしてくれます。
これで、PDFコマンドを実行したら表示されました。
昔は紙と鉛筆でよかったのですが。。 ι(´Д`υ)


|

2012年3月28日 (水)

モンゴDB C++ドライバのインストール

mongoDBはpythonを使うのが一番いいのかも知れませぬ。書籍もあるますし。
C++のドライバがありますが、boostと絡むので、時間がかかりました。(3時間程度) ι(´Д`υ)

[root@localhost mongo-cxx-driver-v2.0]# uname -a
Linux localhost.localdomain 2.6.33.3-85.fc13.x86_64 #1 SMP Thu May 6 18:09:49 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

wget http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v2.0-latest.tgz

まずは、yumかsource codeでboostをインストールする。そして、

scons: Reading SConscript files ...
Checking for C library boost_thread-mt... no
Checking for C library boost_thread... no
Checking for C library boost_filesystem-mt... no
Checking for C library boost_filesystem... no
Checking for C library boost_system-mt... (cached) no
Checking for C library boost_system... no
Checking for C library boost_thread-mt... (cached) no
Checking for C library boost_thread... no
scons: done reading SConscript files.

ではなく、

[root@localhost mongo-cxx-driver-v2.0]# scons
scons: Reading SConscript files ...
Checking for C library boost_thread-mt... (cached) yes
Checking for C library boost_filesystem-mt... (cached) yes
Checking for C library boost_system-mt... (cached) yes
Checking for C library boost_thread-mt... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
g++ -o mongo/buildinfo.os -c -fPIC -O3 -lboost_system -D_SCONS -DMONGO_EXPOSE_MACROS -Imongo mongo/buildinfo.cpp
g++ -o mongo/pch.os -c -fPIC -O3 -lboost_system -D_SCONS -DMONGO_EXPOSE_MACROS -Imongo mongo/pch.cpp

となるまでがんばってくだしゃれ。
その後、Sconstructを修正しました。

ranlib libmongoclient.a
g++ -o authTest -Wl,--as-needed -Wl,-zdefs client/examples/authTest.o -L. -lmongoclient -lpthread -lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt -lboost_thread-mt
client/examples/authTest.o: In function `global constructors keyed to main':
g++ -o mongo/pch.o -c -O3 -lboost_system -D_SCONS -DMONGO_EXPOSE_MACROS -I/usr/local/boost/include -Imongo mongo/pch.cpp

g++ -o libmongoclient.so -Wl,--as-needed -Wl,-zdefs -Wl,-lboost_system -shared mongo/buildinfo.os mongo/pch.os mongo/bson/oid.os mongo/client/clientOnly.os mongo/client/connpool.os mongo/client/dbclient.os mongo/client/dbclient_rs.os mongo/client/dbclientcursor.os mongo/client/distlock.os mongo/client/gridfs.os mongo/client/model.os mongo/client/syncclusterconnection.os mongo/s/shardconnection.os mongo/shell/mongo.os mongo/db/commands.os mongo/db/indexkey.os mongo/db/jsobj.os mongo/db/json.os mongo/db/lasterror.os mongo/db/nonce.os mongo/db/projection.os mongo/db/querypattern.os mongo/db/queryutil.os mongo/util/assert_util.os mongo/util/background.os mongo/util/base64.os mongo/util/debug_util.os mongo/util/file_allocator.os mongo/util/histogram.os mongo/util/log.os mongo/util/md5main.os mongo/util/password.os mongo/util/ramlog.os mongo/util/signal_handlers.os mongo/util/stringutils.os mongo/util/text.os mongo/util/util.os mongo/util/version.os mongo/util/concurrency/spin_lock.os mongo/util/concurrency/synchronization.os mongo/util/concurrency/task.os mongo/util/concurrency/thread_pool.os mongo/util/concurrency/vars.os mongo/util/net/httpclient.os mongo/util/net/listen.os mongo/util/net/message.os mongo/util/net/message_port.os mongo/util/net/sock.os mongo/util/md5.os -L/usr/local/lib -L/usr/local/lib64 -lpthread -lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt -lboost_thread-mt
mongo/buildinfo.os: In function `global constructors keyed to buildinfo.cpp':
buildinfo.cpp:(.text+0x3b): undefined reference to `boost::system::generic_category()'

というエラーが100回ほどでたので、(;´Д`)SConstructを修正した(mtの文字を削除)

conf = Configure(env)
for lib in boostLibs:
if not conf.CheckLib("boost_%s" % lib):
conf.CheckLib("boost_%s" % lib)

mongodb-develとかをyumでいれませぅ。

cp ./libmongoclient.so /usr/local/lib
ldconfig /usr/local/lib

[root@localhost ~]# g++ -g -Wall -I/usr/include -L/usr/local/libs -lmongoclient -lboost_system mongo_test.cpp -o m
ongo_test

とにかくエラーがでるとライブラリが作成されません。下記は一応うまくいったSConstructです。

# scons file for MongoDB c++ client library and examples

import os

# options
AddOption( "--extrapath",
dest="extrapath",
type="string",
nargs=1,
action="store",
help="comma separated list of add'l paths (--extrapath /opt/foo/,/foo) static linking" )

AddOption( "--prefix",
dest="prefix",
type="string",
nargs=1,
action="store",
default="/usr/local/boost",
help="installation root" )


env = Environment( MSVS_ARCH=None )

def addExtraLibs( s ):
for x in s.split(","):
if os.path.exists( x ):
env.Append( CPPPATH=[ x + "/include/boost" ] )
env.Append( LIBPATH=[ x + "/lib" ] )
env.Append( LIBPATH=[ x + "/lib64" ] )

if GetOption( "extrapath" ) is not None:
addExtraLibs( GetOption( "extrapath" ) )

env.Append( CPPPATH=[ "mongo/" ] )

env.Append( CPPDEFINES=[ "_SCONS" , "MONGO_EXPOSE_MACROS" ] )

nix = False
linux = False

if "darwin" == os.sys.platform:
addExtraLibs( "/opt/local/" )
nix = True
elif "linux2" == os.sys.platform or "linux3" == os.sys.platform:
nix = True
linux = True

if nix:
env.Append( CPPFLAGS=" -O3 -lboost_system" )
env.Append( LIBS=["pthread"] )
env.Append( LDFLAGS=" -lboost_system" )
if linux:
env.Append( LINKFLAGS=" -Wl,--as-needed -Wl,-zdefs -Wl,-lboost_system" )
env.Append( LDFLAGS=" -lboost_system" )

boostLibs = [ "thread" , "filesystem" , "system", "thread" ]
conf = Configure(env)
for lib in boostLibs:
if not conf.CheckLib("boost_%s" % lib):
conf.CheckLib("boost_%s" % lib)

dirs = [ "" , "bson/" , "bson/util/" ,
"client/" , "s/" , "shell/" ,
"db/" ,
"scripting/" ,
"util/" , "util/concurrency/" , "util/mongoutils/" , "util/net/" ]

allClientFiles = []
for x in dirs:
allClientFiles += Glob( "mongo/" + x + "*.cpp" )
allClientFiles += Glob( "mongo/util/*.c" )

libs = []
libs += env.SharedLibrary( "mongoclient" , allClientFiles )
libs += env.Library( "mongoclient" , allClientFiles )

# install

prefix = GetOption( "prefix" )

for x in libs:
env.Install( prefix + "/lib/" , str(x) )

for x in dirs:
x = "mongo/" + x
env.Install( prefix + "/boost/include/" + x , Glob( x + "*.h" ) )

env.Alias( "install" , prefix )

# example setup

#clientTests = []
#clientEnv = env.Clone();
#clientEnv.Prepend( LIBS=["libmongoclient.a"])
#clientEnv.Prepend( LIBPATH=["."] )

# examples

#clientTests += [ clientEnv.Program( "firstExample" , [ "client/examples/first.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "secondExample" , [ "client/examples/second.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "whereExample" , [ "client/examples/whereExample.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "authTest" , [ "client/examples/authTest.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "httpClientTest" , [ "client/examples/httpClientTest.cpp" ] ) ]
#clientTests += [ clientEnv.Program( "clientTest" , [ "client/examples/clientTest.cpp" ] ) ]
#clientEnv.Alias("clientTests", clientTests, [])

|

2012年3月15日 (木)

さくらVPSでのperl-DateTimeのインストール

さくらVPSでは、CPANでのインストールがうまくいかねいことがあります。

DAG(rpmforge) は redhat 及び fedora 向けの追加パッケージ群の追加
rpmをwebから落とします。
http://pkgs.repoforge.org/rpmforge-release/

# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
warning: rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
1:rpmforge-release ########################################### [100%]

# yum install perl-DateTime

(゚▽゚*)
参考
http://blog.enjoitech.jp/article/96

|

2012年2月16日 (木)

Visual Studio / wchar_t LPCSTR 変換エラー

wchar_t LPCSTR 変換できません
このようなエラーが出るときは、Σ(`0´*)
文字列の最初にエラーを付けるか、 L"test string" (ユニコードの場合)、またはプロジェクトの文字コードをマルチバイトにすると直ることがあります。

|

2012年2月12日 (日)

error: 不完全型のポインタへの間接参照

error: 不完全型のポインタへの間接参照
この不可思議であるがおそろすぃエラーは、インクルードファイルが足りない場合にでることがアリマス。
たとえば、sched.hを追加していない場合など。。シェーΣ(゚д゚lll)

#include linux/init.h
#include linux/module.h
#include linux/signal.h
#include linux/types.h
//#include linux/sched.h

|

カーネルからユーザ空間へのおもひ

きょうびのOSといふものは、命令が上(ユーザモード)から下へ(カーネルモード)へいくのが自然となっている。逆にいうと、下からあがる方が大変というか、強いのであろう。。(lll゚Д゚)

ハカーな人は、カーネル空間に対して下記のようにおもふのである。

1カーネルスペスでは何が起こっておるか?

2カーネルからユーザ空間へハカーが望むタイミングをちょっかいを出したい。(*´v゚*)ゞ
信号やら割り込みを送れぬか?

3できれば、共有メモリなどでなにかを伝えたい。

という中2のやうなことを考えるのであるが、カーネルデバッグといふのは永遠のテーマなのである。
system tap とか、kprobeも同じやうな動機であると思うのであるよ。

1は、ドライバを書けばなんとかなる。眺めているだけなので。

2は、少し工夫がいるが、男女交際がどんどん推奨されるわけではない。カーネルは割り込みを受け付けるもんだという通念がある。なのですが、ユーザモードヘルパーや、シグナルを遣う方法がある。

kill_proc_infoという関数がsingnal.cにあるが、これはカーネルモジュール内で使うことは推奨されていない。そのため、export_symbol_gplなどを追加して、やや無理して使う方法がある。

http://kerneltrap.org/node/5800
http://mail.rtai.org/pipermail/rtai/2009-January/020724.html
http://www.ibm.com/developerworks/jp/linux/library/l-user-space-apps/

あまりスマートではナイナー(゚▽゚*) 最近はsystemtapやらいろいろあるやうですが、調べておりませぬ。

windowsの場合はもっと大変で、カーネルオブジェクトとかを使って同期の一環としてスレッドに割り込みを掛けることができますが、こりは折がありましたら書きませぃ。(゚m゚*)


|

2012年2月10日 (金)

OTTER subsumption

OTTERで包摂が明示的に禁止されているケースを調べますた。

# grep -rin for_sub * | grep -v svn
kalman/i1.out:7:clear(for_sub).
kalman/i1.in:5:% for_sub is clear, and would be possible if backward subsumption were done
kalman/i1.in:9:clear(for_sub). % switch off forward subsumption
misc/dem_alu.in:18:clear(for_sub).
misc/dem_alu.in.28752:18:clear(for_sub).
misc/dem_alu.out:14:clear(for_sub).
program/eval.out:10: dependent: clear(for_sub).
wos/twoval.in:6:% clear(for_sub).

# grep -rin back_sub * | grep -v svn
auto/pigeon.out:12: dependent: clear(print_back_sub).
fringe/gl8.in:22:clear(print_back_sub).
kalman/ex_2.in:9: clear(print_back_demod). clear(print_back_sub).
kalman/ex_3.in:12: clear(print_back_demod). clear(print_back_sub).
kalman/ex_1.in:10: clear(print_back_demod). clear(print_back_sub).
kalman/ex_4.in:9: clear(print_back_demod). clear(print_back_sub).
misc/andrews.in.28752:14:clear(print_back_sub).
misc/stage2.in:21:clear(back_sub).
misc/dem_alu.in:19:clear(back_sub).
misc/mv.in.28752:9:clear(back_sub).
program/eval.out:11: dependent: clear(back_sub).
program/two_inv.in:46:clear(back_sub).
program/two_inv.out:7:clear(back_sub).

backward subsuptionの方が多いのでした。

|

2012年2月 5日 (日)

モンゴDB

mongoDBはエキサイティングでトレンディですな ヘ(゚∀゚ヘ)

1004 wget http://downloads.mongodb.org/linux/mongodb-linux-i686-1.2.2.tgz
1005 tar zxvf mongodb-linux-i686-1.2.2.tgz
1011 more mongodb.sh
1012 ./mongodb.sh
1013 mkdir /tmp/mongodb
1014 ./mongodb.sh

清願mongodb 安装 on centOS or else.

> help
HELP
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
use set curent database to
db.help() help on DB methods
db.foo.help() help on collection methods
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate

DBを作成するコマンドがないとは、あなあさましき。

> j = { name: "mon-go" };
{ "name" : "mon-go" }
> x = { x : 10 };
{ "x" : 10 }


KVSを設定しませぅ

> db.2012020501.save(j);
Sun Feb 5 03:58:41 JS Error: SyntaxError: missing ; before statement (shell):0
> db.2012020501.save(j);
Sun Feb 5 03:58:59 JS Error: SyntaxError: missing ; before statement (shell):0
> db.things.save(j);

ましかば数字はDB名に設定不可まし ι(´Д`υ)

> db.things.save(j);
> show dbs
admin
local
test
> show dbs
admin
local
test
> use test
switched to db test
> show collections
system.indexes
things

なにかtestというDBができてますが。。

> use test2
switched to db test2
> db.things.save(j);
> show dbs
admin
local
test
test2

useですでにできてしまぬべし (´∀`*) 

格納はfindでみませぅ
> db.things.find();
{ "_id" : ObjectId("4f2dfe8e62ba1e80fb5d3c3f"), "name" : "mon-go" }


|

2012年1月23日 (月)

ハドゥプゥ wordcount と perl de ランキング

hadoop javaでソートするのがめんだい場合は。。。;:゙;`(゚∀゚)`;:゙

まず、wordcountしたいファイルあるいはディレクトリを作ります。

1122 /usr/local/hadoop/bin/hadoop fs -mkdir wordcount/input-2012-01-23-03

ローカルからカウントしたいファイルここではlist2をコピーすます
1123 time /usr/local/hadoop/bin/hadoop fs -copyFromLocal /home/torrent-count/2012-01-13-01/list2 wordcount/input-2012-01-23-03/

wordcountシマス
1124 time /usr/local/hadoop/bin/hadoop jar /usr/local/hadoop/hadoop-examples-0.20.205.0.jar wordcount wordcount/input-2012-01-23-03/ wordcount/output-2012-01-23-03

結果は、コピーするのがめんどいので、catで出力します。
1125 time /usr/local/hadoop/bin/hadoop fs -cat wordcount/output-2012-01-23-03/part-r-00000

ここでperl登場 1.plなどを使って <単語、頻度>のリストにすます
「1.pl」をダウンロード

そして、sort.txtなどを使ってソートします。
「sort.txt」をダウンロード


|

«gtagsはいみじけれ