2009-10-31

太多微博客,懒得每个都更新,但是每个地方都有不同的朋友

想是在一个地方发消息,更新所有的微博客,所以就不得不想这个同步的办法了

目前我是用这样的流程

twitter (主号) -> ping.fm -> custom.url -> 火兔(嘀咕) -> 新浪微博

同时这个ping.fm 也一块更新 我一个备份我发过twitter的另外一个账号  以及facebook

主号往ping.fm发消息的时候过滤了RT 和 @ , 这样我的主号跟人聊天打屁 扯蛋 八卦的内容就不会传播出去了

我养了3个twitter的账号 目的有几个

1.主号 :  发一些有价值的,有营养的 , 顺便跟人打屁 RT 扯蛋 聊天 吹牛 八卦的
2.机器人号 : 用twitterfeed 抓取我博客的comment rss 然后加上前缀 @ 主号  的方式 发放消息, 这样如果有人在我博客评论,我在我的主号上查看 @me 就可以知道有评论了, 我加了我的wordpress的评论rss以及live space的

3.备份消息号 : 备份主号发的消息,还有一些,比如 我睡觉了,我起床了,我吃饭了 这样无聊的信息,我想这样记录下看看我天天都在干啥的时候,又对别人没任何意义的时候,就把内容保存到这个号就可以了,今后多年以后再看过来,也是蛮有意思的一件事情

twitter -> ping.fm 主要是用python脚本来实现

有个ping.fm的python库,安装之后就很简单了

具体代码可以参看

#!/usr/bin/python

from xml.dom.minidom import parseString
import urllib
import urllib2
import sys
from pyngfm import PyngFM

def post_to_pingfm(msg):
    pfm = PyngFM()

    pfm.setApiKey(‘xxxxxxxxxxxxxxxxx’)
    pfm.setUserAppKey(‘xxxxxxxxxxxxxxxxxxxxxxx’)

    pfm.user_post(‘default’,'%s’%msg)

def main():
    f = open(‘last.txt’,'r’)
    maxid = int(f.read())
    f.close()
    if maxid < 1166717326:
        print ‘error’
        sys.exit(-1)
    params = urllib.urlencode({’since_id’:maxid})
    f = urllib.urlopen("http://twitter.com/statuses/user_timeline/jimey.xml?%s" % params)
    xmltext = f.read()
    dom = parseString(xmltext)
    statuses = dom.childNodes[0]
    messages = []
    s = 0
    for node in statuses.childNodes:
        if node.nodeName == ’status’:
            status = node
            for snode in status.childNodes:
                if snode.nodeName == ‘id’:
                    n = int(snode.childNodes[0].nodeValue)
                    if n > maxid:
                        maxid = n
                elif snode.nodeName == ‘text’ and snode.childNodes[0].nodeValue[0:2] != ‘RT’ and snode.childNodes[0].nodeValue[0] != ‘@’:
                    messages.append(snode.childNodes[0].nodeValue.encode(‘utf-8′))
    while len(messages) > 0:
        post_to_pingfm(messages.pop())
        s = s + 1
    f = open(‘last.txt’,'w’)
    f.write(str(maxid))
    f.close()
if __name__ == "__main__":
    main()
 

ping.fm 到自定义网页

可以查看这个网页  http://www.williamlong.info/archives/1961.html

修改那个microblog.php 添加你的火兔帐号密码,然后随便丢到一个支持php的网站去就好了

在ping.fm cunstom url添加这个microblog.php 即可同步更新

然后在火兔那边添加 新浪微波即可

目前唯一比较麻烦的是豆瓣的我说

我想把豆瓣的我说 广播也一并给同步了

搞了一天的oauth 还不是很得法…

python俺那个认证header实在是不知道咋弄了..

php版本的好像得自己的php服务器了因为还要装Zend Gdata,网上的php网站好像都不支持这玩意..

Tags: ,,,,,,,,.
2009-10-28

开头篇

wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.5.tar.gz

wegt http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.5.tar.gz

tar zxvf libtorrent-0.12.5.tar.gz

tar zxvf rtorrent-0.8.5.tar.gz

svn co https://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable/ xmlrpc-c

cd xmlrpc-c
./configure –disable-cplusplus
make
sudo make install

 

cd ..
cd libtorrent-0.12.5/
rm -f scripts/{libtool,lt*}.m4
./autogen.sh
./configure
make
sudo make install
cd ..

cd rtorrent-0.8.5/
rm -f scripts/{libtool,lt*}.m4
./autogen.sh
./configure –with-xmlrpc-c
after that command make sure you see "checking for XMLRPC…. OK" near the end of the outputted text**
make
sudo make install
cd ..

以上2步骤中rm -f scripts/{libtool,lt*}.m4 是因为 libtool的问题 具体可以看 http://libtorrent.rakshasa.no/ticket/1852

/bin/sh ../libtool --tag=CXX   --mode=link g++  -g -O2 -g -DDEBUG -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include     -I/usr/local/include     -o rtorrent command_download.o command_dynamic.o command_events.o command_file.o command_helpers.o command_local.o command_network.o command_object.o command_peer.o command_tracker.o command_scheduler.o command_ui.o control.o globals.o main.o option_parser.o signal_handler.o ui/libsub_ui.a core/libsub_core.a display/libsub_display.a input/libsub_input.a rpc/libsub_rpc.a utils/libsub_utils.a -lncurses  -lsigc-2.0   -lcurl   -L/usr/local/lib -ltorrent
../libtool: line 841: X--tag=CXX: command not found
../libtool: line 874: libtool: ignoring unknown tag : command not found
../libtool: line 841: X--mode=link: command not found
../libtool: line 1008: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1009: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
gcc: no input files
gcc: no input files
gcc: no input files
gcc: no input files
../libtool: line 2253: X-g: command not found
../libtool: line 2253: X-O2: command not found
../libtool: line 2253: X-g: command not found
../libtool: line 2253: X-DDEBUG: command not found
../libtool: line 2253: X-I/usr/include/sigc++-2.0: No such file or directory
../libtool: line 2253: X-I/usr/lib/sigc++-2.0/include: No such file or directory
../libtool: line 2253: X-I/usr/local/include: No such file or directory
../libtool: line 1967: X-L/usr/local/lib: No such file or directory
../libtool: line 2422: Xrtorrent: command not found
../libtool: line 2427: X: command not found
../libtool: line 2434: Xrtorrent: command not found
../libtool: line 2442: mkdir /.libs: No such file or directory
如果不这么搞,会出现变异错误,这个错误郁闷了我很久 –_-!!
之后就完全没问题了。。
编译运行很正常
在用screen 运行很流畅 –_-!!
reference: [via]
另外还有一个脚步一步实现版本: http://ubuntuforums.org/showthread.php?t=1064377  wTorrent + rTtorrent installation script: Installing wTorrent on Ubuntu in 3 steps
Tags: ,,,.
2009-10-09

http://trac.nchc.org.tw/cloud/wiki/waue/2009/0617

这篇文章已经叙述的很不错了

采用eclipse3.3 暂时是不会有任何问题,执行run as hadoop 那个wordcount会有错误提示

hadoop

09/10/09 17:17:25 WARN conf.Configuration: DEPRECATED: hadoop-site.xml found in the classpath. Usage of hadoop-site.xml is deprecated. Instead use core-site.xml, mapred-site.xml and hdfs-site.xml to override

properties of core-default.xml, mapred-default.xml and hdfs-default.xml respectively
Usage: wordcount <in> <out>

代码问题,可以暂时不用管

另外文章中给出的

JarFile="sample-0.1.jar"
MainFunc="Sample.WordCount"
LocalOutDir="/tmp/output"

all:help
jar:
  jar -cvf ${JarFile} -C bin/ .

run:
  hadoop jar ${JarFile} ${MainFunc} input output

clean:
  hadoop fs -rmr output

output:
  rm -rf ${LocalOutDir}
  hadoop fs -get output ${LocalOutDir}
  gedit ${LocalOutDir}/part-r-00000 & 

help:
  @echo "Usage:"
  @echo " make jar     - Build Jar File."
  @echo " make clean   - Clean up Output directory on HDFS."
  @echo " make run     - Run your MapReduce code on Hadoop."
  @echo " make output  - Download and show output file"
  @echo " make help    - Show Makefile options."
  @echo " "
  @echo "Example:"
  @echo " make jar; make run; make output; make clean"
这个makefile很不错,复制的时候注意使用tab
然后运行编译在eclipse3.3和3.4版本都很正常
目前有几个问题就是eclipse3.4版用hadoop-0.20.0-eclipse-plugin.jar 我这边出错,读不到这个插件,
用hadoop-0.19.2-eclipse-plugin.jar的时候连接不到本地的hadoop服务
还好用我最新编译的hadoop-0.20.1-eclipse-plugin.jar 可以正常使用,不过蛮搞笑的是用了这个,
在perspective添加了MapReduce的时候那个Map/Reduce Locations不会显示出来,要手动添加,
我不知道是我个人问题,还是普遍情况
hadoop2
目前都可以连接到我的hadoop服务上,可以在eclipse里面查看上传文件
eclipse3.3版本我是用0.20.0的eclipse-plugin
eclipse3.4版本我是用我自己编译的0.20.1的plugin  下载hadoop-0.20.1-eclipse-plugin.jar
Tags: ,,,,,.

hadoop最新的0.20.1包里面已经没带eclipse的plugin了

之前用0.20.0的pluggin偶尔会出问题

所以想自编译之

http://wiki.apache.org/hadoop/EclipsePlugIn

查阅

To build the Eclipse plug-in, you need the Hadoop source files and a working Eclipse environment (version 3.3+). When compiling Hadoop, the Eclipse plug-in will be built if it founds the Eclipse environment path in the ant property "eclipse.home". The build framework looks for this property in ${hadoop-src-root}/src/contrib/eclipse-plugin/build.properties and in $HOME/eclipse-plugin.build.properties.

A typical $HOME/eclipse-plugin.build.properties file would contain the following entry: eclipse.home=/path/to/eclipse

Then the plug-in should be built when compiling Hadoop: ant clean package (from the ${hadoop-src-root} directory), which will produce {hadoop-src-root}/build/contrib/eclipse-plugin/hadoop-${version}-eclipse-plugin.jar

To install the generated plug-in in your Eclipse environment, remove first all previous versions of the plug-in from your Eclipse environment and copy the hadoop-${version}-eclipse-plugin.jar file generated as described above in your ${eclipse.home}/plugins/ directory. When you restart Eclipse, the Map/Reduce perspective should be available.

得知 只需要在 eclipse-plugin.build.properties 添加eclipse的路径 即可,没找到这个eclipse-plugin.build.properties 只找到了build.properties 添加了eclipse的安装路径

然后在hadoop的根目录 ant clean package 生成 (需要loading一些classpath) 难道不能单独ant?? 在eclipse-plus下也有build.xml  用ant compile之  会出现classpath错误生成60多个错误…

所以目前比较奇怪..

 

update:

换了个思路,不跟着那个网站的走 不用那个ant clean package的命令

先在hadoop根目录下ant compile

再到src/contrib/eclipse-plugin/下

ant compile然后ant jar

这个时候会提示

BUILD FAILED
/home/hadoop/hadoop-0.20.1/src/contrib/eclipse-plugin/build.xml:69: Warning: Could not find file /home/hadoop/hadoop-0.20.1/build/hadoop-${version}-core.jar to copy.

再去src/contrib/ 编辑build-contrib.xml   添加

<property name="version" value="0.20.1"/>

然后保存后

修改之前我习惯性的把hadoop-${version}目录改为hadoop再改回原来的,即/home/hadoop/hadoop/ 改为/home/hadoop/hadoop-0.20.1/

复制hadoop根目录下的hadoop-0.20.1-core.jar 到build/下

然后再去src/contrib/eclipse-plugin/下  ant jar 即可/home/hadoop/hadoop-0.20.1/build/contrib/eclipse-plugin/hadoop-0.20.1-eclipse-plugin.jar 生成

下载hadoop-0.20.1-eclipse-plugin.jar

Tags: ,,,,,,,.
2009-10-08

ubuntu系统默认是不加载的

所以不用umount设备之后再格式化

首先可以查看设备

sudo fdisk –l

然后用命令

硬盘格式化
#危险!将第二个硬盘的第一个分区格式化为 ext3 分区, mkfs.reiserfs mkfs.xfs mkfs.vfat
sudo mkfs.ext3 /dev/sdb1
然后用mount加载即可
不过我发现格式了好几次那个NTFS分区还在,重启也没用,依然无法格式化
后来找到硬盘管理图形软件gparted
用命令安装即可
sudo apt-get install gparted
然后在本地的terminal里面输入 sudo gparted即可开启
之后就类似pq 一样的硬盘分区管理了
分区格式化即可
然后修改/etc/fstab文件
/dev/sdb1          /mnt/hd              ext3              defaults   
这样每次开机都自动加载硬盘到/mnt/hd下了
然后再修改权限
sudo chmod -R 777 /mnt/hd 即可
Tags: ,,,,,,,,,.
2009-09-22

想做ssh的服务器,但是由于俺的*unix有其他用处,所以暂时找了一台win来做

先是用了Copssh 界面很简洁,但是管理上不是很方便,尤其是多用户多账号的情况下要在windows开启n个用户,监控上也不是很便捷

后来改vshell,看起来操作很复杂,具体没仔细研究,然后直接跳去用WinSSHD

WinSSHD目前有4/5 版本,4版本界面也不是非常的友好

而5个人版在限制了一些使用量,比如开虚拟用户数10个以内,还有几个功能之外,并无任何限制

先是安装了试用版,功能完全版,在研究了一段之后,终于明白4那些功能究竟是怎么用了的,因为5有个实时的event提示功能,如果哪里出错可以明白

最终试用之后

决定采用5的个人版本

1.在win那边开一个账号

2.打开WinSSHD Control Panel最下面的Password Cache 把win的那个新建账号和密码输入

这步的主要目的是后面的虚拟用户建立的时候都是通过这个真实用户来登陆验证访问的

3.进入Edit setting

window group  windows accouts  一步一步按自己需求设置

virtual group 也是一样一步一步设置即可

virtual accouts 这边基本设置都跟virtual group 账号和密码自己设置即可

以上……

Tags: ,,,,.