便便代码人生

关注技术, 偶尔动动手

bianbian.org

[嗯]找了个好老婆,嘿嘿

Posted by bianbian on 2006-10-16 17:00


本文Tags:

*嘘嘘 12:39:42
laopo想你,,便便要注意自己的作息规律,,,,只有有了精神才可以工作学习,好好生活哦,,真的,,老婆想你,,,
*嘘嘘 12:44:27
老婆现在觉得自己现在终于过了那个无止尽晚班的生涯,,真的是很好哦,现在每天都会在8点左右醒过来,,这感觉比以前的每天半夜才睡的感觉好很多了哦,,,真的想你,,想我们好,,
*嘘嘘 12:47:05
便便如果压力太大,就不要在这公司兼职了,老婆知道便便知道如果便便不去上班,我们俩的生活就不会这么滋润了,可是便便这么辛苦老婆也心疼,便便可以找个无所谓一点的工作。工资1000就可以了哦,
*嘘嘘 12:50:02
好么?便便这么早就承担了家庭的负担,老婆知道便便是为了让嘘嘘过得好一点,这点便便不要担心,老婆能吃苦的,都没有关系,老婆想你,只要我们生活时的精神状态好,就好了,,,我们很快就会在一起的,,,
*嘘嘘 12:52:10
我们俩都得改改,,做事过于认真,又做得还不错,这样的后果就是我们在为自己找事情做,,这样要做的事就会越来越多,,,老婆想你,,,,,
*嘘嘘 12:57:48
老婆这几天在想到底值不值得这么认真地去做事情呢,也许也该学着世故,我们得学着怎么做人,做人做好了,我们做事的压力就不会这么大了,,便便觉得呢,,,,
*嘘嘘 12:58:44
老婆想你,,,,,

标签:

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Not IT, bianbian & xuxu | 1 Comment »

[原]解决qmail+iGenus webmail中文UTF-8乱码

Posted by bianbian on 2006-10-11 16:23


本文Tags: , , , ,

最近帮忙解决了一个问题(下面的全凭回忆输入,可能拼写上有问题):很古老的qmail+iGenus webmail系统,邮件若是UTF-8编码则显示乱码(缺省编码为GB2312)。主要解决办法就是利用iconv进行转码:
看看有没有iconv模块,如果没有,需要重新编译php(如果iconv系统里没有装,得先安装iconv:去 http://www.gnu.org/software/libiconv/ 下载,./configure,make,make install),编译php的时候加上 –with-iconv
如果php是静态模块方式和apache绑定的,还得把apache重新编译一下:./configure –activate-module=src/modules/php4/libphp4.a,make clean,make,make install

然后打开iGenus include目录下的Fun_inc.php,找到Decode_mime()函数,在B和Q解码以后加上

  1. if(strtolower($Charset)=='utf-8') $Text = iconv('UTF-8', 'GB2312', $Text);

还有一个地方是正文的编码,打开include目录下的Prev_inc.php,找到Decode_text()函数,为了防止出现错误,复制一下Decode_text(),比如Decode_text_my(),并增加一个参数:$Charset。在函数内解析完数据准备写到文件之前转码:

  1. if(strtolower($Charset)=='utf-8') $buff = iconv('UTF-8', 'GB2312', $buff);

打开iGenus主目录下的prev.php,找到调用Decode_text()的两个地方,改成Decode_text_my(),并增加传递一个参数:$Charset

总结:我看的那个iGenus版本php写得很是糟糕,在那个上面改东西有一种想死的冲动……

标签: , , , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Technology, php | 3 Comments »

[原]AutoIt 3中文在线帮助文档

Posted by bianbian on 2006-10-10 14:52


本文Tags: ,

感谢yonken的前期翻译工作和对我的信任。
我最近有些忙,现在只是整理了目录结构,把删掉的部分补齐(未翻译)。抽空的时候我会继续翻译。

文档在此:AutoIt 3中文在线帮助文档

标签: ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in AutoIt3, Technology | 1 Comment »

[原]远程桌面、端口映射和VPN真是好东西

Posted by bianbian on 2006-09-29 21:53


本文Tags: , ,

先看完我的测试。。。。。
先介绍一下,家里有个没有显示器的台式机连在路由上天天下BT,平时用笔记本双机互联在台式机上上网。
1) telnet挂站测试:
小百合BBS可以登录三个窗口,于是:
笔记本->远程_家里台式机 登一个;
笔记本->远程_家里台式机->VPN南大校内->远程_实验室机器 登一个;
笔记本->远程_家里台式机->公司路由端口映射->远程_公司机器 登一个
2) 连环测试:
笔记本->远程_家里台式机->公司路由端口映射->远程_公司电脑->家里路由端口映射->远程_家里台式机->远程_笔记本(xp,把自己踢了)

标签: , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Technology, Windows | No Comments »

[转]windows xp一些命令

Posted by bianbian on 2006-09-29 21:11


本文Tags: ,

自己要用,备忘一下:
服务: services.msc
设置自动登录: rundll32 netplwiz.dll,UsersRunDll
关闭对zip文件支持: regsvr32 /u zipfldr.dll
撤消视频预览: regsvr32 /u shmedia.dll

标签: ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Technology, Windows | No Comments »

[转]Slackware 11.0 release

Posted by bianbian on 2006-09-27 17:43


本文Tags:

网站上好像还没有及时更新,ftp上已经release了:
ftp://ftp.slackware.com/pub/slackware/slackware-current/ANNOUNCE.11_0

Announcing Slackware Linux 11!

The only Slackware release more than a year in the making, this
edition of Slackware combines Slackware’s legendary simplicity,
stability, and security with some of the latest advances in Linux
technology. Expect no less than the best Slackware yet.

Among the many program updates and distribution enhancements, you’ll
find two of the most advanced desktop environments available today:
Xfce 4.2.3.2, a fast and lightweight but visually appealing and easy
to use desktop environment, and KDE 3.5.4, the latest version of the
award-winning K Desktop Environment.
Read the rest of this entry »

标签:

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Linux, Technology | 2 Comments »

[原]ARP欺骗及防治

Posted by bianbian on 2006-09-21 23:35


本文Tags: ,

今天和danny一起试了一下p2pOver(网络执法官也属于此类),一开始都觉得很奇怪:交换机不像hub,已经不广播了,怎么还能控制别的机器的流量呢。。。好玩,研究一下。用数据截取软件(wireshark)查看了一下,其他都正常,却发现狂发了N多ARP(Address Resolution Protocol、地址解析协议)包。看来问题就出在这里。
ARP欺骗原理
再仔细看了一下ARP数据包,终于恍然大悟欺骗原理。
是这样的,为了能和其他机器通讯,局域网上的各个机器都缓存了ARP列表(ARP列表可以简单理解成“一个IP地址对应一个MAC地址”)。机器要通过网关和其他机器通讯,其实是在局域网内发了查询ARP请求(可以简单理解成“网关啊,请把你的MAC地址告诉我好吗?”);网关收到此类请求后,就会发送ARP回应报文,回应网关的MAC。这样,某个机器就会把通讯数据发到网关的MAC上。
那么运行了p2pOver之类的软件后是怎么欺骗的呢?简单起见,我们设使用了p2pOver的机器为”A”,”A”的MAC地址为”M”。
首先,”A”通过ARP查询得到真实的网关MAC,和不停地轮询局域网上其他主机(IP)及其MAC。
其次,”A”不停地给局域网上其他主机发送伪造的ARP回应报文:告诉他们网关的MAC是”M”;
同时,”A”也不停给交换机发送伪造的ARP回应报文:告诉真正的网关局域网上所有主机的MAC地址为”M”。
因为是不停地发送报文,到了最后:局域网上的其他主机以为网关就是”A”,真正的网关以为局域网上的所有通讯只来自”A”。也就是”A”变成了事实上的中转中心:不仅可以截取其他主机的流量和数据,还能随心所欲地截断网络通讯。
ARP欺骗防治
从欺骗原理,不难推出防治关键就是想办法不接收错误的ARP回应报文:
1) 使用智能交换机,绑定网内所有IP-MAC。这样也就不需要ARP查询才能知道MAC。
2) 还有一个办法,就是在网内所有机器上绑定死网关的MAC(下面适用于WinXP):
在网络正常情况下:arp -a 网关IP(如192.168.1.1),查询到正确的网关MAC
然后绑定网关MAC:arp -s 网关IP 网关MAC
在执行arp -a,看到网关IP和MAC是静态(Static)的,就可以了:
arp

标签: ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Technology, Windows | No Comments »

[原]杀了个816.exe木马

Posted by bianbian on 2006-09-21 00:03


本文Tags:

从来不装杀毒软件,我也从来不乱装东西,乱看网页。基本上没事。不装杀毒软件是因为这个不仅会拖慢系统,而且是个马后炮,真正厉害的病毒来了大家一起挂;而且现在杀毒软件越来越像个病毒了。。。。
寒,机器被谁用了下,就被装了个木马。因为我的机器做了个代理,访问网站是有日志的。发现系统最近老是去下载某个叫816.exe的文件。感觉不对。
首先看了下任务管理器,没有奇怪的进程--肯定注入到其他进程里了(基本上是可怜的Explorer.exe)。
Sysinternals Process Explorer看了下,果然,Explorer.exe所有使用的DLL里有个DLMon.dll,是个奇怪的东西。google了一下,果然是个盗QQ密码的木马。
于是用Sysinternals Process Explorer杀了Explorer.exe的进程,运行cmd,cd C:\windows\system32,del DLMon.dll,居然提示没找到--肯定又用了attrib的伎俩,那可是高中DOS时代的法宝--于是先 attrib *Mon.dll -s -h,del DLMon.dll,这下干净了。同时system32还有一个DLMain.dll,也要删除。
再运行Explorer.exe,没有奇怪的附加DLL,基本上可以了。然后regedit,搜RunOnce,把RunOnce里和Run里莫名奇妙的一些exe启动项(包括指定的文件)给删了:
C:\windows\system32\intenet.exe (Windows正常的是internet.exe,少了个r)
C:\windows\816.exe (还有系统的temp里肯定也有)
C:\windows\Program Files\Intel\rundll32.exe (寒Intel)
OK了。如果能抓到写这些垃圾软件的,一定要大家一起动手打一顿。

标签:

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Technology, Windows | 1 Comment »

[原]PostgreSQL complex query(PostgreSQL的复杂查询)

Posted by bianbian on 2006-09-19 14:27


本文Tags: ,

试了一会儿,先记下来。省得以后忘掉。

Well, the tables are: (tag的表情况,usertags表记录了每个用户的tag(一行记录一个tag),usersites表记录了每个url对应的多个tags,urltags表记录了一个usersiteid对应多个usertagid(反过来也是一个usertagid对应多个usersiteid))

  1. usertags                  usersites                       urltags
  2. =======================================================================
  3. id tagname userid      id url title userid tags      id usersiteid usertagid

now we need to get all tagnames, tagid, and used times of a tag, sorted by used times, how to do it? (现在我们需要一次查询得到所有的tagname、每个tag对应的tagid和使用次数并按使用次数排序)
SQL 语句如下:

  1. SELECT count(t.usersiteid) AS count, t.usertagid, n.tagname
  2.   FROM urltags t, usertags n
  3.     WHERE t.usertagid=n.id
  4.     AND usertagid in ( select DISTINCT on (usertagid) usertagid from urltags )
  5.   group by t.usertagid,n.tagname
  6.   order by count DESC

中间的子查询“select DISTINCT on (usertagid) usertagid from urltags ”查询出所有对照表里的usertagid,其中DISTINCT on(usertagid)表示只查询出usertagid字段不重复的记录(即多个相同的usertagid值的话只取一个)。DISTINCT的写法可能只是postgreSQL的特殊函数,不过相信其他数据库应该也有不同写法的支持。
执行结果截图,应该是对的吧。。。。呵呵:
Postgresql_query

标签: ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Database, Technology | No Comments »

[原]推荐一个eclipse插件:aptana

Posted by bianbian on 2006-09-17 23:55


本文Tags: , ,

update地址: http://update.aptana.com/update/
编写css和js和htm的插件
css和js不仅会语法提示,还用图标指示了IE/Firefox适用否
唯一的缺点(优点?)是更新太频繁,老是要update….

标签: , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Technology | 3 Comments »

[原]Delphi调用ShellAPI删除整个目录(我觉得是最快的方法)

Posted by bianbian on 2006-09-16 15:28


本文Tags: ,

  1. var
  2.   S: string;
  3.   T: TSHFileOpStruct;
  4. begin
  5.     S := '目录名';
  6.     with T do
  7.     begin
  8.       Wnd := 0;
  9.       wFunc := FO_DELETE;
  10.       pFrom := PChar(S);
  11.       pTo := nil;
  12.       fFlags := FOF_ALLOWUNDO + FOF_NOCONFIRMATION + FOF_NOERRORUI;
  13.       //标志表明允许恢复,无须确认并不显示出错信息
  14.       hNameMappings := nil;
  15.       lpszProgressTitle := '正在删除文件夹';
  16.       fAnyOperationsAborted := False;
  17.     end;
  18.     SHFileOperation(T);
  19. end;
标签: ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Delphi, Technology | No Comments »

[译]Koda 1.6.0.0发布

Posted by bianbian on 2006-09-14 20:57


本文Tags: ,

原帖地址:http://www.autoitscript.com/fileman/users/lookfar/formdesign.html
我翻译了一下,做了简体中文的语言文件。见:AutoIt 3的GUI生成工具Koda。繁体中文可以参考这里:Koda 1.6.0.0 正體中文化

After long period of development and testing, new release 1.6.0.0 is finally here! Thanks to all who support us and help done this work!

Most significant changes from previous release:
New, more fast and reliable form read/write routines.
Rewritten form list handling code
Menus support (with visual editor)
Obj support (with visual browser)
Templates-based code generation
Generating event-based code
Help file (unfinished)

标签: ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in AutoIt3, Technology | No Comments »

[原]Memory/logger leak with multiple VelocityEngine instances

Posted by bianbian on 2006-09-12 15:32


本文Tags:

之前有问过这个奇怪的问题,日志一直报错:
log4j:ERROR Attempted to append to closed appender named [null].

原来是velocity的bug,目前为止所有release都有这个bug (velocity的网站上说1.5版会fix这个bug)
> Key: VELOCITY-193
> URL: http://issues.apache.org/jira/browse/VELOCITY-193
> Project: Velocity
> Type: Bug
When creating and then releasing to garbage collection multiple VelocityEngine instances, the
instances are apparently not closing out or otherwise letting go of their logger instances. As a
result, code that needs to create and destroy several VelocityEngine instances will eventually choke and die. This happens with either Avalon Logkit or Log4j, although the exact nature of the choking differs. This test program isolates the problem:

import org.apache.velocity.app.VelocityEngine;
public class IsolateVelocityBug {
static public void main( String[] args ) {
int repCount = Integer.parseInt( args[0] );
for( int i = 0; i < repCount; i++ ) {
System.out.println( "Test repetition " + i + "..." );
try {
final VelocityEngine velocityEngine = new VelocityEngine();
velocityEngine.init();
} catch( Exception e ) {
throw new Error( e );
}
}
}
}

Run the program with an integer command-line argument specifying the number of times to cycle through the loop, and make sure velocity-1.3.1.jar, commons-collections.jar, and either an Avalon Logkit or Log4j JAR are on your classpath. (I tested with logkit-1.0.1.jar and log4j-1.1.3.jar.) What *should* happen is that the program completes its specified number of loops, doing nothing but writing “Test repetition” over and over with an incrementing number. What *does* happen, at least on my machine, depends on which logging package is provided for Velocity.

Using Avalon Logkit 1.0.1, the program runs fine for 252 iterations; on the 253nd, it aborts with
the following message:

“PANIC : Error configuring AvalonLogSystem : java.io.FileNotFoundException: /Users/ibeatty/
Development/javaDev/VelocityBugIsolator/velocity.log (Too many open files)”

Using Log4j 1.1.3, the program runs fine for only one iteration; on the second and any subsequent iterations, it continues but prints out a whole mess of

“log4j:ERROR Attempted to append to closed appender named [null].
log4j:WARN Not allowed to write to a closed appender.”

That happens for as long as I care to let it run (95 iterations, with something over 800 lines of
such errors per iteration by the end).

To me, it sure looks like Velocity is leaving dangling loggers behind as VelocityEngine instances
are created and discarded, and that the two logging systems respond differently to this but both have problems.

Why, might you ask, should anyone care about making many VelocityEngine instances? I ran into it when developing a major web app using JUnit to build comprehensive test suites. To run
independently, every test has to start from scratch, which means getting its own VelocityEngine.
Many tests means many instances, and the logging problem kicks in. Running JUnit test suites
within Intellij IDEA and using Log4j, the ERROR/WARN messages were more than a nuicanse;
eventually, I’d start getting out-of-memory errors, too. These went away when I changed the tests to use a shared VelocityEngine instance (which caused its own set of problems).

Using binary download of Velocity 1.3.1, which claims to have been created on 2003-04-01.

I find it hard to believe nobody else has tripped over this before, so maybe it’s sensitive to the OS or something. It happened whether I compiled the test code with Javac or Jikes. Using Java
1.4.1_01.

标签:

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Java, Technology | No Comments »

[原]Create Tree menu from HHC file automatically (HHC转为树形菜单)

Posted by bianbian on 2006-09-08 02:16


本文Tags: , ,

最近写了自动把HHC代码(HHC是CHM帮助文件过程中的目录结构描述文件)生成树形菜单,方便提供在线帮助手册;否则还得手动编写在线帮助的目录结构。支持IE和Firefox、Opera,其他浏览器未测试。使用也很简单,将下载的文件解压到images目录里,然后将HHC文件后缀改为htm(我们拿dir.htm举例),并添加两行代码既可:

sorry for my poor English: I wrote a script to change a HHC file(providing tree index file structure used by CHM-help-format) to tree menu. It's useful when providing online help after having produced CHM help, or you must produce a index-page manually - it's tedious, right? I tested it under IE 6.0, firefox 1.5, and Opera 0.9. It's also easy to use: you only need unzip it to "images" directory, change *.HHC file to *.HTM(dir.htm e.g.), and add two simple lines:

  1. <link type="text/css" rel="stylesheet" href="images/hhc_tree.css" />
  2. <script src="images/hhc_tree.js"></script>

当然了,你得增加个框架,左边引用dir.htm,右边是其他帮助文件。(我的代码会自动找到宽度最大的框架,并把树形菜单里的链接target指向这个框架,所以不用担心框架的命名问题,只要命名过就可以)。像这样:

sorry again: Certainly, you need add a frame page, dir.htm on left maybe, rightside is main help area. My script will set the links' target of tree menu with the frame's name which has the maximized width. So needn't care about the name of frames-but you must set one. like this:

  1. <html>
  2. <head><title>Online Help</title></head>
  3. <frameset cols="200,600">
  4.   <frame src="dir.htm" name="index">
  5.   <frame src="main.htm" name="main">
  6. </frameset>
  7. <body>
  8. <!--let search-engine work :)-->
  9. Your browser does not support frames: <a href="dir.htm">Index</a> <a href="main.htm">Main</a>
  10. </body>
  11. </html>

没有版权,随意使用,代码内的作者不要删掉就可以。:)

sorry last: Copyleft, as long as the author-line remains unchanged.
download here: HHC to Tree Menu (2.5K)

标签: , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in JavaScript, Technology | 2 Comments »

[原] IE和Firefox在DOM解析childNodes上的不同

Posted by bianbian on 2006-09-07 18:25


本文Tags: , ,

一个问题困扰我,涉及到firstChild和lastChild的代码工作不正常。为了简单,我把问题抽象到下面这个代码,你猜点击按钮后的结果是什么?

  1. <html><body>
  2. <UL id="main">
  3.   <LI>1</LI>
  4.   <LI>2</LI>
  5. </UL>
  6. <input type=button value="click me!"
  7.   onclick="alert(document.getElementById('main').childNodes.length)">
  8. </body></html>

呵呵,在IE里提示2,在Firefox里提示5,这是怎么回事呢?UL下明明只有两个子节点,Firefox为什么提示5个子节点呢?通过查看IE和firefox的DOM结构,发现了问题的所在:
IE:IE Firefox:firefox
你也应该发现了吧?“#text”表示文本(实际是无意义的空格和换行等)在Firefox里也会被解析成一个节点,在IE里只有有实际意义的文本才会解析成“#text”。所以对firefox而言,上例中UL的fistChild并不是第一个LI,而是#text(UL和第一个LI之间的无意义文本),lastChild也并不是最后一个LI,而是最后一个LI和/UL之间的无意义文本。

解决办法是先用 .getElementsByTagName(”LI”) 得到所有LI的节点。我觉得firefox这样处理比较令程序员头痛,也没有必要。

标签: , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in JavaScript, Technology | 5 Comments »

Page 13 of 14«1234567891011121314»