<?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>JayXie&#039;s blog &#187; Programming</title>
	<atom:link href="http://jayxie.com/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://jayxie.com</link>
	<description>Around emacs, linux, etc.</description>
	<lastBuildDate>Sat, 15 May 2010 13:37:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Maemo的开发门槛还是有点高</title>
		<link>http://jayxie.com/2010/05/15/maemo%e7%9a%84%e5%bc%80%e5%8f%91%e9%97%a8%e6%a7%9b%e8%bf%98%e6%98%af%e6%9c%89%e7%82%b9%e9%ab%98.html</link>
		<comments>http://jayxie.com/2010/05/15/maemo%e7%9a%84%e5%bc%80%e5%8f%91%e9%97%a8%e6%a7%9b%e8%bf%98%e6%98%af%e6%9c%89%e7%82%b9%e9%ab%98.html#comments</comments>
		<pubDate>Sat, 15 May 2010 13:36:41 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[MobileDev]]></category>

		<guid isPermaLink="false">http://jayxie.com/2010/05/15/maemo%e7%9a%84%e5%bc%80%e5%8f%91%e9%97%a8%e6%a7%9b%e8%bf%98%e6%98%af%e6%9c%89%e7%82%b9%e9%ab%98.html</guid>
		<description><![CDATA[
Maemo 5 的sdk是我目前装过的最费劲的一个手机开发sdk，先不说步骤要分好几步，单是去nokia网站上接受一个什么条款然后装上nokia-binaries这个我就一直到很后来很后来才发现不装跑不了能在Xephyr里显示的运行环境，不过话说虽然我装上了，但我现在还是没跑起来……
不过开始看Qt on maemo后，装了个madde + qt creator 2.0 beta，手机上装个mad-developer，wifi连接，好用多了。但缺点也有啊，就是比如QtMobility，想整到madde里就麻烦了些，我现在的做法是先在scratchbox里装上libqtm-dev，然后把一堆so和include拷到madde里，还没试验是否真的可用。
回过头来再看看android的界面开发，不管是gtk还是qt，不管是maemo还是symbian，不管在界面开发上还是整个程序的开发上都要更费事些，所以这门槛就高了许多，开发成本也就跟着上来了，开发人员们也就懒得为你折腾了。
那么放弃gtk放弃qt放弃html+css来一套全新的就像android那样做？这也不见得是件好事，因为你迫使大量有可能进入这个领域的开发人员放弃自己以前熟悉的来适应你来学习一套全新的开发方式。对于资深一些的开发人员来说，这是一个很不爽的事情。
想做平台，你就得伺候好两类人，一类是用户，他们需要漂亮的界面和好用的程序；一类是开发者，他们要简单和熟悉的开发方式和强大的创造空间。

]]></description>
			<content:encoded><![CDATA[<p>Maemo 5 的sdk是我目前装过的最费劲的一个手机开发sdk，先不说步骤要分好几步，单是去nokia网站上接受一个什么条款然后装上nokia-binaries这个我就一直到很后来很后来才发现不装跑不了能在Xephyr里显示的运行环境，不过话说虽然我装上了，但我现在还是没跑起来……</p>
<p>不过开始看Qt on maemo后，装了个madde + qt creator 2.0 beta，手机上装个mad-developer，wifi连接，好用多了。但缺点也有啊，就是比如QtMobility，想整到madde里就麻烦了些，我现在的做法是先在scratchbox里装上libqtm-dev，然后把一堆so和include拷到madde里，还没试验是否真的可用。</p>
<p>回过头来再看看android的界面开发，不管是gtk还是qt，不管是maemo还是symbian，不管在界面开发上还是整个程序的开发上都要更费事些，所以这门槛就高了许多，开发成本也就跟着上来了，开发人员们也就懒得为你折腾了。</p>
<p>那么放弃gtk放弃qt放弃html+css来一套全新的就像android那样做？这也不见得是件好事，因为你迫使大量有可能进入这个领域的开发人员放弃自己以前熟悉的来适应你来学习一套全新的开发方式。对于资深一些的开发人员来说，这是一个很不爽的事情。</p>
<p>想做平台，你就得伺候好两类人，一类是用户，他们需要漂亮的界面和好用的程序；一类是开发者，他们要简单和熟悉的开发方式和强大的创造空间。</p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2010/05/15/maemo%e7%9a%84%e5%bc%80%e5%8f%91%e9%97%a8%e6%a7%9b%e8%bf%98%e6%98%af%e6%9c%89%e7%82%b9%e9%ab%98.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>第一个maemo开发经历</title>
		<link>http://jayxie.com/2010/05/07/%e7%ac%ac%e4%b8%80%e4%b8%aamaemo%e5%bc%80%e5%8f%91%e7%bb%8f%e5%8e%86.html</link>
		<comments>http://jayxie.com/2010/05/07/%e7%ac%ac%e4%b8%80%e4%b8%aamaemo%e5%bc%80%e5%8f%91%e7%bb%8f%e5%8e%86.html#comments</comments>
		<pubDate>Fri, 07 May 2010 14:34:34 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[MobileDev]]></category>

		<guid isPermaLink="false">http://jayxie.com/2010/05/07/%e7%ac%ac%e4%b8%80%e4%b8%aamaemo%e5%bc%80%e5%8f%91%e7%bb%8f%e5%8e%86.html</guid>
		<description><![CDATA[
今天给erminig提了个patch 加了个定时同步功能 不得不说 小场景下python很好用 改界面都不用任何多余的操作 改完保存就能测试 也没装sdk 直接在手机上vi python做界面 c做service 似乎也是一种模式

]]></description>
			<content:encoded><![CDATA[<p>今天给erminig提了个patch 加了个定时同步功能 不得不说 小场景下python很好用 改界面都不用任何多余的操作 改完保存就能测试 也没装sdk 直接在手机上vi python做界面 c做service 似乎也是一种模式</p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2010/05/07/%e7%ac%ac%e4%b8%80%e4%b8%aamaemo%e5%bc%80%e5%8f%91%e7%bb%8f%e5%8e%86.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>列举网页提速的几个原则和方法</title>
		<link>http://jayxie.com/2010/04/14/%e5%88%97%e4%b8%be%e7%bd%91%e9%a1%b5%e6%8f%90%e9%80%9f%e7%9a%84%e5%87%a0%e4%b8%aa%e5%8e%9f%e5%88%99%e5%92%8c%e6%96%b9%e6%b3%95.html</link>
		<comments>http://jayxie.com/2010/04/14/%e5%88%97%e4%b8%be%e7%bd%91%e9%a1%b5%e6%8f%90%e9%80%9f%e7%9a%84%e5%87%a0%e4%b8%aa%e5%8e%9f%e5%88%99%e5%92%8c%e6%96%b9%e6%b3%95.html#comments</comments>
		<pubDate>Wed, 14 Apr 2010 15:15:55 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[WebTech]]></category>

		<guid isPermaLink="false">http://jayxie.com/?p=334</guid>
		<description><![CDATA[
这两天在帮ld的discuz站做优化，不得不说，discuz在这方面还很不够，列一些原则和方法出来，供参考
提速通常从两方面入手
传输提速

下载提速

减少建立链接的次数

keep-alive 旨在减少多次握手带来的开销 此外 404这样的错误会打断keep-alive 恐怕没多少人注意过这个问题吧

减少文件数 js,css的合并 多个图片合成一张 旨在减少http header

合理使用expire



减少数据量

gzip

混淆精减js 精减css html 要知道 一个两千行的html 光是把换行和每行头的缩进去掉就至少是两三k!



减少服务端处理时间

利用服务端缓存减少服务端io时间 比如squid memcachd





上传提速

把资源类文件放在cookie free的域名上，减少不必要的上行数据




显示提速

减少dom层次

减少页面中间的js


discuz现在最让我头疼的就是资源图片太过零碎和dom嵌套层次太深

]]></description>
			<content:encoded><![CDATA[<p>这两天在帮ld的discuz站做优化，不得不说，discuz在这方面还很不够，列一些原则和方法出来，供参考</p>
<p>提速通常从两方面入手</p>
<h1>传输提速</h1>
<ul>
<li>下载提速
<ul>
<li>减少建立链接的次数
<ul>
<li>keep-alive 旨在减少多次握手带来的开销 此外 404这样的错误会打断keep-alive 恐怕没多少人注意过这个问题吧
</li>
<li>减少文件数 js,css的合并 多个图片合成一张 旨在减少http header
</li>
<li>合理使用expire
</li>
</ul>
</li>
<li>减少数据量
<ul>
<li>gzip
</li>
<li>混淆精减js 精减css html 要知道 一个两千行的html 光是把换行和每行头的缩进去掉就至少是两三k!
</li>
</ul>
</li>
<li>减少服务端处理时间
<ul>
<li>利用服务端缓存减少服务端io时间 比如squid memcachd
</li>
</ul>
</li>
</ul>
</li>
<li>上传提速
<ul>
<li>把资源类文件放在cookie free的域名上，减少不必要的上行数据
</li>
</ul>
</li>
</ul>
<h1>显示提速</h1>
<ul>
<li>减少dom层次
</li>
<li>减少页面中间的js
</li>
</ul>
<p>discuz现在最让我头疼的就是资源图片太过零碎和dom嵌套层次太深</p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2010/04/14/%e5%88%97%e4%b8%be%e7%bd%91%e9%a1%b5%e6%8f%90%e9%80%9f%e7%9a%84%e5%87%a0%e4%b8%aa%e5%8e%9f%e5%88%99%e5%92%8c%e6%96%b9%e6%b3%95.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>转战移动互联网</title>
		<link>http://jayxie.com/2010/02/24/%e8%bd%ac%e6%88%98%e7%a7%bb%e5%8a%a8%e4%ba%92%e8%81%94%e7%bd%91.html</link>
		<comments>http://jayxie.com/2010/02/24/%e8%bd%ac%e6%88%98%e7%a7%bb%e5%8a%a8%e4%ba%92%e8%81%94%e7%bd%91.html#comments</comments>
		<pubDate>Wed, 24 Feb 2010 06:08:25 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://jayxie.com/?p=253</guid>
		<description><![CDATA[
随着android平台的成熟，智能手机混战再起。且不论3G的渗透速度，移动互联网的崛起是必然的趋势。趋势就不多废话了，总之，已经投身到手机和互联网应用的战场了，这里只单纯谈谈这段时间对几大移动平台的体会。

Symbian，老牌，市场占有率足够高足够傻瓜培养了足够的用户习惯，开发和GUI设计门槛相对而言有点高。

IPhone，这个系统没涉足没法评论，只单纯的从其一贯的作风来看，IPhone和Android/WM最终会和MacOS和Linux/Windows的关系靠近。

Android，火，真的很火，看各大手机厂商的动作就知道了，平台的理念有很多优秀之处

WM? 我宁愿忘记这个系统，UI比起上述几个系统来说要糟糕的多，开发平台多但多的不精，如果某种东西例如silverlight在WM上能够成熟到Dalvik在android上的程度的话。

MTK?BB? 等下，我才刚入门呢。



闲话搁下不提，最近在研究Android，写下对它的一些看法。
Android基于linux，这个没有意外，但是Android抛开了xwindow，也没有试图采用某种流行的GUI解决方案，而是把一个叫Dalvik的东西推上了舞台。
Dalvik是个虚拟机？没错，但它不仅仅是个虚拟机，Google在Dalvik里加入了手机需要的API，加入了进程管理，更关键的是，它把GUI彻底的做进了Dalvik。所以，完全可以这样认为，Android就两层：Linux，Dalvik。
那么，想做界面开发？不好意思，你只有JAVA可选。对广大的其他语言开发者来讲，这是个坏消息，但对Android来说，这却是个好消息。开发语言的单纯性会让基础平台的积累迅速且有效，开发将会更简单更快捷，同样，应用的丰富也会更迅速。
唔，如果Dalvik里的GUI接口是能够从C里调用的话，QT/GTK的移植应该并不是难事，届时，广大其他语言开发者就真的开心了。

]]></description>
			<content:encoded><![CDATA[<p>随着android平台的成熟，智能手机混战再起。且不论3G的渗透速度，移动互联网的崛起是必然的趋势。趋势就不多废话了，总之，已经投身到手机和互联网应用的战场了，这里只单纯谈谈这段时间对几大移动平台的体会。</p>
<ul>
<li>Symbian，老牌，市场占有率足够高足够傻瓜培养了足够的用户习惯，开发和GUI设计门槛相对而言有点高。
</li>
<li>IPhone，这个系统没涉足没法评论，只单纯的从其一贯的作风来看，IPhone和Android/WM最终会和MacOS和Linux/Windows的关系靠近。
</li>
<li>Android，火，真的很火，看各大手机厂商的动作就知道了，平台的理念有很多优秀之处
</li>
<li>WM? 我宁愿忘记这个系统，UI比起上述几个系统来说要糟糕的多，开发平台多但多的不精，如果某种东西例如silverlight在WM上能够成熟到Dalvik在android上的程度的话。
</li>
<li>MTK?BB? 等下，我才刚入门呢。
</li>
</ul>
<hr/>
<p>闲话搁下不提，最近在研究Android，写下对它的一些看法。</p>
<p>Android基于linux，这个没有意外，但是Android抛开了xwindow，也没有试图采用某种流行的GUI解决方案，而是把一个叫Dalvik的东西推上了舞台。</p>
<p>Dalvik是个虚拟机？没错，但它不仅仅是个虚拟机，Google在Dalvik里加入了手机需要的API，加入了进程管理，更关键的是，它把GUI彻底的做进了Dalvik。所以，完全可以这样认为，Android就两层：Linux，Dalvik。</p>
<p>那么，想做界面开发？不好意思，你只有JAVA可选。对广大的其他语言开发者来讲，这是个坏消息，但对Android来说，这却是个好消息。开发语言的单纯性会让基础平台的积累迅速且有效，开发将会更简单更快捷，同样，应用的丰富也会更迅速。</p>
<p>唔，如果Dalvik里的GUI接口是能够从C里调用的话，QT/GTK的移植应该并不是难事，届时，广大其他语言开发者就真的开心了。</p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2010/02/24/%e8%bd%ac%e6%88%98%e7%a7%bb%e5%8a%a8%e4%ba%92%e8%81%94%e7%bd%91.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用tcpreplay对网络程序进行压力测试</title>
		<link>http://jayxie.com/2008/10/16/use-tcpreplay-on-benchmarking.html</link>
		<comments>http://jayxie.com/2008/10/16/use-tcpreplay-on-benchmarking.html#comments</comments>
		<pubDate>Thu, 16 Oct 2008 08:52:54 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://jayxie.com/?p=161</guid>
		<description><![CDATA[
以前tcpdump用的比较多，主要用在诊断的时候。tcpreplay则是把tcpdump记录下来的包原样发回去
这样tcpreplay就可以用来以极快的速度复现记录下来的数据从而实现压力测试，好处在于数据比较真实

先是在实际环境中用tcpdump记录数据用于复现
例如记录发往某ip某端口的报文一百万个

tcpdump 'dst aa.aa.aa.aa and dst port xxx' -c 1000000 -w log.pcap

假设这些报文要在机器bb.bb.bb.bb上复现然后发给cc.cc.cc.cc，从bb.bb.bb.bb发往cc.cc.cc.cc的源mac地址为bb:bb:bb:bb:bb:bb 目的mac地址为cc:cc:cc:cc:cc:cc
首先tcpprep预处理下

tcpprep -p --pcap=log.pcap --cachefile=input.cache

先修改mac地址使之有效

tcprewrite --enet-dmac=&#34;cc:cc:cc:cc:cc:cc&#34; --enet-smac=&#34;bb:bb:bb:bb:bb:bb&#34; --infile=log.pcap --outfile=pcap.tmp

然后修改ip地址使之有效

tcprewrite --cachefile=input.cache --endpoints=&#34;cc.cc.cc.cc:bb.bb.bb.bb&#34; --infile=pcap.tmp --outfile=replay.pcap

然后就可以用来复现了 -l参数是说循环多少次 -p参数是说每秒发多少个包 -i是说从那个网卡发

tcpreplay -l 10 -p 1000 -i eth0 replay.pcap


]]></description>
			<content:encoded><![CDATA[<p>以前tcpdump用的比较多，主要用在诊断的时候。tcpreplay则是把tcpdump记录下来的包原样发回去</p>
<p>这样tcpreplay就可以用来以极快的速度复现记录下来的数据从而实现压力测试，好处在于数据比较真实<br />
<span id="more-161"></span><br />
先是在实际环境中用tcpdump记录数据用于复现<br />
例如记录发往某ip某端口的报文一百万个</p>
<pre class="brush: ruby;">
tcpdump 'dst aa.aa.aa.aa and dst port xxx' -c 1000000 -w log.pcap
</pre>
<p>假设这些报文要在机器bb.bb.bb.bb上复现然后发给cc.cc.cc.cc，从bb.bb.bb.bb发往cc.cc.cc.cc的源mac地址为bb:bb:bb:bb:bb:bb 目的mac地址为cc:cc:cc:cc:cc:cc</p>
<p>首先tcpprep预处理下</p>
<pre class="brush: ruby;">
tcpprep -p --pcap=log.pcap --cachefile=input.cache
</pre>
<p>先修改mac地址使之有效</p>
<pre class="brush: ruby;">
tcprewrite --enet-dmac=&quot;cc:cc:cc:cc:cc:cc&quot; --enet-smac=&quot;bb:bb:bb:bb:bb:bb&quot; --infile=log.pcap --outfile=pcap.tmp
</pre>
<p>然后修改ip地址使之有效</p>
<pre class="brush: ruby;">
tcprewrite --cachefile=input.cache --endpoints=&quot;cc.cc.cc.cc:bb.bb.bb.bb&quot; --infile=pcap.tmp --outfile=replay.pcap
</pre>
<p>然后就可以用来复现了 -l参数是说循环多少次 -p参数是说每秒发多少个包 -i是说从那个网卡发</p>
<pre class="brush: ruby;">
tcpreplay -l 10 -p 1000 -i eth0 replay.pcap
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2008/10/16/use-tcpreplay-on-benchmarking.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xinu, yslow</title>
		<link>http://jayxie.com/2007/07/26/xinu-yslow.html</link>
		<comments>http://jayxie.com/2007/07/26/xinu-yslow.html#comments</comments>
		<pubDate>Thu, 26 Jul 2007 14:20:15 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[WebTech]]></category>

		<guid isPermaLink="false">http://jayxie.com/2007/07/26/xinu-yslow.html</guid>
		<description><![CDATA[
曾经在哪看到的xinu忘了，今天找的时候开发者居然不提供服务了，不过提供了源码下载，所以在本站放了一个。链接是xinu，很不错的一个站点各项数据分析搜索引擎数据采集工具，唉，偶的网站数据小的可怜啊~~
xinu的源代码，php的
再来说说YSlow，分析你的网页为何加载的这么慢的一个工具，地址回头再给。
会针对你的网页比如css的放置，js的放置等等各项打分，给出改进速度的建议，不过我不明白为何不欢迎ETag……
附图：


]]></description>
			<content:encoded><![CDATA[<p>曾经在哪看到的xinu忘了，今天找的时候开发者居然不提供服务了，不过提供了源码下载，所以在本站放了一个。链接是<a href="http://jayxie.com/xinu/index.php?lang=uk">xinu</a>，很不错的一个站点各项数据分析搜索引擎数据采集工具，唉，偶的网站数据小的可怜啊~~<br />
<a href="http://jayxie.com/wp-content/uploads/2007/07/xinu.zip">xinu的源代码，php的</a></p>
<p>再来说说YSlow，分析你的网页为何加载的这么慢的一个工具，地址回头再给。<br />
会针对你的网页比如css的放置，js的放置等等各项打分，给出改进速度的建议，不过我不明白为何不欢迎ETag……</p>
<p>附图：<br />
<a class="imagelink" title="xinu偶的数据" href="http://jayxie.com/wp-content/uploads/2007/07/jayxie_xinu.png"><img id="image115" height="96" alt="xinu偶的数据" src="http://jayxie.com/wp-content/uploads/2007/07/jayxie_xinu.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2007/07/26/xinu-yslow.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用CPP做apache的module</title>
		<link>http://jayxie.com/2006/07/15/%e7%94%a8cpp%e5%81%9aapache%e7%9a%84module.html</link>
		<comments>http://jayxie.com/2006/07/15/%e7%94%a8cpp%e5%81%9aapache%e7%9a%84module.html#comments</comments>
		<pubDate>Sat, 15 Jul 2006 07:31:00 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.jayxie.com/2006/07/15/%e7%94%a8cpp%e5%81%9aapache%e7%9a%84module</guid>
		<description><![CDATA[
有三个地方要改

首先注释掉include/ap_config_auto.h里面的

define AP_HAVE_DESIGNATED_INITIALIZER 1


然后在ap_config.h里面增加这几行

if (defined(__GNUC__) &#038;&#038; !defined(__cplusplus))                   \


&#124;&#124; (defined(__STDC_VERSION) &#038;&#038; __STDC_VERSION__ &#62; 199901L)

define AP_HAVE_DESIGNATED_INITIALIZER 1

endif


再到http_config.h里面修改
typedef const char *(*cmd_func) ();
为

if (defined(__GNUC__) &#038;&#038; !defined(__cplusplus))                \


&#124;&#124; (defined(__STDC_VERSION) &#038;&#038; __STDC_VERSION__ &#62; 199901L)
typedef const char *(*cmd_func) ();

else


typedef const char *(*cmd_func) (cmd_parms*, void*, const char*);

endif





]]></description>
			<content:encoded><![CDATA[<p>有三个地方要改</p>
<ol>
<li>首先注释掉include/ap_config_auto.h里面的
<ol>
<li>define AP_HAVE_DESIGNATED_INITIALIZER 1</li>
</li>
</ol>
<li>然后在ap_config.h里面增加这几行
<ol>
<li>if (defined(__GNUC__) &#038;&#038; !defined(__cplusplus))                   \
</li>
</ol>
<p>|| (defined(__STDC_VERSION) &#038;&#038; __STDC_VERSION__ &gt; 199901L)</p>
<ol>
<li>define AP_HAVE_DESIGNATED_INITIALIZER 1
</li>
<li>endif</li>
</li>
</ol>
<li>再到http_config.h里面修改<br />
typedef const char *(*cmd_func) ();<br />
为</p>
<ol>
<li>if (defined(__GNUC__) &#038;&#038; !defined(__cplusplus))                \
</li>
</ol>
<p>|| (defined(__STDC_VERSION) &#038;&#038; __STDC_VERSION__ &gt; 199901L)<br />
typedef const char *(*cmd_func) ();</p>
<ol>
<li>else
</li>
</ol>
<p>typedef const char *(*cmd_func) (cmd_parms*, void*, const char*);</p>
<ol>
<li>endif</li>
</li>
</ol>
</ol>
<p><img src="http://blog.csdn.net/Xeroo/aggbug/925512.aspx" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2006/07/15/%e7%94%a8cpp%e5%81%9aapache%e7%9a%84module.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>apache module中取post数据</title>
		<link>http://jayxie.com/2006/04/30/apache-module%e4%b8%ad%e5%8f%96post%e6%95%b0%e6%8d%ae.html</link>
		<comments>http://jayxie.com/2006/04/30/apache-module%e4%b8%ad%e5%8f%96post%e6%95%b0%e6%8d%ae.html#comments</comments>
		<pubDate>Sun, 30 Apr 2006 07:37:00 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.jayxie.com/2006/04/30/apache-module%e4%b8%ad%e5%8f%96post%e6%95%b0%e6%8d%ae</guid>
		<description><![CDATA[
一共使用三个函数

ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)
Apache里面说Setup the client to allow Apache to read the request body. 差不多意思就是初始化，第二个参数可以取以下三个值。

REQUEST_NO_BODY
意为如果request必须没有body，如果有就发一个413错误
REQUEST_CHUNKED_ERROR
意为request必须不可为chunked，如果有就发一个411错误
REQUEST_CHUNKED_DECHUNK
意思为如果chunked了，则dechunk。

对于我们要读取post的数据，只能取后面两个，而chunked则是对长连接的选项了，使用哪个视情况而定。
ap_should_client_block(r)
检查是否有数据，对于chunked的话会发送一个100 continue的命令让客户端继续发送数据。
ap_get_client_block(r, pBuff, size)
读取数据



]]></description>
			<content:encoded><![CDATA[<p>一共使用三个函数</p>
<ol>
<li>ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)<br />
Apache里面说Setup the client to allow Apache to read the request body. 差不多意思就是初始化，第二个参数可以取以下三个值。</p>
<ol>
<li>REQUEST_NO_BODY<br />
意为如果request必须没有body，如果有就发一个413错误</li>
<li>REQUEST_CHUNKED_ERROR<br />
意为request必须不可为chunked，如果有就发一个411错误</li>
<li>REQUEST_CHUNKED_DECHUNK<br />
意思为如果chunked了，则dechunk。</li>
</ol>
<p>对于我们要读取post的数据，只能取后面两个，而chunked则是对长连接的选项了，使用哪个视情况而定。</li>
<li>ap_should_client_block(r)<br />
检查是否有数据，对于chunked的话会发送一个100 continue的命令让客户端继续发送数据。</li>
<li>ap_get_client_block(r, pBuff, size)<br />
读取数据</li>
</ol>
<p><img src="http://blog.csdn.net/Xeroo/aggbug/698675.aspx" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2006/04/30/apache-module%e4%b8%ad%e5%8f%96post%e6%95%b0%e6%8d%ae.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache及其module的调试</title>
		<link>http://jayxie.com/2006/04/30/apache%e5%8f%8a%e5%85%b6module%e7%9a%84%e8%b0%83%e8%af%95.html</link>
		<comments>http://jayxie.com/2006/04/30/apache%e5%8f%8a%e5%85%b6module%e7%9a%84%e8%b0%83%e8%af%95.html#comments</comments>
		<pubDate>Sun, 30 Apr 2006 07:03:00 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.jayxie.com/2006/04/30/apache%e5%8f%8a%e5%85%b6module%e7%9a%84%e8%b0%83%e8%af%95</guid>
		<description><![CDATA[

gdb httpd
用gdb加载httpd进程
(gdb) b break-point
设置断点，可以设置函数名、行数等……
(gdb) run -X -d /usr/local/apache
执行httpd，这个是关键的，-X参数会让httpd以debug模式运行，debug模式是单进程的，这样才好调试。-d /usr/local/apache是设置运行的目录。

另外，gdb httpd pid可以attach一个正在运行的httpd来调试。


]]></description>
			<content:encoded><![CDATA[<ol>
<li>gdb httpd<br />
用gdb加载httpd进程</li>
<li>(gdb) b break-point<br />
设置断点，可以设置函数名、行数等……</li>
<li>(gdb) run -X -d /usr/local/apache<br />
执行httpd，这个是关键的，-X参数会让httpd以debug模式运行，debug模式是单进程的，这样才好调试。-d /usr/local/apache是设置运行的目录。</li>
</ol>
<p>另外，gdb httpd pid可以attach一个正在运行的httpd来调试。</p>
<p><img src="http://blog.csdn.net/Xeroo/aggbug/698592.aspx" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2006/04/30/apache%e5%8f%8a%e5%85%b6module%e7%9a%84%e8%b0%83%e8%af%95.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About module struct in Apache</title>
		<link>http://jayxie.com/2006/04/04/about-module-struct-in-apache.html</link>
		<comments>http://jayxie.com/2006/04/04/about-module-struct-in-apache.html#comments</comments>
		<pubDate>Tue, 04 Apr 2006 07:56:00 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.jayxie.com/2006/04/04/about-module-struct-in-apache</guid>
		<description><![CDATA[
在写apache模块的时候，会用到module这个结构体。module这个结构体实际上是module_struct，后面附上了定义。使用的时候通常都是定义一个这个结构体的变量并赋初值，如：
module AP_MODULE_DECLARE_DATA proxy_module =
{
STANDARD20_MODULE_STUFF,
create_proxy_dir_config,    /* create per-directory config structure */
merge_proxy_dir_config,     /* merge per-directory config structures */
create_proxy_config,        /* create per-server config structure */
merge_proxy_config,         /* merge per-server config structures */
proxy_cmds,                 /* command table */
register_hooks
};
其中STANDARD20_MODULE_STUFF这个宏为module_struct中的API version, minor version, module index, name, danamic load handle, next, magic, rewrite_args赋了初值。随后是per-directory configuration structure的初始化、合并函数和per-server configuration structure的初始化、合并函数。command table是command_rec结构的一个数组，依然是宏展开，描述这个模块在配置文件里面的信息。最后的register_hooks指向用于注册hook的函数。
typedef struct module_struct module;
/**

 Module structures.  Just about everything is dispatched through

 these, directly or indirectly (through the command and handler

 tables).

/



struct module_struct {
/** API version, *not* module version; check that module is

 compatible with this version of the server.

/



int version;
/** API minor version. Provides API feature milestones. Not checked

  during module init */



int minor_version;
/** Index to this modules structures in config vectors.  */
int module_index;
/** The name of the module's C file */
const char *name;
/** The handle for the DSO.  Internal use only */
void *dynamic_load_handle;
/** A pointer to the next module in the list

  @defvar module_struct *next */



struct module_struct *next;
/** Magic Cookie to identify a module structure;  It's mainly

  important for the DSO facility (see also mod_so).  */



unsigned long magic;
/** Function to allow MPMs to re-write command line arguments.  This

  hook is only available to MPMs.

  @param The process that the server is running in.

/



void (*rewrite_args) (process_rec *process);
/** Function to allow all modules to create per directory configuration

  structures.

  @param p The pool to use for all allocations.

  @param dir The directory currently being processed.

  @return The per-directory structure created

/



void *(*create_dir_config) (apr_pool_t *p, char *dir);
/** Function to allow all modules to merge the per directory configuration

  structures for two directories.

  @param p The pool to use for all allocations.

  @param base_conf The directory structure created for the parent directory.

  @param new_conf The directory structure currently being processed.

  @return The new per-directory structure created

/



void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
/** Function to allow all modules to create per server configuration

  structures.

  @param p The pool to use for all allocations.

  @param s The server currently being processed.

  @return The per-server structure created

/



void *(*create_server_config) (apr_pool_t *p, server_rec *s);
/** Function to allow all modules to merge the per server configuration

  structures for two servers.

  @param p The pool to use for all allocations.

  @param base_conf The directory structure created for the parent directory.

  @param new_conf The directory structure currently being processed.

  @return The new per-directory structure created

/



void *(*merge_server_config) (apr_pool_t *p, void *base_conf,                                   void *new_conf);
/** A command_rec table that describes all of the directives this module

 defines. */



const command_rec *cmds;
/** A hook to allow modules to hook other points in the request processing.

  In this function, modules should call the ap_hook_*() functions to

  register an interest in a specific step in processing the current

  request.

  @param p the pool to use for all allocations

/



void (*register_hooks) (apr_pool_t *p);
};

]]></description>
			<content:encoded><![CDATA[<p>在写apache模块的时候，会用到module这个结构体。module这个结构体实际上是module_struct，后面附上了定义。使用的时候通常都是定义一个这个结构体的变量并赋初值，如：</p>
<pre style="font-family: 宋体,simsun,SimSun,Simsun; font-size: 9pt">module AP_MODULE_DECLARE_DATA proxy_module =
{
STANDARD20_MODULE_STUFF,
create_proxy_dir_config,    /* create per-directory config structure */
merge_proxy_dir_config,     /* merge per-directory config structures */
create_proxy_config,        /* create per-server config structure */
merge_proxy_config,         /* merge per-server config structures */
proxy_cmds,                 /* command table */
register_hooks
};</pre>
<p>其中STANDARD20_MODULE_STUFF这个宏为module_struct中的API version, minor version, module index, name, danamic load handle, next, magic, rewrite_args赋了初值。随后是per-directory configuration structure的初始化、合并函数和per-server configuration structure的初始化、合并函数。command table是command_rec结构的一个数组，依然是宏展开，描述这个模块在配置文件里面的信息。最后的register_hooks指向用于注册hook的函数。</p>
<pre style="font-family: 宋体,simsun,SimSun,Simsun; font-size: 9pt">typedef struct module_struct module;
/**
<ul>
<li> Module structures.  Just about everything is dispatched through
</li>
<li> these, directly or indirectly (through the command and handler
</li>
<li> tables).
</li>
<li>/
</li>
</ul>

struct module_struct {
/** API version, *not* module version; check that module is
<ul>
<li> compatible with this version of the server.
</li>
<li>/
</li>
</ul>

int version;
/** API minor version. Provides API feature milestones. Not checked
<ul>
<li>  during module init */
</li>
</ul>

int minor_version;
/** Index to this modules structures in config vectors.  */
int module_index;
/** The name of the module's C file */
const char *name;
/** The handle for the DSO.  Internal use only */
void *dynamic_load_handle;
/** A pointer to the next module in the list
<ul>
<li>  @defvar module_struct *next */
</li>
</ul>

struct module_struct *next;
/** Magic Cookie to identify a module structure;  It's mainly
<ul>
<li>  important for the DSO facility (see also mod_so).  */
</li>
</ul>

unsigned long magic;
/** Function to allow MPMs to re-write command line arguments.  This
<ul>
<li>  hook is only available to MPMs.
</li>
<li>  @param The process that the server is running in.
</li>
<li>/
</li>
</ul>

void (*rewrite_args) (process_rec *process);
/** Function to allow all modules to create per directory configuration
<ul>
<li>  structures.
</li>
<li>  @param p The pool to use for all allocations.
</li>
<li>  @param dir The directory currently being processed.
</li>
<li>  @return The per-directory structure created
</li>
<li>/
</li>
</ul>

void *(*create_dir_config) (apr_pool_t *p, char *dir);
/** Function to allow all modules to merge the per directory configuration
<ul>
<li>  structures for two directories.
</li>
<li>  @param p The pool to use for all allocations.
</li>
<li>  @param base_conf The directory structure created for the parent directory.
</li>
<li>  @param new_conf The directory structure currently being processed.
</li>
<li>  @return The new per-directory structure created
</li>
<li>/
</li>
</ul>

void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
/** Function to allow all modules to create per server configuration
<ul>
<li>  structures.
</li>
<li>  @param p The pool to use for all allocations.
</li>
<li>  @param s The server currently being processed.
</li>
<li>  @return The per-server structure created
</li>
<li>/
</li>
</ul>

void *(*create_server_config) (apr_pool_t *p, server_rec *s);
/** Function to allow all modules to merge the per server configuration
<ul>
<li>  structures for two servers.
</li>
<li>  @param p The pool to use for all allocations.
</li>
<li>  @param base_conf The directory structure created for the parent directory.
</li>
<li>  @param new_conf The directory structure currently being processed.
</li>
<li>  @return The new per-directory structure created
</li>
<li>/
</li>
</ul>

void *(*merge_server_config) (apr_pool_t *p, void *base_conf,                                   void *new_conf);
/** A command_rec table that describes all of the directives this module
<ul>
<li> defines. */
</li>
</ul>

const command_rec *cmds;
/** A hook to allow modules to hook other points in the request processing.
<ul>
<li>  In this function, modules should call the ap_hook_*() functions to
</li>
<li>  register an interest in a specific step in processing the current
</li>
<li>  request.
</li>
<li>  @param p the pool to use for all allocations
</li>
<li>/
</li>
</ul>

void (*register_hooks) (apr_pool_t *p);
};</pre>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2006/04/04/about-module-struct-in-apache.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache中的挂钩剖析</title>
		<link>http://jayxie.com/2006/04/04/apache%e4%b8%ad%e7%9a%84%e6%8c%82%e9%92%a9%e5%89%96%e6%9e%90.html</link>
		<comments>http://jayxie.com/2006/04/04/apache%e4%b8%ad%e7%9a%84%e6%8c%82%e9%92%a9%e5%89%96%e6%9e%90.html#comments</comments>
		<pubDate>Tue, 04 Apr 2006 05:56:00 +0000</pubDate>
		<dc:creator>Jay Xie</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.jayxie.com/2006/04/04/apache%e4%b8%ad%e7%9a%84%e6%8c%82%e9%92%a9%e5%89%96%e6%9e%90</guid>
		<description><![CDATA[
From <a href="http://fanqiang.chinaunix.net/app/web/2006-02-21/4009.shtml">http://fanqiang.chinaunix.net/app/web/2006-02-21/4009.shtml</a>，作者：张中庆。

]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://fanqiang.chinaunix.net/app/web/2006-02-21/4009.shtml">http://fanqiang.chinaunix.net/app/web/2006-02-21/4009.shtml</a>，作者：张中庆。<img src="http://blog.csdn.net/Xeroo/aggbug/650220.aspx" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jayxie.com/2006/04/04/apache%e4%b8%ad%e7%9a%84%e6%8c%82%e9%92%a9%e5%89%96%e6%9e%90.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
