.X.J's profile心 就 在 - 梦 若 在PhotosBlogListsMore Tools Help
饭否
Please wait...
Sorry, the comment you entered is too long. Please shorten it.
You didn't enter anything. Please try again.
Sorry, we can't add your comment right now. Please try again later.
To add a comment, you need permission from your parent. Ask for permission
Your parent has turned off comments.
Sorry, we can't delete your comment right now. Please try again later.
You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
Complete the security check below to finish leaving your comment.
The characters you type in the security check must match the characters in the picture or audio.
.X.J Zhouwrote:
hehe, 没办法啊,这边上班不像在学校那么自由了.
Sept. 18
Nobodywrote:
师兄 ,我来留个脚印 hoho 那天之后第三天我过来你就不在这儿啦!
Sept. 18
.X.J Zhouwrote:
看高质量编程的书,也重温下林锐的几篇文章。贴了上来
June 30
.X.J Zhouwrote:
自己灌点水书呆子
 
"I wouldn't go for coffee with you," she answered.
"Listen - I wouldn't ask you."
"That," she replied, "is what makes you stupid."
June 17
.X.J Zhouwrote:
好久没更新了……
June 17

WELCOME YOU

心 就 在 - 梦 若 在

I THINK, THERE I AM
6/9/2009

Love comes on a wing

《迁徙的鸟》片尾主题歌
 
And I know just one thing.
Love comes on a wing.
And tonight I will be by your side.
But tomorrow I will fly away.
Love rises with the day.
And tonight I will be by your side.
But tomorrow I will fly.
Tomorrow I will fly.To be by your side
Across the oceans, across the seas.
Over forests of blackened trees.
Through valleys so still we dare not breathe.
To be by your side.
Over the shifting desert plains.
Across mountains all in flames.
Through howling winds and fringing rains.
To be by your side.
Every mile and every year.
For everyone a little tear.
I can not explain this, dear.
I will not even try.
Into the night as the stars collide.
Across the border that divide.
Forest of stone standing petrified.
To be by your side.
Every mile and every year.
For everyone a single tear.
I can not explain this, dear.
I will not even try.
For I know one thing.
Love comes on a wing.
For tonight I will by your side.
But tomorrow I will fly.
From the deepest oceans to the highest peak.
Through the frontiers of your sleep.
Into the valley where we dare not speak.
To be by your side..
Across the endless wilderness
Where all the beasts bow down their heads.
Darling , I will never rest till
I am by your side.
Every mile and every year.
Time and distance disappear.
I can not explain this , dear.
No , I will not even try.
And I know just one thing.
Love comes on a wing.
And tonight I will be by your side.
But tomorrow I will fly away.
Love rises with the day.
And tonight I will be by your side.
But tomorrow I will fly.
Tomorrow I will fly.
6/6/2009

python 访问 sqlite 数据库

1 首先去www.sqlite.org下载一个sqlite,它是一个嵌入式数据库,没有服务器的概念,windows版的就是一个exe,自己把它放到一个
   合适的目录里,然后把这个目录加入系统的path变量.
   建立数据库:
      XP版本:sqlite3.exe test.db
      Linux版本:./sqlite3.bin test.db

2. 然后去找个pysqlite,这是python访问sqlite的接口,地址在这里 : http://initd.org/tracker/pysqlite
    目前针对不同的python版本,pysqlite有两个版本:2.3和2.4,请根据自己的python版本选用.
3. 然后就可以打开自己喜欢的编辑器,写一段测试代码了.
4. 中文处理要注意的是sqlite默认以utf-8编码存储.
5. 另外要注意sqlite仅支持文件锁,换句话说,它对并发的处理并不好,不推荐在网络环境使用,适合单机环境;

import pysqlite2.dbapi2 as sqlite
    
def runTest():
    cx = sqlite.connect('test.db')
    cu = cx.cursor()
    
    #create
    cu.execute('''create table catalog(
        id integer primary key,
        pid integer,
        name varchar(10) unique
        )''')

    #insert
    cu.execute('insert into catalog values(0,0,"张小山")')
    cu.execute('insert into catalog values(1,0,"hello")')
    cx.commit()
    
    #select
    cu.execute('select * from catalog')
    print '1:',
    print cu.rowcount
    rs = cu.fetchmany(1)
    print '2:',
    print rs
    rs = cu.fetchall()
    print '3:',
    print rs
    
    #delete
    cu.execute('delete from catalog where id = 1 ')
    cx.commit()
    
    
    cu.execute('select * from catalog')
    rs = cu.fetchall()
    print '4:',
    print rs
    
    #select count
    cu.execute("select count(*) from catalog")
    rs = cu.fetchone()
    print '5:',
    print rs
    cu.execute("select * from catalog")
    cu.execute('drop table catalog')

if __name__ == '__main__':
    runTest()

From: http://www.sqlite.com.cn/MySqlite/11/518.Html
5/14/2009

给latex文字加下划线和高亮显示

要给文字加下划线,用 \underline{ This is an underline text } 就可以.
跟 \emph{} 命令不同 \emph 是会让文字变跟现在文字不同. 如正体变斜体, 或者斜体变正体.

如果想要用文字高亮显示就要用到一个叫soul 的包,
这个包一共有伍个命令:
\so{letterspacing} l e t t e r s p a c i n g
\caps{CAPITALS, Small Capitals} CAPITALS, Small Capitals
\ul{underlining} underlining
\st{overstriking} overstriking
\hl{highlighting} highlighting5

如果没有加color包,那么 hl 命令就跟下划线命令一样. 通常hl是预设黄色的
可以用以下命令改变颜色
\setulcolor{bule} 设置下划线的颜色为蓝
\setstcolor{yellow} 设置overstriking颜色为黄
\sethlcolor{green} 设置高亮显示为绿
更详细的命令请查阅soul的文档

下面是一个演示文档:
\documentclass{article}
\usepackage{color, soul} %用color, 和 soul 包
\begin{document}
\setulcolor{red} set underlining color
\setstcolor{green} set overstriking color
\sethlcolor{blue} set highlighting color
\so{letterspacing} \
\caps{CAPITALS, Small Capitals}\
\ul{underlining}\
\st{overstriking} \
\hl{highlighting}
\end{document}

唯一存在的问题是:可以用在单行数学环境,但不能用在多行环境,例如"\[ \]"中不能使用。

From:http://xfyxiao.ycool.com/post.2983543.html

相关主题[related topics]: ,,,
5/11/2009

修复右键->打开方式 菜单

Windows 2000/XP/Server 2003右键点击某个文件的时候,可以选择文件的打开方式。

现象:因为卸载ACDSee3.1完美中文版,出现系统中的文件关联出错,连exe, lnk, doc, 等等所有已知的文件类型都找不到打开方式。

         这个问题基本修复方法见http://zhou-x-jun.spaces.live.com/blog/cns!EC576685E2065545!999.entry。基本问题都解

         决了。不过发现原先有的右键“打开方式”这个菜单没了,有时候很不方便,找了半天终于找到解决的办法。

原因:简单的跟了一下,初步断定有以下原因导致的:
        1、HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Open With 键丢失造成的。
        2、CLSID丢失

解决方法:由于打开方式是由Shell32.DLL完成的,因此只要重新注册Shell32.DLL就可以完成修复了。
         运行 rundll32 C:\windows\system32\shell32.dll,DllInstall 就可以完成重新注册操作了。

需要注意的是,使用上述命令会重新注册很多和shell32.dll相关的内容,不仅仅是打开方式丢失的问题。

修复右键->打开方式 菜单

Windows 2000/XP/Server 2003右键点击某个文件的时候,可以选择文件的打开方式。

现象:因为卸载ACDSee3.1完美中文版,出现系统中的文件关联出错,连exe, lnk, doc, 等等所有已知的文件类型都找不到打开方式。

         这个问题基本修复方法见http://zhou-x-jun.spaces.live.com/blog/cns!EC576685E2065545!999.entry。基本问题都解

         决了。不过发现原先有的右键“打开方式”这个菜单没了,有时候很不方便,找了半天终于找到解决的办法。

原因:简单的跟了一下,初步断定有以下原因导致的:
        1、HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Open With 键丢失造成的。
        2、CLSID丢失

解决方法:由于打开方式是由Shell32.DLL完成的,因此只要重新注册Shell32.DLL就可以完成修复了。
         运行 rundll32 C:\windows\system32\shell32.dll,DllInstall 就可以完成重新注册操作了。

需要注意的是,使用上述命令会重新注册很多和shell32.dll相关的内容,不仅仅是打开方式丢失的问题。

5/8/2009

[转]远航

 

很沧桑唯美的一首歌,如果您是一个感性的人,那么当您在听到这首歌时您会不禁心旷神怡。此歌旋律优美,歌词朗朗上口,就算是英文不熟悉的人,也可以学会。歌词字里行间暗藏思乡之情,感觉自己似乎就在大海中航行。。。。。。
  此歌后来作为电影《哥伦布传》的插曲,虽然已是一首老歌,但是在该电影播出后,此歌却奇迹般地在阔别歌坛排行榜26年后重登音乐榜首,并占据TOP1位置长达14周之久。
有“摇滚公鸡”之称的洛德·斯洛华特(Rod stewart)以独特的沙哑歌喉、丰富的音乐风格、精彩的演唱魅力不仅屡创音乐生涯新高,也奠定了他稳固的乐坛地位。从融合民谣、摇滚、蓝调、灵魂乐、迪斯科的70年代;接着加入new wave 电子之声的80年代到以翻唱曲再显风华的90年代,都让乐迷不断地享受Rod所带来的音乐新意。英国的国宝级歌手。
Sailing  歌词
I am sailing, I am sailing                 我在航行,乘风破浪,
Home again across the sea.           跨越重洋又回到了家乡。
I am sailing stormy waters,            我迎着狂风暴雨,正在远航,
To be near you, to be free.                向你靠近,向着自由。
I am flying, I am flying                   我在飞翔,展翅高飞,
Like a bird across the sky.                像只小鸟自由翱翔。
I am flying, passing high clouds           朝着天际,穿越云霄。
To be with you, to be free.                与你同行,获得自由。
Can you hear me? Can you hear me           你可听到,我的呼唤?
Thru the dark night far away?              穿越黑暗,越来越远.
I am dying forever crying                  哭声中我渐离你远去,
To be with you, who can say?               谁又知道我要这样去靠近你?
We are sailing, We are sailing             一起航行,乘风破浪,
Home again across the sea.                 跨越重洋又回到了家乡。
We are sailing stormy warters,             我们航行,迎着风暴,
To be near you, to be free.                向你靠近,获得自由。
We are sailing, We are sailing             一起航行,乘风破浪,
Home again across the sea.                 跨越重洋又回到了家乡。
We are sailing stormy warters,             我们航行,迎着风暴,
To be near you, to be free.                向你靠近,获得自由。
Oh, Lord, to be near you,                  向你靠近,获得自由。
To be free.
Oh, Lord, to be near you,                  向你靠近,获得自由。
To be free.  
Oh, Lord, to be near you,                  向你靠近,获得自由。
To be free.
Oh, Lord.                                  今生今世,直到永远。

From:http://qzone.qq.com/blog/823143899-1206429282

5/3/2009

解决 Linux 下 firefox 中的 flash 中文乱码问题

解决方法很简单,操作如下:修改/etc/fonts/conf.d/49-sansserif.conf

   1: <?xml version="1.0"?>
   2: <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
   3: <fontconfig>
   4: <!--
   5: If the font still has no generic name, add sans-serif
   6: -->
   7: <match target="pattern">
   8:     <test qual="all" name="family" compare="not_eq">
   9:         <string>sans-serif</string>
  10:     </test>
  11:     <test qual="all" name="family" compare="not_eq">
  12:         <string>serif</string>
  13:     </test>
  14:     <test qual="all" name="family" compare="not_eq">
  15:         <string>monospace</string>
  16:     </test>
  17:     <edit name="family" mode="append_last">
  18:         <string>sans-serif</string>
  19:     </edit>
  20: </match>

将上面的18行改成 <string>永中宋体</string>

当然了,前提是你的系统中有中文字体,还可以安装windows的字体。

 

方法二:更简单。

           第一步:备份/etc/fonts/conf.d/49-sansserif.conf

           第二步:删除/etc/fonts/conf.d/49-sansserif.conf

 

然后重新刷新firefox页面就可以了(无需重启firefox)。

相关主题[related topics]: ,,,
4/27/2009

Ubuntu 8.10 升级到 9.04 后安装 NVIDIA 显卡最新驱动

电脑:T61
显卡: nVIDIA NVS 140M
系统:Ubuntu Desktop 9.04-64 位
驱动: NVIDIA-Linux-x86_64-180.51-pkg2.run

问题描述
-------------------------------------------------------------------------------------
    我之前是64位8.10,经不住诱惑,升级到了9.04,发现桌面效果都不能用了。按照nvidia官方
    的驱动NVIDIA-Linux-x86_64-180.51-pkg2.run安装,安装成功,却启动gdm一直出错。
    在论坛看到有人手动安装NVidia之前的驱动方式,我相应试了一下,居然这次成功了。
    (主要是有昨晚上失败的经验,万一不成功,可以用新立得重新删除所有相关的nvidia驱动,
    再用新立得安装推荐的最新驱动180.44。总之,不怕什么。)

---------------------------------------------------------------------------------------
安装流程大概说的如下:
    1. 下载驱动,最新版NVIDIA-Linux-x86_64-180.51-pkg2.run
    2. 关闭X server
    3. 运行sh 进行安装
    4. 自动安装Kernel Interface
    5. 配置nvidia-config 文件

可能出问题的三个地方:
---------------------------------------------------------------------------------------
    (1)安装之前要关闭X server
        最简单的方法:以root权限运行 /etc/init.d/gdm stop 即可。注意,这里gdm是为使用gnome用的,如果使用kde请使用kdm。安装成功之后启用x server则用 /etc/init.d/gdm start。
   
    (2)安装过程中要编译Kernel Interface
        驱动安装中会自动检测系统是否有已经编译好的Kernel Interface。如果没有,驱动会提供两种安装方式,首先它会让你选择是不是自动连接到nvidia官网进行下载。
        我的经验建议不选择此种方式,网络延迟等方面原因导致下载失败,提示没有匹配的文件。选“否”进入下一步安装程序会让你选择是否让驱动程序为你编译产生这
        个Kernel Interface。建议选此项,会比较顺利。选此项要求你的系统中安装有 libc。如果没有请运行sudo apt-get install libc6-dev 一行命令搞定。
   
    (3)删除受限驱动
        多数人的系统安装了光盘自带的受限驱动,例如nvidia-glx, nvidia-glx-new等。安装新驱动钱要先删除这些受限驱动并进行一些设置。
        执行命令:
            sudo apt-get remove --purge nvidia-glx nvidia-glx-new
            (我用的是: sudo apt-get remove nvidia-s所有相关的驱动,包括nvidia-common-什么的)
        然后删除 /lib/linux-restricted-modules/文件夹下面的有一个隐藏文件.nvidia-new-installer也要删掉。(在我的系统没有这个文件)
        再检查一下/etc/init.d/nvidia-glx 和 /etc/init.d/nvidia-kernel 这两个文件是否存在,有则删之。
   
    最后设置禁用其他的driver驱动模块
    sudo gedit /etc/default/linux-restricted-modules-common (命令行下请用vi之类的修改)
    将其中的 DISABLED_MODULES="" 改为:DISABLED_MODULES="nv nvidia_new"


正式安装
---------------------------------------------------------------------------------------
    1.下载驱动NVIDIA-Linux-x86_64-180.51-pkg2.run放到某一个目录如 /home/yourname/。
    2.防患于未然,运行 sudo apt-get install libc6-dev,安装libc。
    3.ctrl + alt + F2, 这时候你应该看到黑屏。(当然现在x server 并没有关闭。ctrl + alt + F7 可回到图形界面。)login状态,输入用户名密码登陆,执行sudo su 输入密码切换到root身份。
    4.运行 /etc/init.d/gdm stop. 看到一则关闭OK的消息。这时候X server真正关闭了
    5.运行安装程序 sh /home/yourname/NVIDIA-Linux-x86_64-180.51-pkg2.run,这时候应该看到界面了。Step by Step直到安装Kernel Interface,参考上面的方法应该一切顺利。
    6.编译完Kernel Interface,驱动安装完毕。安装程序会询问你是否自动更新配置,建议选OK好了。
   
        相关配置已经应用了。如不放心可以用命令 sudo vi /etc/X11/xorg.conf看其中Section "Device" 下的Driver "XX" 是否为 Driver "nvidia"。
        诸如分辨率之类可以在启动X server 之后,用 nvidia的工具修改:gksudo nvidia-settings 图形界面,不必多说。
    7.运行 /etc/init.d/gdm start重新启动 X server。 不出意外,应该是画面一闪,nvidia的logo出现,然后出现图形登录界面.驱动安装成功!
   
    如果出现“安装之后第一次启用X server没有问题,但是重启之后驱动失效”现象,则说明你在安装之前没完全清除受限驱动。请把就以前驱动彻底卸载掉,不论是 nvidia-glx还是nvidia-glx-new。

Windows 系统下修改网卡MAC地址

更改网卡MAC地址的文章网络中有很多,但大都说的不够详细,下面我以Windows XP操作系统为例介绍两种网卡MAC地址的修改方法,希望对大家有所帮助。
简单的修改方法

        你们可以在桌面上的“网上邻居”图标上单击右键,选择“属性”,在弹出的“网络连接”的对话框中,在“本地连接”图标上单击右键,选择“属性”,会弹出一 个“本地连接属性”的对话框,单击“配置”按钮,选择“高级”,选中左栏“属性”中“Network Address”(其实,并非所有的网卡,对物理地址的描述都用“Network Address”,如Intel的网卡便用“Locally Administered Address”来描述,只要在右栏框中可以找到“值”这个选项就可以了),然后选中右栏框“值”中的上面一个单选项(非“不存在”),此时便可在右边的 框中输入想改的网卡MAC地址,形式如“000B6AF6F4F9”。点击“确定”按钮,修改就完成了。

        不过,有一些网卡没有这个选项,不要着急,可以先更新网卡的驱动程序试试,一般情况下,更新驱动之后都会出现这个选项。但是依然有特殊情况,无论怎么修改都没有这个选项,那怎么办呢?接着往下看,下面的方法可以说是万能的!
注册表修改方法

        第1步,单击“开始”,选中“运行”,键入“regedit”调出注册表。

        第2步,在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class \{4D36E972-E325-11CE-BFC1-08002BE10318}\0000、0001、0002 等主键下,查找 DriverDesc ,内容为要修改的网卡的描述,如Intel的网卡会被描述成“Intel(R) PRO/100+ Management Adapter”,3Com的网卡会被描述成“3Com EtherLink XL 10/100 PCI For Complete PC Management NIC (3C905C-TX)”等。

         注:上面提到的关于网卡描述的选项出现的位置,和网卡本身以及操作系统有关。不同的网卡可能出现在不同的主键下,而同一网卡用不同版本的操作系统(如OEM版,VOL或者VLK等)也会出现在不同的位置。而这一步的任务就是找到含有网卡描述的主键。

          第3步,选中在第二步找到的主键,在右栏框中添加一个字符串,命名为“Network Address”,其值设为要改的MAC地址,形式如“000B6AF6F4F9”。

           注:到这一步,修改网卡物理地址的任务可以说是完成了,有的网卡需要重启以下才能正常的工作,而有的只需一点点的时间“反应”一下而已。下面的几步是为了以后再修改物理地址方便用的,如果你们不再需要再次修改,到这里可以止步了。

          第4步,在“第一步选中的主键”\Ndi\params下添加一项名为“NetworkAddress”的主键,此时一般都会随着在右栏框中产生一个 “(默认)”的字符串,将其值设置为最终想要修改的MAC地址,形式如“000B6AF6F4F9”。如果没有此字符串,读者也可自行添加此字符串。

        注:此步骤就是为网卡设置一个初始MAC地址。

        第5步,在“NetworkAddress”的主键下继续添加名为“ParamDesc”的字符串,其作用为指定“NetworkAddress”主键的 描述,其值可自己命名,如“Network Address”,这样在网卡的高级属性中就会出现“Network Address”选项,就是刚在注册表中加的新项“NetworkAddress”,以后只要在此修改MAC地址就可以了。


         第6步,在“NetworkAddress”的主键下继续添加名为“Optional”的字符串,其值设为“1”,则以后在网卡的高级属性中选择“Network Address”项时,右边会出现“不存在”选项。

          第7步,重新启动计算机(不是一定要重新启动,但要视不同网卡的要求而定,不过,重启没有任何差错。),按照第一种方法找到“高级”选项就可发现此时“属 性”栏中已有“Network Address”的选项,现在读者可以用来直接修改MAC地址或恢复原来的地址。

4/26/2009

控制台模式启动Ubuntu

如果想Ubuntu在每次启动到command prompt,可以输入以下指令:
  $echo “false” | sudo tee /etc/X11/default-display-manager
  或者直接打开文件/etc/X11/default-display-manager删除文件中已有内容然后输入false

------------------
  当下次开机时,就会以指令模式启动,如果想变会启动x window,可以输入:
  $echo “/usr/sbin/gdm” | sudo tee /etc/X11/default-display-manager
  如果不是用 gdm作为,以上指令需要根据你的环境作出更改,例如 kdm 或 xdm。
  tee - read from standard input and write to standard output and files
-------------------

在控制台下想进入x-window,可以在root用户下输入:
  gdm
       用startx进图形界面,退出图形界面也可以运行命令logout

 
Photo 1 of 18