<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/css" href="css/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>雨笑烟燃 - 工作笔记</title><link>http://www.yxyr.com/</link><description>做最好的自己 - </description><generator>RainbowSoft Studio Z-Blog 1.6 Beta Build 60517</generator><language>zh-CN</language><copyright>Copyright yxyr.com ,Some Rights Reserved.&amp;lt;a href=&amp;quot;http://www.miibeian.gov.cn&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;浙ICP备06021833号&amp;lt;/a&amp;gt;</copyright><pubDate>Sat, 11 Sep 2010 04:45:00 +0800</pubDate><item><title>debian date设置</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/356.html</link><pubDate>Tue, 19 May 2009 15:47:09 +0800</pubDate><guid>http://www.yxyr.com/post/356.html</guid><description><![CDATA[通过Date来设置时间 如果硬件的时间不正确<br/>设置也是无效的。需要设置硬件的时间:<br/>hwclock  查看硬件时钟  此command 只有root能使用 一般user无法使用<br/>更改硬件时钟<br/>例：<br/>hwclock --set --date="12/01/2007 10:45:34"<br/>                      月  日 年   时 分  秒<br/>同步系统时间和硬件时间<br/>hwclock --hctosys<br/><br/>date用法<br/>例：<br/>date 120110552007.12<br/>     月 日时分 年 . 秒]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/356.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=356</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=356</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=356</trackback:ping></item><item><title>Js中模拟.Net功能(二)</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/355.html</link><pubDate>Fri, 08 May 2009 18:16:27 +0800</pubDate><guid>http://www.yxyr.com/post/355.html</guid><description><![CDATA[模式 String.endwith 功能.<br/><p class="code">String.prototype.endwith&nbsp;=&nbsp;function(element)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(this.length&nbsp;&gt;&nbsp;0)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(element.length&nbsp;&gt;&nbsp;0)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(this.substring(this.length-element.length)==element)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;<br/>}<br/><br/></p>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/355.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=355</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=355</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=355</trackback:ping></item><item><title>验证手机号码所属运营商的JS代码</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/354.html</link><pubDate>Mon, 04 May 2009 23:41:41 +0800</pubDate><guid>http://www.yxyr.com/post/354.html</guid><description><![CDATA[<p class="code">function&nbsp;getMobileServices(mobile)&nbsp;{<br/>if(mobile.startwith("0")==true){<br/>mobile=mobile.substring(1);<br/>}<br/>if(mobile.startwith("+086")==true){<br/>mobile=mobile.substring(4);<br/>}<br/>var&nbsp;chinaunicom=new&nbsp;Array("130","131","132","133");<br/>var&nbsp;chinamobilea=new&nbsp;Array("135","136","137","138","139","150","158","159");<br/>var&nbsp;chinamobileb=new&nbsp;Array("1340","1341","1342","1343","1344","1345","1346","1347","1348");<br/>var&nbsp;bolchinaunicom=chinaunicom.contains(mobile.substring(0,3));<br/>var&nbsp;bolchinamobilea=chinamobilea.contains(mobile.substring(0,3));<br/>var&nbsp;bochinamobileb=chinamobileb.contains(mobile.substring(0,4));<br/>if(bolchinaunicom)<br/>return&nbsp;1//联通<br/>if(bolchinamobilea&nbsp;||&nbsp;bochinamobileb&nbsp;)<br/>return&nbsp;2&nbsp;//移动<br/>return&nbsp;3&nbsp;//电信或其他营运商<br/>}<br/></p>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/354.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=354</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=354</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=354</trackback:ping></item><item><title>模拟.Net的JS代码</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/353.html</link><pubDate>Mon, 04 May 2009 23:34:11 +0800</pubDate><guid>http://www.yxyr.com/post/353.html</guid><description><![CDATA[在开发过程中使用了JS脚本.因对一些代码的使用频繁.对JS进行了一些扩展.<br/><br/>模拟类似与.Net中的一些功能.为以后的操作带来简便性.<br/><br/>1.String.startwith功能<br/><br/><p class="code">String.prototype.startwith&nbsp;=&nbsp;function(element)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;l&nbsp;=&nbsp;element.length;<br/>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(this.length&nbsp;&gt;&nbsp;0)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(l&nbsp;&gt;&nbsp;0)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(this.substring(0,&nbsp;l&nbsp;)&nbsp;==&nbsp;element)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;<br/>}<br/><br/><br/><br/></p>2.String.contains 功能<br/><p class="code">String.prototype.contains&nbsp;=&nbsp;function(element)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(this.length&nbsp;&gt;&nbsp;0)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(element.length&nbsp;&gt;&nbsp;0)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(this.indexOf(element)&nbsp;!=&nbsp;-1)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;<br/>}<br/></p><br/>3.Array.contains 功能<br/><p class="code">Array.prototype.contains&nbsp;=&nbsp;function(element)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;this.length;&nbsp;i++)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(this[i]&nbsp;==&nbsp;element)&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;<br/>}<br/></p>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/353.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=353</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=353</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=353</trackback:ping></item><item><title>Using jQuery to Consume ASP.NET JSON Web Services[transshipment]</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/352.html</link><pubDate>Sun, 19 Apr 2009 10:32:04 +0800</pubDate><guid>http://www.yxyr.com/post/352.html</guid><description><![CDATA[<p>In response to many of the articles here, I receive feedback asking how to achieve the same results without using ASP.NET AJAX. As much as I’m a fan of ASP.NET AJAX, I must agree that its JavaScript payload can certainly be a drawback in some situations.</p><p>My recent <a href="http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/">deferred content loading</a> post is an excellent example of that. I was using <a href="http://jquery.com/" rel="nofollow">jQuery</a> for presentational effects, <em>and</em> using a ScriptManager to call a web service. Loading the JavaScript for both frameworks was a bit counterproductive, since the whole point was to improve initial load time.</p><p>In this post, I intend to correct that. </p><p>First, I’ll cover the <strong>two requirements</strong> necessary when calling an ASMX web service that’s being JSON serialized by the ASP.NET AJAX extensions. Then, I’ll show you <strong>how to do this with jQuery</strong>. Finally, I’ll <strong>update the deferred content loading example</strong> accordingly.</p><p><br /><br/><h3>Additional security when calling JSON serialized services</h3><p>A security feature of ASP.NET web services that are JSON serialized through the ASP.NET AJAX extensions is that they must be requested in a specific way. This is an important deterrent against your services being used in XSS attacks. <strong>Scott Guthrie</strong> has <a href="http://weblogs.asp.net/scottgu/archive/2007/04/04/json-hijacking-and-how-asp-net-ajax-1-0-mitigates-these-attacks.aspx">a great post providing detailed information</a> on the particulars. It boils down to is two things:</p><ul><li>The request must be an HTTP POST request <br/><li>The request’s content-type must be: “application/json; charset=utf-8″ </li></ul><p>When you register and call a web service through ASP.NET AJAX’s ScriptManager, you may safely enjoy blissful ignorance of these requirements. The framework transparently handles everything for you.</p><p>However, if you want to use a third party AJAX framework to request the JSON serialized output, you may run into trouble due to these security features.</p><h3>How to make jQuery jump through these hoops</h3><p>The solution is a bit less intuitive than using the ScriptManager or what you would normally expect from jQuery. Using jQuery’s getJSON() would make sense, but it unfortunately meets neither of the above security criteria.</p><p>The most reliable way that I’ve found is to use jQuery.ajax() as follows:</p><div class="wp_syntax"><div class="code"><pre class="javascript">$.<span>ajax</span><span>(</span><span>{</span><br/>  type: <span>"POST"</span>,<br/>  contentType: <span>"application/json; charset=utf-8"</span>,<br/>  url: <span>"WebService.asmx/WebMethodName"</span>,<br/>  data: <span>"{}"</span>,<br/>  dataType: <span>"json"</span><br/><span>}</span><span>)</span>;</pre></div></div><p>As you can see, the first parameters set the request type and content-type as required by the ASP.NET AJAX framework.</p><p>When making a read-only request, <strong>the empty data parameter is the key</strong>. For reasons unknown, jQuery does not properly set the specified content-type when there is no data included. </p><p>The “{}” data parameter represents an empty JSON object, which you can think of as the JSON equivalent of null. Supplying this parameter will convince jQuery to correctly send the content-type that we’ve supplied, while it will be safely ignored by the web service.</p><p>If you’d like to see a closer examination of why this particular syntax is used, you’ll be interested in <a href="http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/">3 mistakes to avoid when using jQuery with ASP.NET AJAX</a>.</p><h3>Putting it all together</h3><p>Now that we know how to call the web service, appropriately modifying the original example is easy. Here’s the new ASPX code:</p><div class="wp_syntax"><div class="code"><pre class="asp"><span>&lt;div</span> <span>id</span>=<span>"Container"</span><span>&gt;</span><br/>  <span>&lt;div</span> <span>id</span>=<span>"RSSBlock"</span><span>&gt;</span><br/>    <span>&lt;div</span> <span>id</span>=<span>"RSSContent"</span> <span>class</span>=<span>"loading"</span>&gt;&lt;/div&gt;<br/>  <span>&lt;/div&gt;</span><br/>&nbsp;<br/>  <span>&lt;div</span> <span>id</span>=<span>"Content"</span><span>&gt;</span><br/>    &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing...<span>&lt;/p&gt;</span><br/>  <span>&lt;/div&gt;</span><br/><span>&lt;/div&gt;</span><br/>&nbsp;<br/><span>&lt;script</span> <span>type</span>=<span>"text/javascript"</span> src=<span>"jquery-1.2.3.min.js"</span>&gt;&lt;/script&gt;<br/><span>&lt;script</span> <span>type</span>=<span>"text/javascript"</span> src=<span>"Default.js"</span>&gt;&lt;/script&gt;</pre></div></div><p>Notice that I’ve placed the JavaScript references below the rest of the page’s content. Since browsers block while requesting, loading, and executing JavaScript, it makes sense to defer that until as late as possible. This will serve to further boost the page’s perceived performance.</p><p>Finally, the jQuery code to call the web service and appropriately handle its result:</p><div class="wp_syntax"><div class="code"><pre class="javascript">$<span>(</span>document<span>)</span>.<span>ready</span><span>(</span><span>function</span><span>(</span><span>)</span> <span>{</span><br/>  $.<span>ajax</span><span>(</span><span>{</span><br/>    type: <span>"POST"</span>,<br/>    url: <span>"RSSReader.asmx/GetRSSReader"</span>,<br/>    data: <span>"{}"</span>,<br/>    contentType: <span>"application/json; charset=utf-8"</span>,<br/>    dataType: <span>"json"</span>,<br/>    success: <span>function</span><span>(</span>msg<span>)</span> <span>{</span><br/>      <span>// Hide the fake progress indicator graphic.</span><br/>      $<span>(</span><span>'#RSSContent'</span><span>)</span>.<span>removeClass</span><span>(</span><span>'loading'</span><span>)</span>;<br/>&nbsp;<br/>      <span>// Insert the returned HTML into the &lt;div&gt;.</span><br/>      $<span>(</span><span>'#RSSContent'</span><span>)</span>.<span>html</span><span>(</span>msg.<span>d</span><span>)</span>;<br/>    <span>}</span><br/>  <span>}</span><span>)</span>;<br/><span>}</span><span>)</span>;</pre></div></div><h3>Conclusion: Is it worth it?</h3><p>By using jQuery to call the web service directly, <strong>we’ve eliminated over 100 KB of JavaScript</strong> and <strong>three extra HTTP requests</strong>. The ASP.NET AJAX client side framework accounted for over half of the original example’s total download size, and those three extra HTTP requests unnecessarily delayed the progress indicator.</p><p>That may not sound like much, but it’s significant. When it comes to loading speed and responsiveness, users do not perceive changes linearly. Fractions of a second make the difference between a site that feels sluggish and one that appears responsive.</p><h3>A word about web services</h3><p>Web services are <em>great</em> tools that afford you substantial flexibility. It’s important not to overlook them.</p><p>You’ve no doubt seen many AJAX examples that involve using the XmlHttpRequest to request the output of a specially designed page, resulting in CSV or otherwise arbitrarily formatted data instead of HTML. For instance, I’ve noticed that a lot of the auto-complete plugins for jQuery expect this sort of kludge. </p><p>I believe that to be a short-sighted and counterproductive way to do things.</p><p>Web services have often been maligned in the past, due to the XML bloat associated with SOAP. However, JSON makes this drawback a thing of the past. <a href="http://encosia.com/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/">JSON is very lightweight</a>, making it ideal for structured AJAX communication. With the inefficiencies of SOAP neutralized, I think the power and flexibility of web services cannot be overstated.</p><p>For example, if I decide to move my sites from WebForms to MVC, there is a large amount of functionality encapsulated in web services that I won’t have to worry about recoding or redesigning. It’s a great feeling to have that flexibility and ease of reuse.</p><h3>Try it for yourself: download the source</h3><p>The full example’s source code (ASP.NET 3.5 required):</p>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/352.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=352</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=352</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=352</trackback:ping></item><item><title>Mobile Web Forms in Visual Studio 2008[转]</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/351.html</link><pubDate>Sat, 21 Feb 2009 22:54:49 +0800</pubDate><guid>http://www.yxyr.com/post/351.html</guid><description><![CDATA[<p>If you have worked with Visual Studio 2008 and tried creating Mobile Web Applications, you would have figured out that the "Mobile Web Form" template is missing.&nbsp; In the past, in Visual Studio .NET 2003 you had Mobile Web Forms that allow you to create webforms that can be rendered over different types of HTML, WML and XHTML capable devices.</p><p>Well, it is not shipped by default in Visual Studio 2008, but Omar Khan from the <a href="http://blogs.msdn.com/webdevtools/">Web Development Tools Team</a>&nbsp;has put up a few templates that can be downloaded and brings in those Mobile Templates required for creating mobile web applications.</p><p>You can download the templates from the <a href="http://blogs.msdn.com/webdevtools/archive/2007/09/17/tip-trick-asp-net-mobile-development-with-visual-studio-2008.aspx">Web Development Tools Team Blog Post here</a>&nbsp; There is a "readme" file attached to each of the extracted Zip folders.&nbsp; But to make it simpler, once you install and unzip the package, you get a folder "ASP.NET Mobile Templates" and inside that you might find a bunch of folders.</p><p>Copy the Zip folders inside each of the "ASP.NET Web Application" Folders into your system's Visual Studio Templates folder.&nbsp; For instance, there is a folder for "ASP.NET Web Application CS".&nbsp; You need to copy the contents of this file into</p><p>c:\Documents and Settings\&lt;username&gt;\My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#</p><p>Similarly you would copy the contents of the "VB" folder into the Visual Basic folder under "ItemTemplates" above.</p><p>Once you copy these and restart Visual Studio 2008, you would be able to get the "Mobile Web Form", "Mobile Web User Control" and "Mobile Web Configuration File" under "My Templates" in "Add New Item" Wizard.</p>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/351.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=351</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=351</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=351</trackback:ping></item><item><title>SqlConnection”在命名空间“System.Data.SqlClient”中不明确</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/348.html</link><pubDate>Wed, 15 Oct 2008 15:44:52 +0800</pubDate><guid>http://www.yxyr.com/post/348.html</guid><description><![CDATA[<p>今天打算写一个Blog 建立数据库处理时发现了如下的提示：</p><p>"SqlConnection”在命名空间“System.Data.SqlClient”中不明确"<br />感觉很奇怪,查找了可能重名的空间或类.都无所获.<br />然后进入Google搜索,得到的结果要不就是没有对System.Data.SqlClient的引用.<br />要不就是说出现定义空间类重名了.<br /><br />经过仔细分析发现是 VS2008在新建Class项目时,自动引用了<br />System.Data.DataSetExtensions<br />该类包含了对System.Data.SqlClient的信息.<br />当我需要使用Sqlclient Namespace时，造成了重复.<br />把对 System.Data.Sqlclient的引用删除解决~</p>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/348.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=348</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=348</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=348</trackback:ping></item><item><title>email的正规表达式</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/346.html</link><pubDate>Tue, 03 Jun 2008 09:04:26 +0800</pubDate><guid>http://www.yxyr.com/post/346.html</guid><description><![CDATA[<p>可以完全匹配邮件格式的正规表达式.支持用,;等隔开的邮件列表.</p><p>表达式如下:</p><p>&nbsp;</p><p>(\"((\S)(?&lt;!\"){1})+\")(\s){0,10}\&lt;\w*\@(\w+([-.]\w+)*\.){1,}\w*\&gt;|(\w*\@(\w+([-.]\w+)*\.){1,}\w*)</p><p>&nbsp;</p><p>如邮件:<br />"<a href="mailto:NASLOGWNDSYS@maersk-logistics.co">NASLOGWNDSYS@maersk-logistics.co</a>" &lt;<a href="mailto:NASLOGWNDSYS@maersk-logistics.com">NASLOGWNDSYS@maersk-logistics.com</a>&gt;, <a href="mailto:DGM@bluedragon.com.cn,s@s.bt">DGM@bluedragon.com.cn,s@s.bt</a>,"周"&lt;<a href="mailto:waixingzhike_mymail@tom.com">it@a.com.cn&gt;,ss@google.cn,"samson.zhou"&lt;waixingzhike_mymail@tom.com</a>&gt;</p>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/346.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=346</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=346</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=346</trackback:ping></item><item><title>configure pptpd vpn with shorewall</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/345.html</link><pubDate>Fri, 28 Sep 2007 08:05:43 +0800</pubDate><guid>http://www.yxyr.com/post/345.html</guid><description><![CDATA[1.edit pptpd configuration file.<br/>on the default pptpd.conf we can see detail expain<br/>this set,we only need to ensure something following.<br/>a).Path to the pptpd program,Default '/usr/sbin/pppd'<br/><br/>ppp /usr/sbin/pppd<br/><br/>b).Set localip and remoteip<br/>following the default Tag and explain.We can understand that localip is configuared for clients to get ipaddress auto.<br/>For the vpn server Is the gateway.So,we need configure localip.<br/>the vpn program will ignore the localip and set it automatic following the system configuration.<br/><br/>#localip 192.168.0.1<br/><br/>remoteip is become very important.It must be given as the rangle of you lan network.if you set the seperate of your Lan network proxyarp can't through to other's computer,well,You can configure it using shorewall by very complex code.<br/>This time,For simple action,I set the remoteip address as a ranges space ipaddress as the same as LAN network which is not using .<br/>for example:<br/><br/>remoteip 10.10.11.230-252<br/><br/>save the configuration file and complete pptp configuaration.<br/><br/>2.rebuild firewall with shorewall.<br/>We will ingore the basic building and configuration about shorewall.<br/>a).edit the shorewall interface file,add a vpn interface,Since the vpn login ipaddress is dynamic,We need set a ppp+ for interface configuaration.<br/><br/>vpn ppp+ detect<br/><br/>save the configuration and exit after add a line above.<br/>b).set the firewall configration rules<br/>allow pre protocol through our firewall.<br/><br/>ACCEPT wan fw gre -<br/>ACCEPT fw  lan gre -<br/><br/>wan is the eth0 connect to internet,lan is the eth1 connect to LAN network.fw is signal of firewall<br/><br/>c).Policy configuration<br/><br/>vpn fw ACCEPT<br/>vpn wan ACCEPT<br/><br/>Set a line allow data from vpn devices to fw,wan successfully.<br/><br/>d).Allow vpn connection accept to internet.<br/>edit the configuration of Masq file<br/><br/>ppp+ 10.10.11.0/23         10.10.11.254 <br/><br/>10.10.11.0/23 is vpn Network address,and 10.10.11.254 is the LAN Network ipaddress which is exists<br/>this I set to The gateway ipaddress.<br/><br/>e).After Set Above successful,Reboot firewall.<br/>It will work well.and completed the configuration of vpn and shorewall.<br/>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/345.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=345</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=345</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=345</trackback:ping></item><item><title>install VPN Server On debian Using PPTP</title><author>waixingzhike_mymail@tom.com (yuxiaoyanran)</author><link>http://www.yxyr.com/post/344.html</link><pubDate>Fri, 14 Sep 2007 15:11:10 +0800</pubDate><guid>http://www.yxyr.com/post/344.html</guid><description><![CDATA[<font color="Blue">install VPN Server On debian Using PPTP<br/>1.installing mppe support in kernel<br/>Most people want their tunnels encrypted.check the version of your kernel,If it is below 2.6.15-rcl then you do not have MPPE support,To check further,test like this:<br/><br/># modprobe ppp-compress-18 && echo success<br/>if this fails,follow the MPPE HOWTO blow,then continue <br/>********************************************************************************<br/>*   MPPE HOWTO<br/>*   Debian MPPE Howto,patch your own kernel<br/>*<br/>* a).prepare the system for kernel package building<br/>*   # apt-get install gcc bin86 libc6-dev bzip2 kernel-package kernel-patch-mppe<br/>*<br/>* b).install unpack and clean a kernel source package<br/>* # apt-get install kernel-source-2.6.11.7<br/>* # cd /usr/src<br/>* # tar xfj kernel-source-2.6.11.7.tar.bz2<br/>* # cd kernel-source-2.6.11.7<br/>* # make-kpkg clean<br/>*<br/>* For these instructions we used a kernel-source package built from 2.6.11.7 * kernel sources from<br/>* kernel.org,even though the latest kernel-source package from * Debian sarge 2.6.8,and on Debian <br/>* Sid is 2.6.11.It is up to you to choose an * appropriate kernel versior.<br/>*<br/>* c).adopt the currently installed .config file<br/>* # cp /boot/config- uname --kernel-release ./.config<br/>*<br/>* d).Build the kernel package<br/>* # cd /usr/src/kernel-source-2.6.11.7<br/>* # make-kpkg \<br/>*    --added-patches mppe \<br/>*    --append-to-version -mppe \<br/>*    --config oldconfig \<br/>*    --initrd \<br/>*    kernel_image<br/>*<br/>* Note:if the kernel version you are building for is 2.6.11.x and the kernel-* patch-mppe package<br/>*  has not been fixed,you will need to edit the file * /usr/src/kernel-patches/all/apply/mppe to <br/>* include the kernel version number.<br/>*  well,If you are tracking debian woody,you may wish to remove --initrd<br/>*<br/>* When you are prompted for the CONFIG_PPP_MPPE option,type m and press Enter:<br/>* PPP MPPE compression(encryption) (PPP_MPPE)[N/m/?](new) m<br/>*<br/>* e).install the kernel package<br/>* # dpkg --install /usr/src/kernel-image-2.6.11.7-mppe_10.00.Custom_all.deb<br/>* <br/>* f).reboot,then test:<br/>*  # modprobe ppp-compress-18 && echo success<br/>*<br/>* if this works,"success" will be displayed.If you are on a console or watching <br/>* syslog,you may see:<br/>*<br/>* ppp_mppe:module license 'BSD without advertisement clause'taints kernel.<br/>* PPP MPPE Compression module registered<br/>*<br/>* These message do not stop it from working.<br/>* continue:<br/>* you have now installed MPPE support.Return to the Installation step which should <br/>* be underside<br/>*<br/>**********************************************************************************<br/><br/>2.Installing the server Program<br/>install the pptpd package from the Debian Project:<br/> # apt-get install pptpd<br/><br/>3.Configure IP Address Range<br/>edit the file /etc/pptpd.conf for the IP address range.<br/>I used nano for Edit configuration files for example:<br/><br/>localip 10.10.11.254<br/>remoteip 10.10.11.245-253<br/><br/>if The ipaddress you should distribute to remote clients just a unaided IP,You should set remoteip using "," separate it  like this :10.10.11.2-234,10.10.11.243<br/><br/>4.Adding Users<br/>configure /etc/ppp/chap-secrets for the accounts<br/>for example:<br/><br/># echo "vpn pptpd 123456 * " >> /etc/ppp/chap-secrets<br/><br/>vpn is the username 123456 is the valid password and * is set For the connection Ipaddress,* mean to any.<br/><br/>Either,use edit tools modify the configuration file /etc/ppp/chap-secrets directly<br/><br/>5.restart pptpd<br/># /etc/init.d/pptpd restart<br/><br/>6.clients Setting<br/>I just configure the test client on Microsoft system.<br/>When I build it and Attempt a connection to server.on successful connection and a new interface<br/>should be created(e.g. ppp0).and the remoteIP address of the interface should be pingable,if so,<br/>the rest of your problems are likely  to be routing.<br/><br/>1).open control panel and click it to the network and internet connection.<br/>2).add a new connection.the method of connection set to vpn.<br/>3).follow the setup input your correctly username and password.<br/>4).after build the icon of connection,set the properies of network,set the type of vpn to pptp vpn<br/>5).set the properties of security .use custom set for high section.<br/>   modify the encryption of data type to not encryption.</font>]]></description><category>工作笔记</category><comments>http://www.yxyr.com/post/344.html#comment</comments><wfw:comment>http://www.yxyr.com/xml-rpc/comment.asp?id=344</wfw:comment><wfw:commentRss>http://www.yxyr.com/cmd.asp?act=rss&amp;id=344</wfw:commentRss><trackback:ping>http://www.yxyr.com/cmd.asp?act=tb&amp;id=344</trackback:ping></item></channel></rss>
