<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>土贼的奇异生活</title>
	
	<link>http://tuzei.net</link>
	<description>Talk is cheap. Show me the code.</description>
	<lastBuildDate>Wed, 16 May 2012 11:54:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/tuzei" /><feedburner:info uri="tuzei" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Install tokyo cabinet and python tc egg step by step</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/13g22-7nKiE/</link>
		<comments>http://tuzei.net/2012/05/16/install-tokyo-cabinet-and-python-tc-egg-step-by-step/#comments</comments>
		<pubDate>Wed, 16 May 2012 11:52:55 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[技术 | 工作]]></category>
		<category><![CDATA[tokyo cabinet]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=772</guid>
		<description><![CDATA[1: wget 下载tokyo cabinet 2: 编译, 安装 ./configure; make &#38;&#38; make install 注： 若提示-&#62;configure:error: zlib.h is required, 安装zlib1g-dev libssl-dev 若提示-&#62;configure:error: bzlib.h is required, 安装libbz2-dev 3：安装python的egg包: 1. git clone git://github.com/rsms/tc.git 2. python setup.py install 注： 若提示-&#62;fatal error: Python.h: No such file or directory, 安装python2.6-dev 另：查看缺文件所属包使用apt-file工具(apt-file update &#38;&#38; apt-file search xxx) // 环境 ubuntu 10.04 &#38;&#38; kernel [...]]]></description>
			<content:encoded><![CDATA[<p>1: wget 下载<a href="http://fallabs.com/tokyocabinet/tokyocabinet-1.4.47.tar.gz ">tokyo cabinet</a><br />
2: 编译, 安装</p>
<blockquote><p><strong> ./configure; make &amp;&amp; make install</strong></p>
<blockquote><p>注：</p>
<p>若提示-&gt;configure:error: <strong>zlib.h</strong> is required, 安装<strong>zlib1g-dev libssl-dev</strong><br />
若提示-&gt;configure:error: <strong>bzlib.h</strong> is required, 安装<strong>libbz2-dev</strong></p></blockquote>
</blockquote>
<p>3：安装python的egg包:</p>
<blockquote><p>1.<strong> git clone git://github.com/rsms/tc.git</strong><br />
2. <strong>python setup.py install</strong></p>
<blockquote><p>注：</p>
<p>若提示-&gt;fatal error: <strong>Python.h</strong>: No such file or directory, 安装<strong>python2.6-dev</strong></p>
<p>另：查看缺文件所属包使用apt-file工具(apt-file update &amp;&amp; apt-file search xxx)</p></blockquote>
</blockquote>
<p>// 环境 ubuntu 10.04 &amp;&amp; kernel 2.6.32-38-generic</p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2012/05/16/install-tokyo-cabinet-and-python-tc-egg-step-by-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tuzei.net/2012/05/16/install-tokyo-cabinet-and-python-tc-egg-step-by-step/</feedburner:origLink></item>
		<item>
		<title>设备名与文件系统结构的关系</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/lNMp1qmrA6E/</link>
		<comments>http://tuzei.net/2012/03/07/ddandfs/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 17:00:36 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[技术 | 工作]]></category>
		<category><![CDATA[Device driver]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=749</guid>
		<description><![CDATA[前段时间看字符设备驱动的时候，遇到了一些问题。在我们完成驱动模块开发后，将模块加入内核后，会对文件系统产生什么影响，也就是说会在哪里添加一些文件或者链接。后来查资料，做了记录。 一：主要进行的操作有: 1. 注册设备； 2. 加载模块； 3. 创建设备节点 4. 删除模块 二：主要影响的目录有以下四个: 1. /proc/devices； 2. /proc/modules； 3. /sys/modules； 4. /dev/ 三：详细说明 1./proc/devices:注册设备列表. 注册设备（register_chrdev_region,allow_chrdev_region）后在此添加一行，包含两列(主设备号，设备名称)。其中的模块名称就是在调用注册函数时，形参中的设备名。 2. /proc/modules:模块加载列表. insmod（加载模块）后在此添加一行。包含列(模块名称，模块大小(bytes)，加载数目，模块加载状态，内存偏移(用于debug))。其中模块名就是调用insmod时所使用参数中的设备名，即xx.ko中的xx。 3. /sys/module:添加一个目录. insmod（加载模块）后在此添加一子目录，同2. 4. /dev/*:设备节点. mknod（创建设备节点）后在此添加一设备文件。名称为mknod的参数名。 四：删除模块 使用rmmod xxx或modprobe -r xxx。删除模块后，/proc/devices, /proc/modules, /sys/module 中的记录都会被清除。 五：总结 为了避免混淆设备和模块名称，尽量在注册函数，插入模块，创建设备文件节点时使用同样的名称。 参考文档：Top-level Files within the proc File System]]></description>
			<content:encoded><![CDATA[<p>前段时间看字符设备驱动的时候，遇到了一些问题。在我们完成驱动模块开发后，将模块加入内核后，会对文件系统产生什么影响，也就是说会在哪里添加一些文件或者链接。后来查资料，做了记录。</p>
<p>一：主要进行的操作有: </p>
<blockquote><p>
1. 注册设备；<br />
2. 加载模块；<br />
3. 创建设备节点<br />
4. 删除模块
</p></blockquote>
<p>二：主要影响的目录有以下四个: </p>
<blockquote><p>
1. /proc/devices；<br />
2. /proc/modules；<br />
3. /sys/modules；<br />
4. /dev/ </p></blockquote>
<p>三：详细说明</p>
<blockquote><p>1.<strong>/proc/devices</strong>:注册设备列表.</p>
<blockquote><p>注册设备（register_chrdev_region,allow_chrdev_region）后在此添加一行，包含两列(主设备号，设备名称)。其中的模块名称就是在调用注册函数时，形参中的设备名。</p></blockquote>
<p><span id="more-749"></span></p>
<p>2. <strong>/proc/modules</strong>:模块加载列表.</p>
<blockquote><p>insmod（加载模块）后在此添加一行。包含列(模块名称，模块大小(bytes)，加载数目，模块加载状态，内存偏移(用于debug))。其中模块名就是调用insmod时所使用参数中的设备名，即xx.ko中的xx。<br />
<img src="http://farm8.staticflickr.com/7176/6959302677_3501d00ab6.jpg" alt="proc/modules" />
</p></blockquote>
<p>3. <strong>/sys/module</strong>:添加一个目录.</p>
<blockquote><p>insmod（加载模块）后在此添加一子目录，同2.</p></blockquote>
<p>4. <strong>/dev/*</strong>:设备节点.</p>
<blockquote><p>mknod（创建设备节点）后在此添加一设备文件。名称为mknod的参数名。</p></blockquote>
</blockquote>
<p>四：删除模块</p>
<blockquote><p>使用rmmod xxx或modprobe -r xxx。删除模块后，/proc/devices, /proc/modules, /sys/module 中的记录都会被清除。</p></blockquote>
<p>五：总结</p>
<blockquote><p>为了避免混淆设备和模块名称，尽量在注册函数，插入模块，创建设备文件节点时使用同样的名称。</p></blockquote>
<p>参考文档：<a href="http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-proc-topfiles.html">Top-level Files within the proc File System</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2012/03/07/ddandfs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://tuzei.net/2012/03/07/ddandfs/</feedburner:origLink></item>
		<item>
		<title>Linux 的 I2C 总线驱动模型</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/knkkkBZ7oXQ/</link>
		<comments>http://tuzei.net/2011/12/29/linux-%e7%9a%84-i2c-%e6%80%bb%e7%ba%bf%e9%a9%b1%e5%8a%a8%e6%a8%a1%e5%9e%8b/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 13:27:15 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[网摘 | 转载]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=742</guid>
		<description><![CDATA[Linux 的I2C 总线驱动架构 Bus Driver vs. Device Driver Linux 中I2C 驱动分为两个部分，总线（BUS）和设备（DEVICE）。我把他们分别比喻为铁路和列车，相当的贴切啊！ 1. 总线驱动 总线驱动是为系统中每个I2C 总线增加相应的读写方法，也包括I2C总线控制器的初始化等，但是总线驱动只提供读写函数，本身不会进行任何的通讯，因为它并不知道设备是否真正存在。这样设计也是为了减小SOC芯片驱动和外围设备驱动的耦合性。 1.2. 设备驱动 设备驱动则是与挂在I2C 总线上的具体的设备通讯的驱动。通过I2C总线驱动提供的函数，不同SOC的I2C总线控制器的差异对设备驱动透明。 在系统开机时，首先装载的是I2C总线驱动。一个总线驱动用于支持一条特定的I2C总线的读写。一个总线驱动通常需要两个模块，一个struct i2c_adapter 和一个struct i2c_algorithm 来描述。 via]]></description>
			<content:encoded><![CDATA[<p><strong>Linux 的I2C 总线驱动架构</strong><br />
Bus Driver vs. Device Driver<br />
Linux 中I2C 驱动分为两个部分，总线（BUS）和设备（DEVICE）。我把他们分别比喻为铁路和列车，相当的贴切啊！<br />
1. 总线驱动</p>
<blockquote><p>总线驱动是为系统中每个I2C 总线增加相应的读写方法，也包括I2C总线控制器的初始化等，但是总线驱动只提供读写函数，本身不会进行任何的通讯，因为它并不知道设备是否真正存在。这样设计也是为了减小SOC芯片驱动和外围设备驱动的耦合性。</p></blockquote>
<p>1.2. 设备驱动</p>
<blockquote><p>设备驱动则是与挂在I2C 总线上的具体的设备通讯的驱动。通过I2C总线驱动提供的函数，不同SOC的I2C总线控制器的差异对设备驱动透明。</p></blockquote>
<p>在系统开机时，首先装载的是I2C总线驱动。一个总线驱动用于支持一条特定的I2C总线的读写。一个总线驱动通常需要两个模块，一个struct i2c_adapter 和一个struct i2c_algorithm 来描述。<br />
<a href="http://www.embexperts.com/viewthread.php?tid=68">via</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/12/29/linux-%e7%9a%84-i2c-%e6%80%bb%e7%ba%bf%e9%a9%b1%e5%8a%a8%e6%a8%a1%e5%9e%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/12/29/linux-%e7%9a%84-i2c-%e6%80%bb%e7%ba%bf%e9%a9%b1%e5%8a%a8%e6%a8%a1%e5%9e%8b/</feedburner:origLink></item>
		<item>
		<title>Compiling directly into a kernel vs. modules</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/cZJXfsAgoKk/</link>
		<comments>http://tuzei.net/2011/12/10/compiling-directly-into-a-kernel-vs-modules/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 15:57:27 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[网摘 | 转载]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=740</guid>
		<description><![CDATA[You have two options for adding functionality to the kernel: building functions into the kernel (making a monolithic kernel) or adding them as modules. Monolithic kernels: Building a function into the kernel directly ensures that that function will be available at all times. The downside is that it makes your kernel bigger, increasing boot time, [...]]]></description>
			<content:encoded><![CDATA[<p>You have two options for adding functionality to the kernel: building functions into the kernel (making a monolithic kernel) or adding them as modules.</p>
<p>Monolithic kernels:</p>
<blockquote><p>Building a function into the kernel directly ensures that that function will be available at all times. The downside is that it makes your kernel bigger, increasing boot time, and ultimately using that much more memory to hold the kernel. If you are compiling a kernel to fit on a floppy so that you can boot Linux off a rescue floppy, space will become an issue.</p></blockquote>
<p>Modules:</p>
<blockquote><p>Building a function as a module allows that function to be loaded into memory as needed and unloaded when it is no longer needed. This helps keep your kernel small. It is very useful if, say, you are swapping hardware in and out of your system frequently. You could compile support for a variety of, say, sound cards as modules, and your Linux system will theoretically only load the driver that is appropriate for the hardware setup at the time.</p></blockquote>
<p>Another benefit of building functions as modules is that parameters can be passed to the modules which can be useful in debugging your system if problems occur.</p>
<p>There are some considerations to be made when deciding if a kernel function should be modularized. A small performance penalty is paid as it takes a little time to get the module loaded and unloaded. There are some functions that are needed at boot time and these cannot be compiled as modules &#8212; they need to be present in the kernel so your system can be loaded. For example, ext2/ext3/reiserfs file system support needs to be built into the kernel so that your partitions can be read, as you need to be able to read the filesystem to load modules. In my case, if I have PCMCIA support built into the kernel, then metworking works. If PCMCIA support is modularized, networking fails to start, probably because the PCMCIA support needs to be available very early in the boot process to set up networking.<br />
via <a href="http://forums.gentoo.org/viewtopic.php?t=58790">Gentoo Forums</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/12/10/compiling-directly-into-a-kernel-vs-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/12/10/compiling-directly-into-a-kernel-vs-modules/</feedburner:origLink></item>
		<item>
		<title>以太网卡混杂模式与Sniffer程序学习</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/TE6KiC_ELL0/</link>
		<comments>http://tuzei.net/2011/11/29/%e4%bb%a5%e5%a4%aa%e7%bd%91%e5%8d%a1%e6%b7%b7%e6%9d%82%e6%a8%a1%e5%bc%8f%e4%b8%8esniffer%e7%a8%8b%e5%ba%8f%e5%ad%a6%e4%b9%a0/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 09:43:33 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[技术 | 工作]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=728</guid>
		<description><![CDATA[Wikipedia 混杂模式（Promiscuous Mode）是计算机网络中的术语。是指一台机器的网卡能够接收所有经过它的数据流，而不论其目的地址是否是它。 一般计算机网卡都工作在非混杂模式下，此时网卡只接受来自网络端口的目的地址指向自己的数据。当网卡工作在混杂模式下时，网卡将来自接口的所有数据都捕获并交给相应的驱动程序。网卡的混杂模式一般在网络管理员分析网络数据作为网络故障诊断手段时用到，同时这个模式也被网络黑客利用来作为网络数据窃听的入口。在Liunx操作系统中设置网卡混杂模式，时需要管理员权限。在windows操作系统和Linux操作系统中都有使用混杂模式的抓包工具，比如著名的开源软件wireshark. Linux下手动切换网卡(eth0)为(非)混杂模式。 默认为非混杂模式： ifconfig eth0 -promisc 将eth0置为混杂(promiscuous)： ifconfig eth0 promisc 查看网卡是否混杂： ifconfig eth0 输出若包含PROMISC则说明处于混杂模式。 例： eth0 Link encap:以太网 硬件地址 xx:xx:xx:xx:xx:xx inet 地址:x.x.x.x 广播:x.x.x.x 掩码:x.x.x.x UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 跃点数:1 &#8230; 注： 1. struct ifreq结构定义在/usr/include/net/if.h，用来配置ip地址，激活接口，配置MTU等接口信息的。ifreq包含在ifconf结构中。而ifconf结构通常是用来保存所有接口的信息的。 2. 使用tcmdump监视某个主机设备(端口), 并产生C代码, 并可使用setsockopt绑定filter : $ sudo tcpdump -i wlan0 -dd port xxxx and host xxx.xxx.xxx.xxx [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://zh.wikipedia.org/wiki/%E6%B7%B7%E6%9D%82%E6%A8%A1%E5%BC%8F">Wikipedia</a><br />
<blockquote>混杂模式（Promiscuous Mode）是计算机网络中的术语。是指一台机器的网卡能够接收所有经过它的数据流，而不论其目的地址是否是它。</p>
<p>一般计算机网卡都工作在非混杂模式下，此时网卡只接受来自网络端口的<strong>目的地址指向自己</strong>的数据。当网卡工作在混杂模式下时，网卡将来自接口的<strong>所有数据</strong>都捕获并交给相应的驱动程序。网卡的混杂模式一般在网络管理员分析网络数据作为网络故障诊断手段时用到，同时这个模式也被网络黑客利用来作为网络数据窃听的入口。在Liunx操作系统中设置网卡混杂模式，时需要管理员权限。在windows操作系统和Linux操作系统中都有使用混杂模式的抓包工具，比如著名的开源软件wireshark.</p></blockquote>
<p>Linux下手动切换网卡(eth0)为(非)混杂模式。</p>
<blockquote><p>
默认为非混杂模式：</p>
<blockquote><p>ifconfig eth0 -promisc</p></blockquote>
<p>将eth0置为混杂(promiscuous)：</p>
<blockquote><p>ifconfig eth0 promisc</p></blockquote>
<p>查看网卡是否混杂：</p>
<blockquote><p>ifconfig eth0</p></blockquote>
<p>输出若包含PROMISC则说明处于混杂模式。<br />
例：</p>
<blockquote><p>
eth0    Link encap:以太网  硬件地址 xx:xx:xx:xx:xx:xx<br />
           inet 地址:x.x.x.x  广播:x.x.x.x  掩码:x.x.x.x<br />
           UP BROADCAST RUNNING <strong>PROMISC</strong> MULTICAST  MTU:1500  跃点数:1<br />
           &#8230;
</p></blockquote>
</blockquote>
<p>注：<span id="more-728"></span><br />
       1. struct ifreq结构定义在/usr/include/net/if.h，用来配置ip地址，激活接口，配置MTU等接口信息的。ifreq包含在ifconf结构中。而ifconf结构通常是用来保存所有接口的信息的。</p>
<p>       2. 使用tcmdump监视某个主机设备(端口), 并产生C代码, 并可使用setsockopt绑定filter :</p>
<blockquote><p>$ sudo tcpdump -i wlan0 -dd port xxxx and host xxx.xxx.xxx.xxx </p></blockquote>
<p>       3. 以太网帧结构(42)：Ethernet header(14)&#8212;>Dest Mac(6 bytes)[0-5], Source Mac[6-11]; IP header(20)&#8212;>[12-15]Dest IP(4 bytes), Source IP[16-19]; Tcp/Udp(8); Dest(2    bytes)/source port[20-21,22-23]</p>
<p>       4. IP报文起始为0&#215;45, 即版本(4 bit)与首部长度，占一个字节;</p>
<p>参考资料：<br />
               <a href="http://hi.baidu.com/zkheartboy/blog/item/2dd5207abfbeb8ef2e73b3bf.html">C语言编程来使网卡工作在混杂模式</a><br />
               <a href="http://2006zhouxinfeng.blog.163.com/blog/static/502402162011102532453/"> ioctl和struct ifreq </a><br />
               <a href="http://www.cnblogs.com/jinrize/archive/2009/11/24/1609902.html">Linux下Sniffer程序的实现</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/11/29/%e4%bb%a5%e5%a4%aa%e7%bd%91%e5%8d%a1%e6%b7%b7%e6%9d%82%e6%a8%a1%e5%bc%8f%e4%b8%8esniffer%e7%a8%8b%e5%ba%8f%e5%ad%a6%e4%b9%a0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/11/29/%e4%bb%a5%e5%a4%aa%e7%bd%91%e5%8d%a1%e6%b7%b7%e6%9d%82%e6%a8%a1%e5%bc%8f%e4%b8%8esniffer%e7%a8%8b%e5%ba%8f%e5%ad%a6%e4%b9%a0/</feedburner:origLink></item>
		<item>
		<title>[魔都日记2]关于目前正在做的和将要做的</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/BvJFy2AysgA/</link>
		<comments>http://tuzei.net/2011/11/02/%e9%ad%94%e9%83%bd%e6%97%a5%e8%ae%b02%e5%85%b3%e4%ba%8e%e7%9b%ae%e5%89%8d%e6%ad%a3%e5%9c%a8%e5%81%9a%e7%9a%84%e5%92%8c%e5%b0%86%e8%a6%81%e5%81%9a%e7%9a%84/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 15:55:35 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[技术 | 工作]]></category>
		<category><![CDATA[生活 | 碎片]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=702</guid>
		<description><![CDATA[来到魔都的第二周。一切都比较顺利，我们部门主要做大中型交换机的研发，机体板子结构比较复杂，模块区分非常明晰，产品已经发售使用。接下来需要做的就是将板子上跑的vxworks替换成目前比较流行的Linux，说白了就是系统移植方面的东西。最近这两天都是做一些准备工作，需要对LINUX底层的API接口，设备驱动，网络协议，以及VxWORKS与底层硬件交互的驱动进行深入了解。再有就是接触宏观的一些东西，比如板子内部的信息流通，整体的架构，收发报文的流程，抓包及包内数据的具体分析。板子主要有两块NT和LT板，即通常所说的网卡与线卡。整个MDU拿起来很沉，能看到的模块除了上述两个，还有风扇模块，电源模块及trace&#038;debug接口,adsl&#038;vdsl接口等。比较有幸的是直接见到了2u MDU的设计师，就坐在我附近，以后就有得学了。这是我为数不多的几次接触嵌入式系统的研发，比较有挑战性。 看源码有一周多，有很大的收获，架构方面在逐步的成型。还是得努力，多学东西吧。题外话。早上跟会长学了一手，动态的更改MAC地址，由此花费了一上午时间写了个脚本，解决了不少问题。会长看了以后只说搞这行三分技术七分守管理，比较汗颜，我搞的这个也是无耻的暴力使用其他人的网络资源，乖乖的学东西。所谓大道至简，虚怀若古嘛。题外话2：不知道怎的突然就贼想玩玩TWITTER，用ANDROID客户端软件SSHTUNNEL也没什么大的效果，只能求助。题外话3：工作这一年会坚持写下去这个BLOG，当然大多数会写技术相关性的东西，留下一些印记。内容可能五花八门，python,tornado,linux,kernel,c/c++,algorithm. etc。就先这样，睡觉先，明天早起。安。]]></description>
			<content:encoded><![CDATA[<p>来到魔都的第二周。一切都比较顺利，我们部门主要做大中型交换机的研发，机体板子结构比较复杂，模块区分非常明晰，产品已经发售使用。接下来需要做的就是将板子上跑的vxworks替换成目前比较流行的Linux，说白了就是系统移植方面的东西。最近这两天都是做一些准备工作，需要对LINUX底层的API接口，设备驱动，网络协议，以及VxWORKS与底层硬件交互的驱动进行深入了解。再有就是接触宏观的一些东西，比如板子内部的信息流通，整体的架构，收发报文的流程，抓包及包内数据的具体分析。板子主要有两块NT和LT板，即通常所说的网卡与线卡。整个MDU拿起来很沉，能看到的模块除了上述两个，还有风扇模块，电源模块及trace&#038;debug接口,adsl&#038;vdsl接口等。<span id="more-702"></span>比较有幸的是直接见到了2u MDU的设计师，就坐在我附近，以后就有得学了。这是我为数不多的几次接触嵌入式系统的研发，比较有挑战性。</p>
<p>看源码有一周多，有很大的收获，架构方面在逐步的成型。还是得努力，多学东西吧。题外话。早上跟会长学了一手，动态的更改MAC地址，由此花费了一上午时间写了个脚本，解决了不少问题。会长看了以后只说搞这行三分技术七分守管理，比较汗颜，我搞的这个也是无耻的暴力使用其他人的网络资源，乖乖的学东西。所谓大道至简，虚怀若古嘛。题外话2：不知道怎的突然就贼想玩玩TWITTER，用ANDROID客户端软件SSHTUNNEL也没什么大的效果，只能求助。题外话3：工作这一年会坚持写下去这个BLOG，当然大多数会写技术相关性的东西，留下一些印记。内容可能五花八门，python,tornado,linux,kernel,c/c++,algorithm. etc。就先这样，睡觉先，明天早起。安。</p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/11/02/%e9%ad%94%e9%83%bd%e6%97%a5%e8%ae%b02%e5%85%b3%e4%ba%8e%e7%9b%ae%e5%89%8d%e6%ad%a3%e5%9c%a8%e5%81%9a%e7%9a%84%e5%92%8c%e5%b0%86%e8%a6%81%e5%81%9a%e7%9a%84/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/11/02/%e9%ad%94%e9%83%bd%e6%97%a5%e8%ae%b02%e5%85%b3%e4%ba%8e%e7%9b%ae%e5%89%8d%e6%ad%a3%e5%9c%a8%e5%81%9a%e7%9a%84%e5%92%8c%e5%b0%86%e8%a6%81%e5%81%9a%e7%9a%84/</feedburner:origLink></item>
		<item>
		<title>魔都日记1</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/ect0KcrJ4Fk/</link>
		<comments>http://tuzei.net/2011/10/25/%e9%ad%94%e9%83%bd%e6%97%a5%e8%ae%b01/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 15:03:13 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[生活 | 碎片]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=699</guid>
		<description><![CDATA[前段时间一直比较乱，所有的事情一下都集中到一起。两名导师都在纠结于我毕业选题。虽然有些不满，但总归要去做，老师或许是想的太多了，从最初的数据融合到数据挖掘，推荐算法到后面我实在忍受不了无休止的问答。听到我最终离开学校，导师只是说了句，可惜了，无它。选择出来实习在我想来或许是一件正确的事情，不，这一定是非常正确的事情，软件行业尽早入职可能会比在学校更早的体会到工作中的一些事情，在学校搞科研固然很好，可是你无法把定这个行业的需求，虽然可以依据大量的paper可以提高自己的功底，可这对浮躁的校园来讲，几乎是不能够做到的，这些方面，老师有些天真。想想研一一年飞快，除了上课就是对这电脑，对着厚厚的书，不停的coding，从未懈怠。还有一年多的时间就要再次毕业，丝毫没有本科领到毕业证的兴奋，现在可以平和的去思考一些问题，去想一些事情，这些东西都是老爷子教给我的，想来老爷子看的比较透。 来魔都有一周多了，一切都安好，公司安排的相对比较顺利。就是出来找房子稍微麻烦一点，这相对于收拾房间卫生来说还是比较容易的。公司主要搞通讯网络，偏向底层，属于我比较喜欢的方向。刚开始会从系统移植做起，读了一些文档，感觉比较有趣。公司里面会不定时的举行项目组交流，参加了一次，获益匪浅。希望可以在这一行做出点东西，这些比较硬性，可以试试。就先这样，最近开始科研，可能会多写一些linux,python方面的东西。]]></description>
			<content:encoded><![CDATA[<p>前段时间一直比较乱，所有的事情一下都集中到一起。两名导师都在纠结于我毕业选题。虽然有些不满，但总归要去做，老师或许是想的太多了，从最初的数据融合到数据挖掘，推荐算法到后面我实在忍受不了无休止的问答。听到我最终离开学校，导师只是说了句，可惜了，无它。选择出来实习在我想来或许是一件正确的事情，不，这一定是非常正确的事情，软件行业尽早入职可能会比在学校更早的体会到工作中的一些事情，在学校搞科研固然很好，可是你无法把定这个行业的需求，虽然可以依据大量的paper可以提高自己的功底，可这对浮躁的校园来讲，几乎是不能够做到的，这些方面，老师有些天真。<span id="more-699"></span>想想研一一年飞快，除了上课就是对这电脑，对着厚厚的书，不停的coding，从未懈怠。还有一年多的时间就要再次毕业，丝毫没有本科领到毕业证的兴奋，现在可以平和的去思考一些问题，去想一些事情，这些东西都是老爷子教给我的，想来老爷子看的比较透。</p>
<p>来魔都有一周多了，一切都安好，公司安排的相对比较顺利。就是出来找房子稍微麻烦一点，这相对于收拾房间卫生来说还是比较容易的。公司主要搞通讯网络，偏向底层，属于我比较喜欢的方向。刚开始会从系统移植做起，读了一些文档，感觉比较有趣。公司里面会不定时的举行项目组交流，参加了一次，获益匪浅。希望可以在这一行做出点东西，这些比较硬性，可以试试。就先这样，最近开始科研，可能会多写一些linux,python方面的东西。</p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/10/25/%e9%ad%94%e9%83%bd%e6%97%a5%e8%ae%b01/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/10/25/%e9%ad%94%e9%83%bd%e6%97%a5%e8%ae%b01/</feedburner:origLink></item>
		<item>
		<title>django上传图片问题</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/5dhlXUaaVU8/</link>
		<comments>http://tuzei.net/2011/05/30/django%e4%b8%8a%e4%bc%a0%e5%9b%be%e7%89%87%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Sun, 29 May 2011 16:43:46 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[技术 | 工作]]></category>
		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=692</guid>
		<description><![CDATA[最近这个在admin上传图片的东西搞的我非常郁闷，求教了很多人，查了很多资料。知道问题出在setting.py中的路径，但是怎么着改都有问题，今晚实在没辙就完全推倒重做，又仔细的分析了一遍media_root,media_url,static_root,static_url,admin_media_prefix。参考帮助文档，终于搞定，mark一下。 > MEDIA_ROOT the directory where you upload media > MEDIA_URL the url where your site media &#8211; css, js, icons etc live > ADMIN_MEDIA_PREFIX the alias to where the admin media lives &#8211; django/contrib/admin/media 设置好setting.py文件后，在urls.py文件中添加一个urlpattern，如下代码： url&#40;r'^media/(?P&#60;path&#62;.*)$', &#160; &#160; &#160; &#160; 'django.views.static.serve', &#160; &#160; &#160; &#160; &#123;'document_root': settings.MEDIA_ROOT&#125; &#160; &#160;&#41;,]]></description>
			<content:encoded><![CDATA[<p>最近这个在admin上传图片的东西搞的我非常郁闷，求教了很多人，查了很多资料。知道问题出在setting.py中的路径，但是怎么着改都有问题，今晚实在没辙就完全推倒重做，又仔细的分析了一遍media_root,media_url,static_root,static_url,admin_media_prefix。参考<a href="https://docs.djangoproject.com/en/1.3/ref/settings/">帮助文档</a>，终于搞定，mark一下。<span id="more-692"></span></p>
<blockquote><p>> MEDIA_ROOT</p>
<p>the directory where you upload media</p>
<p>> MEDIA_URL</p>
<p>the url where your site media &#8211; css, js, icons etc live</p>
<p>> ADMIN_MEDIA_PREFIX</p>
<p>the alias to where the admin media lives &#8211; django/contrib/admin/media </p></blockquote>
<p>设置好setting.py文件后，在urls.py文件中添加一个urlpattern，如下代码：</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">url<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^media/(?P&lt;path&gt;.*)$'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'django.views.static.serve'</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#123;</span><span style="color: #483d8b;">'document_root'</span>: settings.<span style="color: black;">MEDIA_ROOT</span><span style="color: black;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span></div></div>
<p><!--more--><br />
<img src="http://photo2.bababian.com/upload5/20110530/D8428A43A5222DEB92374F4970927EF9.jpg" alt="setting" /></p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/05/30/django%e4%b8%8a%e4%bc%a0%e5%9b%be%e7%89%87%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/05/30/django%e4%b8%8a%e4%bc%a0%e5%9b%be%e7%89%87%e9%97%ae%e9%a2%98/</feedburner:origLink></item>
		<item>
		<title>django学习记录1</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/TaZrZ8RwyFs/</link>
		<comments>http://tuzei.net/2011/05/29/django%e5%ad%a6%e4%b9%a0%e8%ae%b0%e5%bd%951/#comments</comments>
		<pubDate>Sun, 29 May 2011 01:56:45 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[技术 | 工作]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=686</guid>
		<description><![CDATA[Django报错UnicodeEncodeError: &#8216;ascii&#8217; codec can&#8217;t encode characters 之解决方法！ how-to: 编码问题。Change the __str__ methods on your models to be __unicode__ methods. Just change the name. Usually, nothing else will be needed. 　 admin.site.root vs admin.site.urls admin.site.root does not exist under Django 1.3 anymore, and you can use the last one instead. &#160;from django.conf.urls.defaults import * &#160;from django.contrib [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Django报错UnicodeEncodeError: &#8216;ascii&#8217; codec can&#8217;t encode characters 之解决方法！</strong><br />
how-to:<br />
编码问题。Change the __str__ methods on your models to be __unicode__ methods. Just change the name. Usually, nothing else will be needed. 　<span id="more-686"></span></p>
<blockquote><p>admin.site.root <strong>vs</strong> admin.site.urls</p></blockquote>
<p>admin.site.root does not exist under Django 1.3 anymore, and you can use the last one instead.</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">conf</span>.<span style="color: black;">urls</span>.<span style="color: black;">defaults</span> <span style="color: #ff7700;font-weight:bold;">import</span> *<br />
&nbsp;<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">contrib</span> <span style="color: #ff7700;font-weight:bold;">import</span> admin<br />
&nbsp;admin.<span style="color: black;">autodiscover</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp;<br />
&nbsp;urlpatterns <span style="color: #66cc66;">=</span> patterns<span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'^admin/'</span><span style="color: #66cc66;">,</span> include<span style="color: black;">&#40;</span>admin.<span style="color: #dc143c;">site</span>.<span style="color: black;">urls</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span><br />
&nbsp;<span style="color: black;">&#41;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/05/29/django%e5%ad%a6%e4%b9%a0%e8%ae%b0%e5%bd%951/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/05/29/django%e5%ad%a6%e4%b9%a0%e8%ae%b0%e5%bd%951/</feedburner:origLink></item>
		<item>
		<title>从无头单链表中删除节点</title>
		<link>http://feedproxy.google.com/~r/tuzei/~3/7wxQGbsPZys/</link>
		<comments>http://tuzei.net/2011/05/14/%e4%bb%8e%e6%97%a0%e5%a4%b4%e5%8d%95%e9%93%be%e8%a1%a8%e4%b8%ad%e5%88%a0%e9%99%a4%e8%8a%82%e7%82%b9/#comments</comments>
		<pubDate>Sat, 14 May 2011 13:59:56 +0000</pubDate>
		<dc:creator>jaykenduke</dc:creator>
				<category><![CDATA[技术 | 工作]]></category>

		<guid isPermaLink="false">http://tuzei.net/?p=682</guid>
		<description><![CDATA[题目： 假设有一个没有头指针的单链表。一个指针指向此单链表中间的一个节点（非第一个节点， 也非最后一个节点）。请将该节点从单链表中删除。 解答： 典型的“狸猫换太子”， 若要删除该节点，正常情况下，应该要知道该节点的前面节点的指针，但是由于单链表中没有头结点，所以无法追溯到该节点前面的那个节点，因此，这里采用了“移花接木”的方法。设该节点为B，下一个节点为C。那么，首先将B节点的内容替换为C节点的内容，然后，将C节点删除，这样就达到了我们的目的。代码如下： pcur->next = pnext->next; pcur->data = pnext->date; delete pnext; via 附录程序via： //考虑删除节点为尾节点 void deleteNode2&#40;Node * pCurrent, Node * head&#41; &#123; &#160; &#160; if&#40;pCurrent != NULL&#41; &#160; &#160; &#123; &#160; &#160; &#160; &#160; if&#40;pCurrent-&#62;next != NULL&#41; &#160; &#160; &#160; &#160; &#123; &#160; &#160; &#160; &#160; &#160; &#160; Node * pTemp = [...]]]></description>
			<content:encoded><![CDATA[<p>题目：<br />
 假设有一个没有头指针的单链表。一个指针指向此单链表中间的一个节点（非第一个节点， 也非最后一个节点）。请将该节点从单链表中删除。<br />
解答：<br />
        典型的“狸猫换太子”， 若要删除该节点，正常情况下，应该要知道该节点的前面节点的指针，但是由于单链表中没有头结点，所以无法追溯到该节点前面的那个节点，因此，这里采用了“移花接木”的方法。设该节点为B，下一个节点为C。那么，首先将B节点的内容替换为C节点的内容，然后，将C节点删除，这样就达到了我们的目的。代码如下：<span id="more-682"></span></p>
<blockquote><p>
pcur->next = pnext->next;</p>
<p>pcur->data = pnext->date;</p>
<p>delete pnext;</p></blockquote>
<p><a href="http://hi.baidu.com/silverxinger/blog/item/be3b0667b776c8710c33fafe.html">via</a><br />
<!--more--><br />
附录程序<a href="http://www.cnblogs.com/kurtwang/archive/2010/09/22/1833050.html">via</a>：</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//考虑删除节点为尾节点</span><br />
<span style="color: #993333;">void</span> deleteNode2<span style="color: #009900;">&#40;</span>Node <span style="color: #339933;">*</span> pCurrent<span style="color: #339933;">,</span> Node <span style="color: #339933;">*</span> head<span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>pCurrent <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>pCurrent<span style="color: #339933;">-&gt;</span>next <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node <span style="color: #339933;">*</span> pTemp <span style="color: #339933;">=</span> pCurrent<span style="color: #339933;">-&gt;</span>next<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pCurrent<span style="color: #339933;">-&gt;</span>value <span style="color: #339933;">=</span> pTemp<span style="color: #339933;">-&gt;</span>value<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pCurrent<span style="color: #339933;">-&gt;</span>next <span style="color: #339933;">=</span> pTemp<span style="color: #339933;">-&gt;</span>next<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delete pTemp<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node <span style="color: #339933;">*</span> temp <span style="color: #339933;">=</span> head<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>temp <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>temp<span style="color: #339933;">-&gt;</span>next <span style="color: #339933;">==</span> pCurrent<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delete pCurrent<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp<span style="color: #339933;">-&gt;</span>next <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp <span style="color: #339933;">=</span> temp<span style="color: #339933;">-&gt;</span>next<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>#做Graph相关，使用到，思想来源于编程之美</p>
]]></content:encoded>
			<wfw:commentRss>http://tuzei.net/2011/05/14/%e4%bb%8e%e6%97%a0%e5%a4%b4%e5%8d%95%e9%93%be%e8%a1%a8%e4%b8%ad%e5%88%a0%e9%99%a4%e8%8a%82%e7%82%b9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://tuzei.net/2011/05/14/%e4%bb%8e%e6%97%a0%e5%a4%b4%e5%8d%95%e9%93%be%e8%a1%a8%e4%b8%ad%e5%88%a0%e9%99%a4%e8%8a%82%e7%82%b9/</feedburner:origLink></item>
	</channel>
</rss>

