jimmy's profileJDlogPhotosBlogLists Tools Help
    April 21

    空荡荡沉甸甸的一周

    空荡荡沉甸甸的一周

    jimmy | 21 四月, 2006 17:21

    茫然间,又是周五了。

    很多朋友说起来,都有周五恐惧症:忙忙碌碌,脑子里面刚刚把一大堆要做的东西思路整理清晰,却发现再有几个小时这周就结束了。忙了整一周,回头看看,这成果却是寥寥。

    回顾我这一周,仍然是一直在忙,却是空荡荡的。同事们工作的都很努力,各个任务的进展还算顺利。没有特别紧急的任务,不用一次一次干到2点多;压力也不大,平均加班时间从12点多提前到11点多了。

    但是,心里却是感觉沉甸甸的。可能,是因为内容部的动荡?可能,是因为严打造成的PV下降?还是,因为从来没时间去学的考试?……不知道。

    无论是怎样,下周必需要振作起来。五一前的时间很宝贵,基本上五月中旬前能够见到的东西,都决定在下周了。

    或许,是太缺睡眠了?

    ~~呵呵~~

    小技巧 几个小东东

    小技巧 几个小东东

    jimmy | 21 四月, 2006 17:02

    SecureCRT连接服务器,ANSI color:

    Redhat: TERM=xterm-color; export TERM

    Other: setenv TERM xterm-color

    IE不能点击右键看源代码:

    1,缓冲满了。

    2,被禁止

    “HKEY_CURRENT_USERSoftware PoliciesMicrosoftInternet Explorer Restrictions”,在右边的窗格中找到一个名为NoViewSource的值,如果当前的数值数据设置为1,则双击它,将数值数据更改为0

    3,程序不对

    “HKEY_LOCAL_MACHINESoftware MicrosoftInternet ExplorerView Source EditorEditor Name”

    ~~呵呵~~

    小技巧: 卸载Symantec Antivirus

    小技巧: 卸载Symantec Antivirus

    jimmy | 21 四月, 2006 09:38

    对NAV已经失望了……

    Manually uninstalling Symantec AntiVirus Corporate Edition 9.x client from Windows NT/2000/XP/2003

    Situation:
    This document describes how to uninstall Symantec AntiVirus Corporate Edition 9.x client from Windows NT/2000/XP or Windows Server 2003 (32-bit) manually.

    Solution:
    Removing Symantec AntiVirus client manually takes the following four basic steps: Stop Symantec AntiVirus services Remove Symantec AntiVirus from the registry Remove Symantec AntiVirus from the Start menu Remove Symantec AntiVirus from the hard drive

    Stop Symantec AntiVirus services
    Stop the following services before removing items from the registry, Start menu, or hard drive. Intel Alert Handler Intel Alert Originator Intel File Transfer Intel PDS SAVRoam Symantec AntiVirus Definition Watcher Symantec Event Manager Symantec Network Drivers Service Symantec Password Validation Symantec SecurePort Symantec Settings Manager Symantec AntiVirusOn the Windows taskbar, click Start > Run. In the Run Dialog box type the following:

    services.msc
    Click OK. Right-click the Intel Alert Handler service, and click Stop. Perform step 4 for each of the services listed above.

    To remove the Symantec AntiVirus keys from the registry
    You must have administrator permissions (read and write) to edit the registry.

    WARNING: We strongly recommend that you back up the registry before you make any changes to it. Incorrect changes to the registry can result in permanent data loss or corrupted files. Modify only the keys that are specified. Read the document How to back up the Windows registry for instructions.
    Exit all open programs. On the Windows taskbar, click Start > Run. In the Run dialog box, type the following:

    regedit
    Click OK. In Registry Editor, in the left pane, go to the following key:

    HKEY_CLASSES_ROOT*ShellexContextMenuHandlers
    Right-click the LDVPMenu entry, and then click Delete. Go to the following key:

    HKEY_LOCAL_MACHINESOFTWARESymantec
    Delete the following child keys: Common Client SharedDefs Symantec AntiVirus Symevent SymNetDrv
    Go to the following key in the left pane:

    HKEY_LOCAL_MACHINESOFTWARESymantecInstalledApps
    Delete the following entries: VP6ClientInstalled VP6UsageCount AVENGEDEFS Common Client Common Client Data Common Client Decomposers IDSDefs SAVCE SAV Install Directory SCS Install Directory Symantec Shared Directory SymNetDrv
    Go to the following key in the left pane:

    HKEY_LOCAL_MACHINESystemCurrentControlSetServices
    Delete the following child keys:

    Note: Delete the SymEvent keys only if Symantec Client Security is the only Symantec program installed. ccEvtMgr ccPwdSvc ccSetMgr DefWatch Intel Alert Handler Intel Alert Originator Intel File Transfer Intel PDS NAVENG NAVEX15 SavRoam SAVRT SAVRTPEL SNDSrvc Symantec AntiVirus SymEvent SYMREDRV SYMTDI
    Go to any existing "ControlSet*"Services keys and delete the same entries like in the previous step. Delete the SymEvent keys only if Symantec Client Security is the only Symantec program installed. Go to the following key in the left pane:

    HKEY_LOCAL_MACHINESystemCurrentControlSetServicesEventLogApplication
    Delete the following entries: Defwatch ccEvtMgr ccSetMgr Intel Alert Handler Intel Alert Originator Intel AMS II Intel File Transfer Service Intel PDS Service SavRoam Symantec AntiVirus
    Go to the following key in the left pane:

    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventlogSystem
    Delete the following SAVRT entry. Go to any existing "ControlSet*"ServicesEventLogApplication and "ControlSet*"ServicesEventLogSystem keys and delete the same entries like in the previous four steps. Go to the following key in the left pane:

    HKEY_LOCAL_MACHINESOFTWAREINTEL
    Under the Intel key, expand the DllUsage key, and then delete the VP6 key.

    WARNING: Be careful not to delete the Intel folder, since other programs or hardware might be using this key. In the left pane, highlight "My Computer." Click Edit > Find. Search for "VirusProtect6" and delete all entries of this key. In the left pane, highlight "My Computer." Click Edit > Find. Search for:

    497CA84818B8A04418EA464733D75B72
    Delete all entries found.

    WARNING: Follow the next two steps only if no other Symantec applications use virus definitions on the computer. If there are applications using virus definitions when the SharedDefs key is deleted, they will have to be uninstalled and reinstalled in order to function. If other Symantec applications that use virus definitions are installed, skip to step 31. Otherwise, go to the HKEY_LOCAL_MACHINESoftwareSymantec key. Delete the SharedDefs entry. Go to the following key in the left pane:

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall
    Delete the {848AC794-8B81-440A-81AE-6474337DB527} key. Go to the following key in the left pane:

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun
    Delete the vptray and ccApp keys. Restart the computer.
    Symantec AntiVirus is now disabled, even though traces of it remain in the registry. These traces have little impact on how your computer operates. It is not necessary to remove them.

    To remove Symantec Client Security from the Start menu Right-click the Start button, and then click Open All Users. Double-click Programs. Right-click the Symantec Client Security folder, and then click Delete.

    To remove Symantec Client Security from the hard drive Click Start, point to Programs, and then click Windows Explorer. Go to the Program Files folder. Delete the Symantec AntiVirus folder.

    WARNING: Follow the next three steps only if Symantec AntiVirus is the only Symantec application installed. If the VirusDefs folder is deleted while there are other Symantec applications using virus definitions, they must be uninstalled and reinstalled in order for them to function. If Symantec AntiVirus is the only Symantec product on your computer, delete the Symantec folder. Go to the Program FilesCommon FilesSymantec Shared folder. If Symantec AntiVirus is the only Symantec product on your computer, delete the VirusDefs folder. Go to the folder appropriate for your operating system:
    In Windows NT 4.0, go to the following folder:
    C:WinntProfilesAll UsersApplication DataSymantec
    In Windows 2000/XP/2003, go to the following folder:
    C:Documents and SettingsAll UsersApplication DataSymantec
    Delete the Symantec AntiVirus Corporate Edition folder. Exit Windows Explorer

    ~~呵呵~~

    April 13

    小技巧点滴 JavaScript中判断字符串的长度

    小技巧点滴 JavaScript中判断字符串的长度

    jimmy | 13 四月, 2006 19:35

    社区发表文章页,标题和内容是有字符数限制的。前两天上了一个功能,输入内容时提示还可以输入的长度。

    这里遇到问题: 存储是按照字节设置的,可是前端Javascript按照自然字(英文为1,中文也是1),导致前台判断不准确。

    MSND里面翻,没看到MS提供获取字符长的方法。只能用笨方法了。

    String.prototype.length2 = function() {
    var cArr = this.match(/[^x00-xff]/ig);
    return this.length + (cArr == null ? 0 : cArr.length); }

    var str="test测试";
    alert(str.length2());

    另外,读贴页的快速回复中,还用到左右键翻页,用onkeydown实现的。在快速回复中如果想让光标左右移动,就会导致翻页,用户感受很不好。

    先去找类似 getElementByFocus 的方法——没有

    然后找 Element.hasfocus(),找到了。但是放上去用,报错。MSDN再查,发现只能用于 document 。KAO。

    最后,还是只能用笨方法:在标题和内容框上,分别用 onfocus、onblur 来控制一个全局变量,放置翻页。

    感觉Javascript太长时间没有改进版本了。可能,以后也不会再有了。

    ~~呵呵~~

    小技巧点滴 MySQL坏表修复

    小技巧点滴 MySQL坏表修复

    jimmy | 13 四月, 2006 19:25

    周日给连载做索引的时候,2万多数据就变7000了。恢复了备份,测试能正常工作。然后用mysqlcheck,报告数据数量错误,修复后又变7000。用MyISAMcheck也不起作用。

    如何操作呢? 简单的办法,恢复备份,过一遍,判断读取是否正常。如果读取正常,mysqldump 数据库 表 > temp.sql,然后: mysql new_db < temp.sql。 再Check一下,没有错误了。搞定!

    还有一种,是顺序读取到一定位置后,就不能读取了。在check和ISAMcheck都不能修复的情况下,可以用程序不断试探,把不能读取的段列出来,然后将能够读取的取出,放入新数据库。

    所以,我个人认为,定期对MySQL进行Check是很有必要的。

    ~~呵呵~~

    April 09

    杂七杂八的工作 神奇的VPN

    杂七杂八的工作 神奇的VPN

    jimmy | 09 四月, 2006 14:41

    昨天在单位待了一天,没发生什么事情。今儿上午一起来,就冒出来一堆:

    有静态页面要手工删除的

    有频道社区首页需要临时更新的

    有服务器数据库工作不正常的

    有需要调整需求禁止贴Flash的

    …… ……

    不爽的是,从上个月开始,我的VPN就表现很奇怪。SOHU的VPN一向是很神奇的,有的人装了就能用,有的人装也装不上,有的装上连不上,有的装上连上就是用不了…… 其中缘由个说纷纭,反正谁也将不清楚。

    我的问题是最后一个: 装上、连上,访问网页正常,就是连不上Server。电话联络了其他的同事,在MSN上把需要改的都搞定了,还是觉得不爽。决定花一点时间把这个搞定,不然以后还是麻烦问题。


    从防火墙、IP协议、安全策略…… 逐个查下来,都没有问题。检查路由表,哦,发现:

    ===========================================================================
    Active Routes:
    Network Destination Netmask Gateway Interface Metric
    0.0.0.0 0.0.0.0 192.8.1.1 192.8.1.102 20
    10.0.0.0 255.0.0.0 10.1.8.245 10.1.8.245 10
    10.1.8.245 255.255.255.255 127.0.0.1 127.0.0.1 10
    10.255.255.255 255.255.255.255 10.1.8.245 10.1.8.245 10
    127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
    192.8.1.0 255.255.255.0 192.8.1.102 192.8.1.102 20
    192.8.1.1 255.255.255.255 192.8.1.102 192.8.1.102 1
    192.8.1.102 255.255.255.255 127.0.0.1 127.0.0.1 20
    192.8.1.255 255.255.255.255 192.8.1.102 192.8.1.102 20
    202.106.180.11 255.255.255.255 192.8.1.1 192.8.1.102 1
    224.0.0.0 240.0.0.0 10.1.8.245 10.1.8.245 10
    224.0.0.0 240.0.0.0 192.8.1.102 192.8.1.102 20
    255.255.255.255 255.255.255.255 10.1.8.245 20002 1
    255.255.255.255 255.255.255.255 10.1.8.245 10.1.8.245 1
    255.255.255.255 255.255.255.255 192.8.1.102 192.8.1.102 1
    Default Gateway: 192.8.1.1
    ===========================================================================

    192.8.1.1 是我本地的网关,10.1.8.245是VPN连接。公司的内网服务器在 192.168段上,路由表上的路径不对。

    手工添加路由:

    route add 192.168.0.0 mask 255.255.0.0 10.1.8.245 IF 0x20005

    再次检查路由表:

    ===========================================================================
    Active Routes:
    Network Destination Netmask Gateway Interface Metric
    0.0.0.0 0.0.0.0 192.8.1.1 192.8.1.102 20
    10.0.0.0 255.0.0.0 10.1.8.245 10.1.8.245 10
    10.1.8.245 255.255.255.255 127.0.0.1 127.0.0.1 10
    10.255.255.255 255.255.255.255 10.1.8.245 10.1.8.245 10
    127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
    192.8.1.0 255.255.255.0 192.8.1.102 192.8.1.102 20
    192.8.1.1 255.255.255.255 192.8.1.102 192.8.1.102 1
    192.8.1.102 255.255.255.255 127.0.0.1 127.0.0.1 20
    192.8.1.255 255.255.255.255 192.8.1.102 192.8.1.102 20
    192.168.0.0 255.255.0.0 10.1.8.245 10.1.8.245 1
    202.106.180.11 255.255.255.255 192.8.1.1 192.8.1.102 1
    224.0.0.0 240.0.0.0 10.1.8.245 10.1.8.245 10
    224.0.0.0 240.0.0.0 192.8.1.102 192.8.1.102 20
    255.255.255.255 255.255.255.255 10.1.8.245 20002 1
    255.255.255.255 255.255.255.255 10.1.8.245 10.1.8.245 1
    255.255.255.255 255.255.255.255 192.8.1.102 192.8.1.102 1
    Default Gateway: 192.8.1.1
    ===========================================================================

    连接服务器,连上了! OK,搞定。

    ~~呵呵~~

    April 08

    杂七杂八的工作 索引的效率

    杂七杂八的工作 索引的效率

    jimmy | 08 四月, 2006 17:02

    大家都知道有索引跟没有索引的效率区别。上次我也介绍了复合索引的使用。

    但是,复合索引的创建也是需要技巧的:复合索引的每一项的前后顺序决定了索引效率!这次用一个具体实例来说明一下:


    如下表结构:

    我们关心其中的: serialiseid (主键) , template(模板分类),delflag(删除标志)

    一个典型的SQL语句:

    select * from s_table where serialiseid > $objid AND template='$template' AND delflag=0

    分别考虑三种创建索引的方式:

    1,单索引, template, delflag 分别建索引。

    2,复合索引:

    3,另一种复合索引:

    分析:

    第一种,是最常见的。

    第二种,似乎复合需要。但是事实上,serialiseid本身是主键,作为复合索引第一项后,每一个serialiseid的小目录表中只会有一个项,后两项基本没有意义。

    的三种,按照Template先做索引,然后索引delflag,最后定位serialiseid,效率会最高。

    实测:

    随机创建1000个查询,测试结果两种复合索引的对比:

    1。5349159240723 seconds

    0.79422092437744 seconds

    结果相差几乎一倍。

    但是,并不是第一级越疏松越好。第一级如果过于疏松,会导致每个格子里面放大量内容,致使索引缓冲存放的数量减少,而最终导致性能下降。

    更进一步讲,复合索引,可以看作一棵树,索引项为层数。越能够均衡,效率越高。

    ~~呵呵~~

    杂七杂八的工作 PhpMyAdmin的乱码解决

    杂七杂八的工作 PhpMyAdmin的乱码解决

    jimmy | 05 四月, 2006 16:33

    一些历史原因的数据库用Latin1存放GB编码的中文,用PhpMyadmin查看的时候是乱码。下面简单记录一下修改的过程:

    下拉选择中文后,查看页面编码还是Unicode的。下拉菜单中的简体中文不解决问题。

    查看文件: ../libraries/select_lang.lib.php[line:323]

    'zh-gb2312' => array('zh|chinese simplified', 'chinese_simplified-gb2312', 'zh', '中文'),
    'zh-utf-8' => array('zh|chinese simplified', 'chinese_simplified-utf-8', 'zh', '中文'),


    明明有两个中文选项,为什么只显示了一个呢?


    注意到上方说明中:[line:199]

    * When there are more than one charset for a language, we put the -utf-8
    * last because we need the default charset to be non-utf-8 to avoid
    * problems on MySQL < 4.1.x if AllowAnywhereRecoding is FALSE.

    全目录搜索-utf-8,查到/libraries/database_interface.lib.php [line:725]

    // and we remove the non-UTF-8 choices to avoid confusion
    if (!defined('PMA_REMOVED_NON_UTF_8')) {
    foreach ( $GLOBALS['available_languages'] as $each_lang => $dummy ) {
    if ( substr($each_lang, -5) != 'utf-8' ) {
    unset( $GLOBALS['available_languages'][$each_lang] );
    }
    }
    define('PMA_REMOVED_NON_UTF_8', 1);
    }
    整个注释掉(当然删掉一样啦 :)

    还有上面的一段:

    // If $lang is defined and we are on MySQL >= 4.1.x,
    // we auto-switch the lang to its UTF-8 version (if it exists and user
    // didn't force language)
    if ( !empty($GLOBALS['lang'])
    && (substr($GLOBALS['lang'], -5) != 'utf-8')
    && !isset($GLOBALS['cfg']['Lang']) ) {
    $lang_utf_8_version =
    substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-'))
    . '-utf-8';
    if (!empty($GLOBALS['available_languages'][$lang_utf_8_version])) {
    $GLOBALS['lang'] = $lang_utf_8_version;
    $GLOBALS['charset'] = 'utf-8';
    }
    }

    自动转化? 咔咔咔!果然不了解中国国情呀。所以说,有时候太傻瓜了也不好。

    回到PhpMyAdmin,看一下,页面可以按GB2312编码了。

    但是…… 怎么还是乱码呢? 别急,肯定是从数据库取出来的过程中的问题。

    接着刚才的处理函数往下看,[line:745]

    PMA_DBI_query('SET NAMES ' . $mysql_charset . ';', $link,
    PMA_DBI_QUERY_STORE);
    } else {
    PMA_DBI_query('SET CHARACTER SET ' . $mysql_charset . ';', $link,
    PMA_DBI_QUERY_STORE);
    传输字符集还是用的unicode的。

    修改[line:737]为:

    //$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']];
    $mysql_charset = "latin1";

    回去看,OK了!

    其实还需要再修改一下,配合选择的zh-gb2312 还是 zh-utf-8 来改变连接字符集设定。不过懒得弄了。

    再补充一个小技巧: 在左侧目录上直接现实基本信息,对提高工作效率非常有帮助。

    其实,PhpMyadmin已经把这个数字取出来了,只是要鼠标放上去才显示,太不方便。改进后对效率没有一点影响,一目了然方便多了。

    ../left.php [line:520]

    echo ' id="icon_' . htmlspecialchars( $table_db . '.' . $table['Name'] ) . '"'
    .' width="10" height="10" alt="' . $GLOBALS['strBrowse'] . '" /></a>' . " "
    .'<a href="' . $href . '" title="' . $table['Comment']
    .' (' . PMA_formatNumber( $table['Rows'], 0 ) . ' ' . $GLOBALS['strRows'] . ')"'
    .' id="' . htmlspecialchars( $table_db . '.' . $table['Name'] ) . '">'
    . htmlspecialchars( $table['disp_name'] ) . '</a>';
    echo '</li>' .' | <font style="background-color: #C0C0C0" color=#FFFFFF>('.htmlspecialchars( $table['Comment'] )." ".PMA_formatNumber( $table['Rows'], 0 ).')</font> '." ";

    加粗的那行就是需要改的地方。

    ~~呵呵~~