ITeye博客

Ivan Li 的大杂烩

IvanLi · 共 109 篇文章

execute a command with timeout in python

class Command(threading.Thread): def __init__(self, command, cwd=None, writeConsole=True, timeout=60): threading.Thread.__init__(self) self.command = command self.cwd = cwd self.writeConsole = writeConsole self.timeout = timeout def run(self): if self.cwd is not None: print '[' + ' '.join(self.comm…

2014-01-05 14:25 · python · 评论(0)

use hibernate3-maven to export sql based on entity

<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <configuration> <components> <component> <name>hbm2ddl</name> </component> </components> <componentProperties> <drop>true</drop> <create>true</create> <ejb3>true</ejb3> <java5>true</java5> <export>true</e…

2011-08-07 18:19 · 技术天地 · 评论(0)

uninstall mysql completely in my Mac X 10.6

sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* edit /etc/hostconfig and remove the line MYSQLCOM=-YES- sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm /var/db/receipts/com.m…

2011-08-07 12:19 · 技术天地 · 评论(0)

my vimrc

copy from http://www.vi-improved.org/vimrc.php " Modeline and Notes { " vim: set foldmarker={,} foldlevel=0 spell: " " This is my personal .vimrc, I don't recommend you copy it, just " use the " pieces you want(and understand!). When you copy a " .vimrc in its entirety, weird and unexpected things …

2011-05-14 11:02 · 技术天地 · 评论(0)

不是东北人,累死念不出来

东北孩子小的时候,玩嘎啦哈,弹流流,扇pia几,滑爬篱,男孩子皮实,不喜欢女孩子成天尿叽的样子,所以长大后特尿性。 东北孩子小的时候,门牙卡掉过,波了盖儿在马路牙子上卡突噜皮了,回到家后爸妈总会问:咋整的啊,一天天毛楞三光的! 东北孩子小的时候,贼淘,晒的雀黑,每晚回到家小脸都魂儿画儿的,爸妈总会说:成天遥哪瞎跑,瞅你那脸,埋了巴汰的! 东北孩子小的时候,上课不听讲,唠嗑,瞎闹,滋哇乔叫唤,把老师整激眼了说:天天上课瞎白乎,不听课! 东北孩子小的时候,在课堂上喜欢吵吵,吵吵到鸡赤掰脸,旁边的人烦了说:你们俩找削啊!东北孩子各应爱溜虚拍马的屁精,看见了总恨不得谁家的驴撂蹶子踢他 一脚。 东北小…

2010-06-12 16:07 · 乱七八糟 · 评论(0)

老公日记

>> > ※ 亲与被亲 >> > 1. 今天晚饭评论老婆手艺。饭后被罚刷碗。 >> > 2. 今天老婆讲了一个笑话,我没有笑。花了一个小时哄老婆笑。 >> > 3. 今天捉到老婆早晨上班忘记关灯。罚老婆五块。 >> > 4. 今天被老婆捉到在家里吸烟。被罚五十块。 >> > 5. 今天早晨上班前亲老婆一下。上班迟到了。 >> > 6. 今天周六,早晨老婆亲了我一下。所有家务都归我做了。 >> > ※老婆出差一周 >> > 1. 昨天老婆出差,所以今天老婆不在家。没有晚饭吃 >> > 2. 今天老婆又不在家。又没有晚饭吃。 >> > 3. 今天老婆还是不在家。还是没有晚饭吃。 >> > 4. …

2010-06-01 11:39 · 乱七八糟 · 评论(1)

使用HSQLDB来作EJB3 EntityBean到Unit Test要点

add <property name="hibernate.hbm2ddl.auto" value="create-drop"/> to hibernate property this will re-create table when SessionFactory init, drop table when session factory close add HSQLDB dependency into pom.xml <dependency> <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>1.8.0.…

2010-01-20 17:17 · 技术天地 · 评论(0)

user xrandr to change my desktop's resolution

xrandr --newmode "1280x1024" 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +VSync xrandr --addmode VGA1 "1280x1024" xrandr --output VGA1 --mode "1280x1024"

2009-12-16 17:04 · 技术天地 · 评论(0)

XSS的关键之列表

//this field are used tp escape XSS script attach //get all the html 4 event from http://www.w3schools.com/Html/html_eventattributes.asp private static final String[][] XSS_CHARS_ESCAPE = { //Window Events {"onload", "on_load"}, {"onunload", "on_unload"}, //Form Element Events {"onchange", "on_chan…

2009-10-11 17:20 · 技术天地 · 评论(0)

python查看方法帮助(from dive into python)

def info(object, spanding=10, collapse=1): """Print methods doc string. Takes Module, class, list or string""" methodList = [method for method in dir(object) if callable(getattr(object,method))] processFunc = collapse and (lambda s: " ".join(s.split())) or (lambda s:s) print "\n".join(["%s %s" %(me…

2009-09-30 11:31 · 技术天地 · 评论(0)

selenium 测试ajax的关键

1: waitForCondition(contidtion, timeout) 2:selenium.browserbot.getCurrentWindow().document 下面是sample 用法 req_rsvn_01 open /itr/secure/index.jsp clickAndWait link=Request & Manage Reservations (Week at a Glance) waitForCondition selenium.browserbot.getCurrentWindow().document.forms[0].originIndex.opt…

2009-01-20 18:26 · 技术天地 · 评论(0)

代码检查工具

findBugs , PMD , CheckStyle findBugs跟PMD的对比文章 http://www.freesoftwaremagazine.com/columns/destroy_annoying_bugs_part_1 我的理解要点 findBugs针对class,jar文件检查,PMD针对source code做检查,初步来看好像PMD对IDE的支持比较好,打算初步使用PMD来做checkstyle 工具。 其实更好的check style工具是通过pair programm产生的,什么是好的代码结构,能够让pair理解的代码结构就是好的代码结构。

2008-09-25 11:48 · 技术天地 · 评论(0)

CI工具hudson

CI工具除了hudson,还有很多,例如CruiseControl, Continuum,Luntbuild,Hudson,还有TW的Crouse 这里有一篇介绍CI工具的文章 http://groups.google.com/group/EtoE/browse_thread/thread/b6675c74c03a621b?pli=1 CI即持续集成,最早有Martin Fowler,在2000年提出,想做CI,必须先有自动化测试,自动化测试的基础,是要有单元测试。没有自动化测试,CI简直就是空谈

2008-09-24 17:04 · 技术天地 · 评论(0)

创建solaris package step by step

原文地址:http://www.ibiblio.org/pub/packages/solaris/sparc/html/creating.solaris.packages.html 介绍: solaris 软件包可以使软件很容易的安装到solaris系统中。软件的所有部分都被一个目录文件描述。借助包管理工具您可以在solaris系统中很方便得安装,更新,删除软件,而不用担心“恶意文件”存留,或者错误的配置,或者软件的未完全安装。 软件包的创建过程大体上是安装一次软件,然后把软件组织成一个软件安装包,这个软件安装包可以被快速的安装到其他solaris系统,同时可以很容易的在本机卸载。 本文档将…

2008-09-24 11:27 · 技术天地 · 评论(0)

什么是SVR4?我们为什么要选择SVR4?

http://www.lslnet.com/linux/f/docs1/i66/big5430404.htm SVR4 串讲 -1、什么是SVR4,我们为什么要选择SVR4 SVR4是UNIX操作系统的一种新的内核标准,是迄今为止内核版本最新的UNIX SVR4并不代表一个具体的UNIX变体,而只是一个内核的标准。SVR4有极高的标准性,那意味着你学好了SVR4可以在所有SVR4内核的操作系统上进行统一的操作(不会产生学习了一个UNIX系统还要学习另外的困惑) SVR4(UNIX System V Release4)是AT&T在1989年首次发行的;SVR4集成SVR3,4BSD,SunOS…

2008-09-23 14:13 · 技术天地 · 评论(1)