<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Li Yue [学习笔记]</title>
	<atom:link href="http://www.liyue.org/tech/feed" rel="self" type="application/rss+xml" />
	<link>http://www.liyue.org/tech</link>
	<description>技术笔记</description>
	<lastBuildDate>Fri, 08 Jan 2010 06:08:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Apache自定义错误信息并跳转到各自网站首页</title>
		<link>http://www.liyue.org/tech/archives/203</link>
		<comments>http://www.liyue.org/tech/archives/203#comments</comments>
		<pubDate>Fri, 08 Jan 2010 06:06:01 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[web优化]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=203</guid>
		<description><![CDATA[一、自定义错误信息页面，并根据所请求的URL所在的域，跳转到所在域名。
二、自定义APACHE错误信息，指定错误信息页面。配置文件里面有例子信息，去掉下面的注释符号#，激活。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    Alias /error/ &#34;/usr/local/apache2/error/&#34;
&#160;
    &#60;Directory &#34;/usr/local/apache2/error&#34;&#62;
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
      [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/203/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache性能优化之启用gzip压缩</title>
		<link>http://www.liyue.org/tech/archives/199</link>
		<comments>http://www.liyue.org/tech/archives/199#comments</comments>
		<pubDate>Mon, 30 Nov 2009 13:36:39 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[web优化]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[mod_deflate]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=199</guid>
		<description><![CDATA[首先查看apache是否加载了mod_deflate.so模块，如果没有需要安装加载。
找到并下载和当前apache版本相同的源码文件，解压缩到/home目录下，
在apache安装目录下执行：

/usr/local/apache2/bin/apxs -i -c /home/httpd-2.0.63/modules/filters/mod_deflate.c

会自动在 httpd.conf添加

LoadModule deflate_module modules/mod_deflate.so

添加如下设置：

&#60;IfModule mod_deflate.c&#62;
&#60;Location /&#62;
#Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems…    
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems 
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.59
# the [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/199/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache安全性调整</title>
		<link>http://www.liyue.org/tech/archives/197</link>
		<comments>http://www.liyue.org/tech/archives/197#comments</comments>
		<pubDate>Mon, 30 Nov 2009 12:44:00 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[web优化]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=197</guid>
		<description><![CDATA[对 web服务器进行安全性端口扫描，发现一些问题，apache加以调整：
1、HTTP TRACE method
   需要关闭HTTP TRACE 方法，检测apache是否打开了trace方法，使用如下方法：

  telnet 127.0.0.1 80

   Trying 127.0.0.1&#8230;
Connected to 127.0.0.1.
Escape character is &#8216;^]&#8217;.

TRACE / HTTP/1.0
Host: foo

然后按两次回车，出现下面的信息，证明方法激活了。
HTTP/1.1 200 OK
Date: Sat, 20 Oct 2007 20:39:36 GMT
Server: Apache/2.2.6 (Debian)
Connection: close
Content-Type: message/http
TRACE / HTTP/1.0
Host: foo
否则会出现：
HTTP/1.1 403 Forbidden
等信息。
解决方法：修改httpd.conf，修改如下数值：TraceEnable Off
2、隐藏apache版本等信息：
访问一个不存在的页面，apache会报如下错误：
Not Found
The requested URL /ss.c was not found on this server.
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
Apache/2.0.63 (Unix) DAV/2 [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/197/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数据泵导入导出数据</title>
		<link>http://www.liyue.org/tech/archives/192</link>
		<comments>http://www.liyue.org/tech/archives/192#comments</comments>
		<pubDate>Mon, 30 Nov 2009 12:21:53 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[expdp]]></category>
		<category><![CDATA[impdp]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=192</guid>
		<description><![CDATA[数据导入，首先需要知道导入端oracle的dpump_dir目录，通过执行下面的语句查看系统表：

SELECT * FROM dba_directories


得到DPUMP_DIR路径为：/var/web/exp_bak/pumpdata
将备份的dmp文件放到这个路径下，执行：

./impdp user/pass dumpfile=Oracle_bak_20091130.dmp directory=dpump_dir

dmp文件必须要放到dpump_dir目录下，并且dumpfile 不能带路径，否则，出现下面类似错误：
UDI-00008: operation generated ORACLE error 1034 ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory UDI-00003: all allowable logon attempts failed 
用oracle帐户登陆系统后，执行cat ~/.bash_profile，查看oracle帐户的环境变量。
如果用su oracle，则oracle环境变量不会执行，可以运行source ~/.bash_profile
执行环境变量配置文件而不必重新用oracle帐户登陆。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/192/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>系统备份之定期清理日志文件</title>
		<link>http://www.liyue.org/tech/archives/186</link>
		<comments>http://www.liyue.org/tech/archives/186#comments</comments>
		<pubDate>Fri, 06 Nov 2009 09:21:16 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=186</guid>
		<description><![CDATA[一、前言
　　系统备份会定期产生备份文件，日积月累，早期的备份应该删除。设定每周清理一下备份文件，只保留最近7天的数据。可以根据文件的时间检索并删除。适用于系统管理中的数据备份文件和日志文件的管理。
二、SHELL脚本

find /var/web/apache/logs  -type f -ctime +7 -exec rm {} \;

这个脚本会将指定目录及其子目录的所有符合条件的文件删除，没有提示。
三、加入计划任务
将上述命令写入一shell脚本back.sh
赋予可执行权限chmod 755 back.sh
编辑计划任务：
#crontab -u user -e

0 2 * * 0 /home/back.sh

back.sh脚本会在每周日凌晨２点执行。
有关crontab的详细命令参见相关资料，有很多。
这里只简要说明下，计划任务前５位用数字表示依次是：
分：（０——５９）
小时：（１——２３）
日：（１——３１）
月：（１——１２）
星期：（０——６，０为星期日）
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/186/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache配置支持SHTML</title>
		<link>http://www.liyue.org/tech/archives/180</link>
		<comments>http://www.liyue.org/tech/archives/180#comments</comments>
		<pubDate>Sat, 24 Oct 2009 02:37:36 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[web优化]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=180</guid>
		<description><![CDATA[一、前言
CMS中模板用置标嵌套头尾模板的方法，方便快捷，但是存在弊端，当文档数据量庞大时，只要嵌套的头尾模板稍有改动，就得完全发布站点才能更新所有的文档模板。数据量有几十万条，这个就是噩梦。使用SSI技术，将头尾作为独立文件嵌入到页面中，只要更新发布头尾文件就可以了。
二、Apache配置
	Apache默认是不支持SSI的，更改httpd.conf来进行配置。
搜索“AddType text/html .shtml”，找到下面两行：

# AddType text/html .shtml
# AddOutputFilter INCLUDES .shtml

将这两行前面的#注释去掉。
搜索下面的默认页配置：

DirectoryIndex index.html index.htm

将index.shtml放到第一个位置

DirectoryIndex index.shtml index.html index.htm

接下来修改虚拟主机配置来支持shtml
例如下面的虚拟主机配置：

&#60;VirtualHost *:80&#62;
ServerAdmin webmaster@cas.cn
&#60;Directory &#34;/var/web/casweb/cas&#34;&#62;
Options -Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
&#60;/Directory&#62;
DocumentRoot /var/web/casweb/cas/
ServerName www.cas.cn
ErrorLog logs/www.cas.cn-error_log
TransferLog &#34;&#124;/usr/local/sbin/cronolog /usr/local/apache2/logs/www.cas.cn-%Y%m%d-access_log&#34;
&#60;/VirtualHost&#62;

蓝色的Includes是在原来的基础上增加的。
三、SSI页面调用方法
	用法：

&#60;!--#include virtual=&#34;index.shtml&#34; --&#62;

include路径不能跨域，只能使用相对路径。
	将上述代码插入到模板代码中，并将模板扩展名改为shtml
	链接的文件名可以使用置标来获取，但必须指定具体的文件名，如index.shtml
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/180/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PageNavi插件的应用</title>
		<link>http://www.liyue.org/tech/archives/178</link>
		<comments>http://www.liyue.org/tech/archives/178#comments</comments>
		<pubDate>Wed, 29 Apr 2009 03:29:48 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=178</guid>
		<description><![CDATA[　　wordpress的一些主题，对常用插件的支持不尽相同，当不支持你所希望的插件时，就需要手动添加对该插件的支持。以PageNavi插件为例，作为必装的插件，更好的实现文章列表的分页导航，取代系统默认的Previous Entries、Next Entries 。
　　安装并激活Wp-PageNavi插件。打开主题的index文件，找到例如下面的一段：系统默认的翻页代码：

        &#60;div class=&#34;alignleft&#34;&#62;
          &#60;?php next_posts_link&#40;'&#38;larr; Previous Entries'&#41; ?&#62;
        &#60;/div&#62;
        &#60;div class=&#34;alignright&#34;&#62;
          &#60;?php previous_posts_link&#40;'Next [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/178/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数据复活</title>
		<link>http://www.liyue.org/tech/archives/167</link>
		<comments>http://www.liyue.org/tech/archives/167#comments</comments>
		<pubDate>Fri, 10 Apr 2009 04:59:01 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=167</guid>
		<description><![CDATA[　　某个系统管理员一不小心直接用数据库管理工具把一文章表的标题字段类型改了，导致所有文章标题不能正常显示了。上万条的数据有点懵了。之前数据库也没有备份过。试图修复数据库也没有成功。唯一的希望寄托在数据库本身的结构上。
　　由于文章的部分信息在另外一个表中也有所体现，标题信息正在其中。只要将这部分信息重写回表中就可以恢复。两个表是通过ID相关联的。检索出文章对应的标题并写回原表。但是原表文章范围大于另一个表，只要少量信息不存在。能恢复大部分信息就好了。

&#60;?php
$DB_Server = &#34;localhost&#34;;
$DB_Username = &#34;root&#34;;
$DB_Password = &#34;password&#34;;
$DB_DBName = &#34;dbname&#34;;
//$DB_TBLName = &#34;column_article&#34;;
$Connect = @mysql_connect&#40;$DB_Server, $DB_Username, $DB_Password&#41;
or die&#40;&#34;Couldn't connect.&#34;&#41;;
$Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database.&#34;&#41;;
&#160;
$sql = &#34;Select column_article.title,column_article.articleid,article.title,article.id from column_article,article where column_article.articleid=article.id&#34;;
$ALT_Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database&#34;&#41;;
&#160;
$result = @mysql_query&#40;$sql,$Connect&#41;
or die&#40;mysql_error&#40;&#41;&#41;;
&#160;
$i = 0;
while&#40;$row = mysql_fetch_row&#40;$result&#41;&#41;
&#123;
$title2=$row&#91;0&#93;;
$title2id=$row&#91;1&#93;;
$upd = @mysql_query&#40;&#34;update article set article.title='$title2' where article.id=$title2id&#34;,$Connect&#41;;
$i++;
&#125;
return &#40;true&#41;;
?&#62;

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/167/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>umask来设定创建文件的默认权限</title>
		<link>http://www.liyue.org/tech/archives/164</link>
		<comments>http://www.liyue.org/tech/archives/164#comments</comments>
		<pubDate>Wed, 25 Feb 2009 03:25:28 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=164</guid>
		<description><![CDATA[　　linux下用户创建文件、文件夹都会有一个默认权限，系统默认文件夹权限是755，文件权限是644这个默认权限是可以设定的，就是通过umask，通过在shell下运行umask命令来看看当前的umask数值是多少，例如文件夹默认权限是755，他的umask数值为022。
　　这个数值表示的是什么意思，又如何来计算出想要的umask值。umask是在下面的配置文件中设定/etc/profile（全局设置），$ [HOME]/.bash_profile或者$ [HOME]/.profile（当前用户的设置，操作系统版本不同，文件名会不同）。在配置文件中加入一行umask 022即可。
　　umask值的计算方法，是通过权限的补码得来。例如文件夹权限755，文件夹的umask各位数值最大可以到7，各位数的补码就是022；而文件权限最大只能到6，因为系统不允许新建文件拥有执行权限。
　　umask值与文件、目录权限对照表：
umask　文件　目录
——————————
0 　　　6 　　　7
1 　　　6　　　 6
2 　　　4 　　　5
3　　　 4 　　　4
4　　　 2　　　 3
5 　　　2　　　 2
6 　　　0　　　 1
7 　　　0　　　 0
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/164/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>高性能Web Site与YSlow（2）-Make fewer HTTP requests</title>
		<link>http://www.liyue.org/tech/archives/155</link>
		<comments>http://www.liyue.org/tech/archives/155#comments</comments>
		<pubDate>Fri, 20 Feb 2009 08:20:45 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[web优化]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[yslow]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=155</guid>
		<description><![CDATA[　　在YSlow性能分析的第一条标准就是“Make fewer HTTP requests”。网站的响应时间大部分花费在前端，浏览器从服务器下载images、js 、flash等文件。在保持内容不变的情况下，首要做的就是减少浏览器请求文件的数量，网页中每个图标文件都需要发生一次请求。http协议是建立在请求/响应模式下的，浏览器发送请求信息（包括请求方法、URI、版本号等客户端信息）给服务器，服务器返回状态码，服务器信息、实体内容等。整个过程应该是首先浏览器和服务器先建立一个socket连接，然后客户端发送请求、服务器响应，关闭连接。默认情况是一个socket连接只能发生一次请求。那样的话，要打开一个网页，就可能重复上面的（连接、请求、响应、关闭连接）的过程N次，非常耗时。所以，在WEB服务器上可以进行配置可以使socket连接在一定时间内允许进行多个请求。例如，apache中的KeepAlive 设置为On时就可以。
 　　在这基础上，再减少资源的数目，方法是将资源合并。CSS文件尽量外连，并合并到一个.css文件中，不同的用途之间可以用注释分隔符隔开区分。js文件同样是，图片可以采用CSS Sprites方法将小图合并到一张大图中，利用css定位，根据需要显示大图中的部分图像。例如，下面的导航菜单，当鼠标移动到菜单项，会显示不同的颜色的图片，而当前页又会显示另外一个颜色的图片。传统做法是做三个不同状态的图片，配合js切换。
 　　按照CSS Sprites方法，三个状态图片合并到一张图： 常态下，只显示上面的图片，当鼠标hover的时候，样式如下

 li a:hover span &#123;background-position: 0 -26px; border-bottom-color: #5f5f5f;&#125;

图像的Y轴坐标上移26px（每个小图的高度正好是26px）,显示的是中间的图。当前页的时候，显示下面图：

 li.selected a:hover span &#123;background-position: bottom left;&#125;

　　图像的处理还有一种就是maps，在一张大图上，做热区连接，但是不推荐。
 　　本节只有CSS Sprites有些技术含量，其他的应该是工作习惯。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/155/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>高性能Web Site与YSlow（1）-Gzip</title>
		<link>http://www.liyue.org/tech/archives/114</link>
		<comments>http://www.liyue.org/tech/archives/114#comments</comments>
		<pubDate>Wed, 18 Feb 2009 09:13:54 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[web优化]]></category>
		<category><![CDATA[yslow]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=114</guid>
		<description><![CDATA[　　在FireFox下发现对网站性能评分的好工具YSlow，可以根据网站进行13类别性能评分，等级A-F，A最好，F最差。YSlow下载网址：http://developer.yahoo.com/yslow/，在download按钮下面有个提示：Install Firebug first!，需要先安装Firebug，http://getfirebug.com/，安装完成后，可以在FireFox的状态栏右边，看到YSlow图标，点击后就在浏览器的下半部出现分析窗口。点击上面的Performance，开始对当前网页进行性能分析，给出如下的13项得分：
　　下面是各项性能的评分：
　　项目后面有箭头的，可以点开看看他的建议。先看看第4. Gzip components，Gzip的作用是网页数据在传输给浏览器前，服务器端先压缩，这样可以大大减少网络带宽。Gzip的压缩比很高。在启用Gzip之前，先看看网站是否已经启用了gzip，在下面测试网站可以测试：http://www.whatsmyip.org/mod_gzip_test/

　　输入网址后，在下面会告诉你是否网站启用了Gzip，如果启用了，可以看到压缩前后的对比，压缩比高达79.59%。下面的一段是测试你的浏览器是否支持Gzip，现在几乎所有的浏览器都支持。如果没有启用，还需要看看服务器是否支持Gzip，可以在站点下建立php测试文件。phpinfo.php，文件内容为，在浏览器访问phpinfo.php，看看有没有Zlib这么一段有就支持。
　　然后就可以通过站点根目录下的.htaccess文件来启用Gzip。打开文件，加入下面一行

AddOutputFilter DEFLATE html xml php js css

　　保存就可以了。
有兴趣的可以看一下，YouTobe上的视频High Performance Web Sites and YSlow
：http://www.youtube.com/watch?v=BTHvs3V8DBA
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/114/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache日志的cronolog轮循</title>
		<link>http://www.liyue.org/tech/archives/102</link>
		<comments>http://www.liyue.org/tech/archives/102#comments</comments>
		<pubDate>Tue, 09 Dec 2008 15:08:27 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=102</guid>
		<description><![CDATA[　　将apache日志按年月日目录分类存放，便于日志分析系统分析。使用cronolog来完成，有windows和linux的版本。Linux安装，解压缩后执行
　　#./configure
　　#./make
　　#./make install
　　在httpd.conf配置使用cronolog，在每个虚拟主机中，加入
　　

CustomLog &#34;&#124;/usr/local/sbin/cronolog /var/logs/%Y/%m/%Y%m%d_access.log&#34; combined
　　ErrorLog &#34;&#124;/usr/local/sbin/cronolog /var/logs/%Y/%m/%Y%m%d_error.log&#34;

　　Windows下cronolog安装，解压缩后，将cronolog.exe文件放到apache安装目录的bin下。配置httpd.conf

TransferLog &#34;&#124;D:/Apache/bin/cronolog.exe D:/Apache/logs/%Y/%m/%d/access.log&#34;
	ErrorLog    &#34;&#124;D:/Apache/bin/cronolog.exe D:/Apache/logs/%Y/%m/%d/access.log&#34;

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/102/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>将mysql检索结果导出EXCEL表</title>
		<link>http://www.liyue.org/tech/archives/94</link>
		<comments>http://www.liyue.org/tech/archives/94#comments</comments>
		<pubDate>Fri, 05 Dec 2008 03:18:19 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=94</guid>
		<description><![CDATA[说明：数据表fawen是文件的标题，正文等信息，数据表pishi是各领导对文件的批示信息，pishi的articleid字段内容与fawen的id相关联。要统计出某位领导的所有批示，导出EXCEL，内容是：文件名称、批示内容、批示时间。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
&#60;?php
$DB_Server = &#34;localhost&#34;;
$DB_Username = &#34;root&#34;;
$DB_Password = &#34;pass&#34;;
$DB_DBName = &#34;office&#34;;
$DB_TBLName = &#34;fawen&#34;;
$Connect = @mysql_connect&#40;$DB_Server, $DB_Username, $DB_Password&#41;
or die&#40;&#34;Couldn't connect.&#34;&#41;;
$Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database.&#34;&#41;;
$file_type = &#34;vnd.ms-excel&#34;;
$file_ending = &#34;xls&#34;;
header&#40;&#34;Content-Type: application/$file_type&#34;&#41;;
header&#40;&#34;Content-Disposition: attachment; filename=mydowns.$file_ending&#34;&#41;;
header&#40;&#34;Pragma: no-cache&#34;&#41;;
header&#40;&#34;Expires: 0&#34;&#41;;
$now_date = date&#40;'Y-m-d H:i'&#41;;
$title = &#34;格式：第一列为文件名，第二列为领导批示内容，第三列为批示日期&#34;;
$sql = &#34;Select $DB_TBLName.title,pishi.content,pishi.time from $DB_TBLName,pishi where pishi.leadername='领导名称' and $DB_TBLName.id=pishi.articleid&#34;;
$ALT_Db = @mysql_select_db&#40;$DB_DBName, $Connect&#41;
or die&#40;&#34;Couldn't select database&#34;&#41;;
&#160;
&#160;
$result = @mysql_query&#40;$sql,$Connect&#41;
or die&#40;mysql_error&#40;&#41;&#41;;
&#160;
$result2 [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/94/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数组的应用</title>
		<link>http://www.liyue.org/tech/archives/85</link>
		<comments>http://www.liyue.org/tech/archives/85#comments</comments>
		<pubDate>Mon, 20 Oct 2008 08:44:40 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=85</guid>
		<description><![CDATA[　　对已知数目的查询条件，使用数组定义，然后遍历数组，使用while循环查询符合数组数值条件的记录，并统计。
　　片段：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
		//数组
		$workArray = array&#40;&#34;办公室&#34;, &#34;财务基建&#34;, &#34;人事处&#34;, &#34;老干部处&#34;, &#34;机关党委&#34;,&#34;纪检监察&#34;,&#34;综合处&#34;,&#34;核算处&#34;,&#34;政法处&#34;,&#34;工业处&#34;,&#34;能源处&#34;,&#34;农村处&#34;,&#34;国贸处&#34;,&#34;外经处&#34;,&#34;投资处&#34;,&#34;服务业处&#34;,&#34;人口处&#34;,&#34;社科处&#34;,&#34;普查中心&#34;,&#34;基普办&#34;,&#34;科研所&#34;,&#34;计算中心&#34;,&#34;教育中心&#34;,&#34;记者站&#34;,&#34;印刷厂&#34;&#41;; 
&#160;
			while  &#40;list&#40;$key,$value&#41; = each&#40;$workArray&#41;&#41;  &#123;
				$z--;
				$sql5=&#34;select count(id) as id from art where author='$value' and createdate&#62;='$starttime' and createdate &#60;='$endtime'&#34;;
				$r5= $DB_web-&#62;query_first&#40;$sql5&#41;;
&#160;
				print &#34;&#60;tr bgcolor='#DDDDDD'&#62;&#34;;
				print &#34;&#60;td height='20'&#62;&#38;nbsp;$value&#60;/td&#62;&#34;;
				print &#34;&#60;td height='20'&#62;&#38;nbsp;$r5[id]&#60;/td&#62;&#34;;
　　　　　　　　print &#34;&#60;/tr&#62;&#34;;
&#160;
			&#125;

]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/85/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP无组件上传文件问题</title>
		<link>http://www.liyue.org/tech/archives/82</link>
		<comments>http://www.liyue.org/tech/archives/82#comments</comments>
		<pubDate>Thu, 25 Sep 2008 02:36:53 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[asp]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=82</guid>
		<description><![CDATA[　　背景：在使用ASP的BLOG程序上传文件时候，报错，发现只能上传200K以下文件。运行环境是windows2003/IIS6，ASP程序是无组件上传模块。
　　错误信息：Request 对象 错误 &#8216;ASP 0104 : 80004005&#8242;
　　参考网址：微软知识库http://support.microsoft.com/kb/327659/
　　解决方法：修改默认允许的最大请求。首先停止IIS服务。打开 %systemroot%System32Inetsrv 中的 metabase.XML文件，查找AspMaxRequestEntityAllowed，修改默认的数值200K（204800），如50M为51200000。
　　建议：采用ASP上传组件替代无组件，并将上面数值还原。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/82/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache2.2.9/tomcat5.5.16整合</title>
		<link>http://www.liyue.org/tech/archives/62</link>
		<comments>http://www.liyue.org/tech/archives/62#comments</comments>
		<pubDate>Wed, 24 Sep 2008 04:06:13 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=62</guid>
		<description><![CDATA[　　1、Apache2.2.9的安装只用了一个配置命令：
　　　　./configure &#8211;prefix=/usr/local/apache &#8211;enable-rewrite=shared
　　2、Tomcat5.5.16二进制方式，解压。
　　3、安装jakarta-tomcat-connectors-jk2-src-current.tar.gz
　　　　下载地址：http://archive.apache.org/dist/jakarta/tomcat-connectors/jk2/source/
　　　　解压后，进入到jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2目录
　　　　执行./configure &#8211;with-apxs2=/usr/local/apache/bin/apxs
　　　　　　make
　　　　拷贝mod_jk2.so文件，到apache的modules目录。
　　　　cp jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache2/mod_jk2.so
　　　　　　/usr/local/apache/modules/
　　4、配置apache配置文件：
　　　　编辑httpd.conf
　　　　Listen 10.10.10.197:80下面添加一行，加载mod_jk2.so.
　　　　LoadModule jk2_module modules/mod_jk2.so
　　　　找到下面一行，并且去掉注释符号#，加载虚拟主机配置文件
　　　　Include conf/extra/httpd-vhosts.conf
　　5、配置虚拟主机：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
&#60;VirtualHost *&#62;
    ServerAdmin web@domain.com
    DocumentRoot &#34;/usr/local/tomcat/webapps&#34;
#需要转给tomcat处理的文件名，如*.jsp，这里是*.*所有文件处理转给tomcat 
    &#60;Location ~ &#34;/*.*&#34;&#62;
            JkUriSet worker ajp13:localhost:8009
        &#60;/Location&#62;
    ServerName search.domain.com
  [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/62/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LAMP的部署经历</title>
		<link>http://www.liyue.org/tech/archives/35</link>
		<comments>http://www.liyue.org/tech/archives/35#comments</comments>
		<pubDate>Sun, 10 Aug 2008 01:26:54 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[系统]]></category>
		<category><![CDATA[lamp]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=35</guid>
		<description><![CDATA[　　此次安装的版本比较低，适用于某个老系统的环境要求。费了一些周折，网络上提供的资料准确性有限，很杂乱。需要自己的实践和研究总结一些方法。
　　环境：Redhat AS5,Apache1.3.9,PHP4.1.2,Mysql4.1,ZendOptimizer-2.5.7
　　其他软件：zlib-1.2.3.tar.gz（后面会提及）
一、MySQL数据库
1、第一次用二进制方式安装，直接解压，初始化数据库出错，启动也失败过，后来采用源码安装包安装，避免麻烦。
源码安装：

1
2
3
4
5
6
7
8
9
10
11
12
groupadd mysql  /*创建mysql用户组*/
useradd -g mysql mysql /*创建用户*/
tar zxvf mysql-4.1.tar.gz    /*解压缩*/
cd mysql-4.1
./configure --prefix=/usr/local/mysql /*指定mysql安装路径*/
make /*时间会比较长*/
make install /*安装完毕*/
cp support-files/my-large.cnf /etc/my.cnf    /*复制配置文件改名为my.cnf，如果提示覆盖按Y确定*/
cd /usr/local/mysql
bin/mysql_install_db --user=mysql    /*必须以mysql用户初始化数据库*/
chown -R mysql:mysql /usr/local/mysql  /*更改mysql目录所有者权限，否则会导致启动失败*/
bin/mysqld_safe --user=mysql &#38;amp;    /*用mysql用户启动服务，只有不提示end，就成功了*/

2、修改mysql密码：
#mysqladmin -u root -p password &#8216;mypasswd&#8217;
输入这个命令后，需要输入root的原密码，然后root的密码将改为mypasswd。
mysql4以上版本会出现客户端连接不上的情况。需要再做如下操作更新：
#mysql -u root -p 　/*输入刚才更改的密码登陆*/
执行下面的语句：
set password for root@&#8221;localhost&#8221;=old_password(&#8216;mypasswd&#8216;);
3、更改mysql默认最大连接数
mysql默认最大连接数是100,在实际应用中，不够。
修改mysqld_safe（一种不需要编译mysql就可以实现的方法）
编辑mysqld_safe启动脚本，找到mysqld启动的那两行，在后面加上参数 ：
-O max_connections=1000
然后关闭mysql重启它，用
mysqladmin -uroot -p variables
输入root数据库账号的密码后可看到变量信息。
&#124; max_connections &#124; 1000 &#124;
即新改动已经生效。
二、安装apache
　　tar -zxvf apache_1.3.9.tar
　　cd apache_1.3.9
　　./configure &#8211;prefix=/usr/local/apache &#8211;enable-module=so  /*指定安装路径，激活动态模式,必需激活mod_so*/
　　make
　　make [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/35/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux系统的hosts.allow和hosts.deny</title>
		<link>http://www.liyue.org/tech/archives/33</link>
		<comments>http://www.liyue.org/tech/archives/33#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:25:26 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[安全]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=33</guid>
		<description><![CDATA[　　奥运了，各单位对信息安全特别重视，要求加强服务器安全，所有服务器统一修改密码，关闭WEB服务器除了80端口的所有端口，关闭远程控制SSH。统一使用单位的VPN服务来管理。关闭外部的所有链接，除了VPN服务器的，这样，就必须通过VPN来远程控制服务器，VPN只有管理员才有账户登录权限。
　　限制访问主机的服务。可以限制，只能是指定的IP才能访问本机的某个服务。
　　编辑/etc/hosts.allow
　　加入下面的一行，允许10.0.0.1通过ssh服务链接服务器：
　　sshd:10.0.0.1
　　编辑/etc/hosts.deny，加入：
　　ALL: ALL@ALL, PARANOID
　　拒绝其他所有的服务请求。
　　通过上述设置后，先通过登录VPN系统认证后，再使用SSH登录服务器就可以了。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/33/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>通过VNC安装Oracle</title>
		<link>http://www.liyue.org/tech/archives/31</link>
		<comments>http://www.liyue.org/tech/archives/31#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:18:05 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[vnc]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=31</guid>
		<description><![CDATA[运行vncserver，提示输入密码（远程登录密码），生成端口号：1。
打开防火墙，添加vnc端口。可以从netstat看出端口号。如5801
下载VNC客户端，登录窗口，服务器输入IP:1
输入密码。
或者通过浏览器访问：ip:5801
为ORACLE安装图像界面做准备，以ROOT运行xhost +　提示未授权。执行export DISPLAY=客户端IP:1.0
再次执行xhost +成功。在vnc窗口，以oracle用户执行./runInstaller ，成功出现中文图形安装界面。
]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/31/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux对Apache限制和小插曲</title>
		<link>http://www.liyue.org/tech/archives/29</link>
		<comments>http://www.liyue.org/tech/archives/29#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:16:51 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=29</guid>
		<description><![CDATA[
　　CentOS4.6自带APACHE不能更改默认根目录，虚拟主机指向其他目录不认。是SELinux激活的原因，关闭他：
# vi /etc/selinux/config
 # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing &#8211; SELinux security policy is enforced.
#       permissive &#8211; SELinux prints warnings instead of enforcing.
#       disabled &#8211; SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted &#8211; Only targeted network [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/29/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
