﻿<?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>学习日记 &#187; 开发问题</title>
	<atom:link href="https://www.softwareace.cn/?cat=4&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>漫画告诉你什么是《屎一样的代码》</title>
		<link>https://www.softwareace.cn/?p=1730</link>
		<comments>https://www.softwareace.cn/?p=1730#comments</comments>
		<pubDate>Wed, 31 Jan 2018 09:10:22 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1730</guid>
		<description><![CDATA[前言 本文来自朋友的系列漫画投稿，程序员单身（不客气），他的博客： http://www.jianshu.co [&#8230;]]]></description>
				<content:encoded><![CDATA[<h1 id="前言" style="color: #4f4f4f;">前言</h1>
<p style="color: #4f4f4f;">本文来自朋友的系列漫画投稿，程序员单身（不客气），他的博客：<br />
<a style="color: #6795b5;" href="http://www.jianshu.com/u/2d46948e84e3" target="_blank">http://www.jianshu.com/u/2d46948e84e3</a></p>
<h1 id="正文开始" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t1"></a>正文开始</h1>
<h1 id="代码交接" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t2"></a>代码交接</h1>
<p style="color: #4f4f4f;"><img title="" src="http://upload-images.jianshu.io/upload_images/1743111-2ce6dca6a246d0ae.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image" /></p>
<h1 id="代码重构" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t3"></a>代码重构</h1>
<p style="color: #4f4f4f;"><img title="" src="http://upload-images.jianshu.io/upload_images/1743111-86c7d8a1f838d5b0.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image" /></p>
<h1 id="codereview" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t4"></a>CodeReview</h1>
<p style="color: #4f4f4f;"><img title="" src="http://upload-images.jianshu.io/upload_images/1743111-0d914d8d968aa69a.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image" /></p>
<h1 id="提测" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t5"></a>提测</h1>
<p style="color: #4f4f4f;"><img title="" src="http://upload-images.jianshu.io/upload_images/1743111-998205f743a50f9b.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image" /></p>
<h1 id="插播" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t6"></a>插播</h1>
<p style="color: #4f4f4f;">经典技术书籍打包下载（全免费，内附地址）<br />
下载地址：<br />
<a style="color: #6795b5;" href="http://www.jianshu.com/p/4a9599a230af" target="_blank">http://www.jianshu.com/p/4a9599a230af</a>)</p>
<h1 id="这段代码我写了三天" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t7"></a>这段代码我写了三天</h1>
<p style="color: #4f4f4f;"><img title="" src="http://upload-images.jianshu.io/upload_images/1743111-14405c3b95f31537.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image" /></p>
<h1 id="要集成测试了" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t8"></a>要集成测试了</h1>
<p style="color: #4f4f4f;"><img title="" src="http://upload-images.jianshu.io/upload_images/1743111-cd8610d8501bbdf8.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image" /></p>
<h1 id="我要重构的类有-5000-行" style="color: #4f4f4f;"><a style="font-weight: 400; color: #4ea1db;" name="t9"></a>我要重构的类有 5000 行！</h1>
<p style="color: #4f4f4f;"><img title="" src="http://upload-images.jianshu.io/upload_images/1743111-8c80e780eaa02ad8.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image" /></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1730</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer can’t find apache2ctl</title>
		<link>https://www.softwareace.cn/?p=1714</link>
		<comments>https://www.softwareace.cn/?p=1714#comments</comments>
		<pubDate>Mon, 08 Jan 2018 10:46:17 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1714</guid>
		<description><![CDATA[yum -y install httpd httpd-devel]]></description>
				<content:encoded><![CDATA[<p>yum -y install httpd httpd-devel</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1714</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>瑞星劫持浏览器主页分析</title>
		<link>https://www.softwareace.cn/?p=1622</link>
		<comments>https://www.softwareace.cn/?p=1622#comments</comments>
		<pubDate>Mon, 10 Apr 2017 09:01:49 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1622</guid>
		<description><![CDATA[一 现象 最近打开IE浏览器，发现地址栏是锁定的默认主页，但是显示的网页内容确是瑞星安全导航。 通过分析，发现 [&#8230;]]]></description>
				<content:encoded><![CDATA[<h2 style="color: #373838;">一 现象</h2>
<p style="color: #585858;">最近打开IE浏览器，发现地址栏是锁定的默认主页，但是显示的网页内容确是瑞星安全导航。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/149122597972.png" target="_blank"><img src="http://image.3001.net/images/20170403/149122597972.png!small" alt="xianxiang.png" width="690" data-original="http://image.3001.net/images/20170403/149122597972.png!small" /></a></p>
<p style="color: #585858;">通过分析，发现瑞星是通过在驱动层注册进程回调，在应用层启动服务监控创建的进程，当发现浏览器启动，且打开的网址是劫持网址，会对浏览器默认主页进行劫持。</p>
<h2 style="color: #373838;">二 分析</h2>
<h3 style="color: #0070c0;">(1) 进程监控分析</h3>
<p style="color: #585858;">重点分析了一下瑞星服务进程ravmond的进程回调处理函数ExeMonCallBack，其关键部分如下</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912132412321.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912132412321.png!small" alt="ExeMon1.png" width="690" data-original="http://image.3001.net/images/20170403/14912132412321.png!small" /></a></p>
<p style="color: #585858;">首先通过驱动层上报的进程启动信息去获取一些关键信息，通过ProcessID获取父进程的全路径，通过Process的全路径去获取当前启动的进程是否是需要劫持的浏览器进程。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912146996031.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912146996031.png!small" alt="exemon2.png" width="690" data-original="http://image.3001.net/images/20170403/14912146996031.png!small" /></a></p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912147938681.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912147938681.png!small" alt="exemon3.png" width="690" data-original="http://image.3001.net/images/20170403/14912147938681.png!small" /></a></p>
<p style="color: #585858;">如图，我们看到ravmond基本劫持了常用的所有浏览器，且设置了一个开关，在开关开启的时候对type为10，10000，20000000的浏览器不做劫持，对应的浏览器分别为IE，QQ浏览器，juzi浏览器。通过调试发现目前开关并没有打开。</p>
<p style="color: #585858;">之后通过一个Event事件来防止重入。Event事件的名字格式为{RsDrvmcl_sessionid_browsertype} 例如主动打开IE浏览器，Event的名称为{RsDrvmcl_1_00000010}，在执行劫持操作时创建event，在获取到浏览器类型成功后去打开event，如果打开成功，说明当前正在对该浏览器主页做劫持，本次打开不做处理。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912158725405.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912158725405.png!small" alt="exemon4.png" width="690" data-original="http://image.3001.net/images/20170403/14912158725405.png!small" /></a></p>
<p style="color: #585858;">如果当前启动的进程是目标浏览器进程，ravmond会对当前进程的命令行以及父进程做是否需要劫持判断，对命令行的判断主要分为三步：</p>
<blockquote style="color: #585858;"><p>1，当前浏览器打开的URL是否为Rising导航，如果是不做劫持。</p>
<p>2，当前浏览器打开的URL是否为特定的hao123带渠道导航，如果是不做劫持。</p>
<p>3，当前浏览器打开的URL是否在预置的导航网址列表中，如果是开始劫持。</p></blockquote>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912175594301.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912175594301.png!small" alt="exemonurl1.png" width="690" data-original="http://image.3001.net/images/20170403/14912175594301.png!small" /></a></p>
<p style="color: #585858;">通过dump内存看到，瑞星预置的劫持导航将近100条，里面不仅包含用户常用的主流导航（hao123 baidu 搜狗导航 360导航 2345导航 QQ导航），还包含大量的小导航，以及跳转站例如123.dh136.com，123.hao245.com等等。除了对导航网址进行判断以外，还对常见的桌面快捷方式打开参数等进行了劫持，如下图所示。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912172759334.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912172759334.png!small" alt="exemoncmd1.png" width="690" data-original="http://image.3001.net/images/20170403/14912172759334.png!small" /></a></p>
<p style="color: #585858;">主页劫持只针对由explorer kdesk qmlaunch mxstart进程启动的浏览器生效。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912186962017.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912186962017.png!small" alt="exemonwork.png" width="690" data-original="http://image.3001.net/images/20170403/14912186962017.png!small" /></a></p>
<p style="color: #585858;">在上述条件都满足的情况下，创建一个线程启动假的浏览器</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912188162006.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912188162006.png!small" alt="exemongetpath.png" width="690" data-original="http://image.3001.net/images/20170403/14912188162006.png!small" /></a></p>
<p style="color: #585858;">线程函数里面主要做了两部分的工作，一部分是通过浏览器类型去获取对应的假浏览器路径，一部分是创建进程。</p>
<p style="color: #585858;">通过分析，可以发现各浏览器对应的假浏览器进程如下</p>
<blockquote style="color: #585858;"><p>360chrome.exe =&gt; wsafechb.exe</p>
<p>360se.exe =&gt; wsafetqa.exe</p>
<p>qqbrowser.exe =&gt; wsafesdb.exe</p>
<p>SogouExplorer.exe =&gt; wsafeeid.exe</p>
<p>liebao.exe =&gt; wsafeche.exe</p>
<p>Maxthon.exe =&gt; wsafesda.exe</p>
<p>UCBrowser.exe =&gt; wsafechc.exe</p>
<p>chrome.exe =&gt; wsafea.exe</p>
<p>iexplore.exe =&gt; wsafeei.exe</p>
<p>…</p></blockquote>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/1491219904626.png" target="_blank"><img src="http://image.3001.net/images/20170403/1491219904626.png!small" alt="exemoncp.png" width="690" data-original="http://image.3001.net/images/20170403/1491219904626.png!small" /></a></p>
<p style="color: #585858;">Vista以后操作系统增加了session隔离机制，一个用户对应一个独立的session,服务程序运行在session0当中，用户程序运行在session1 session2…里面，由于当前是在服务进程中，要从服务中启动一个具有桌面UI交互的应用，需要使用CreateProcessAsUser，并手动设置环境块。</p>
<h3 style="color: #0070c0;">(2) 浏览器劫持分析</h3>
<p style="color: #585858;">浏览器劫持主要是通过使用假浏览器进程创建一个webbrowser替换掉原有的webbrowser来实现的，我以IE浏览器为例来分析。</p>
<p style="color: #585858;">在满足劫持条件后，瑞星服务程序会启动一个假的浏览器进程，IE对应的是wsafeei.exe。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912241287162.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912241287162.png!small" alt="ws1.png" width="690" data-original="http://image.3001.net/images/20170403/14912241287162.png!small" /></a></p>
<p style="color: #585858;">wsafeei.exe首先先创建一个名字为AXWIN Frame Window的窗口。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912242103069.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912242103069.png!small" alt="ws2.png" width="690" data-original="http://image.3001.net/images/20170403/14912242103069.png!small" /></a></p>
<p style="color: #585858;">然后以新建窗口为父窗口，创建一个webbrowser，并创建线程将新创建的窗口替换到IE中。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912244419930.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912244419930.png!small" alt="ws3.png" width="690" data-original="http://image.3001.net/images/20170403/14912244419930.png!small" /></a></p>
<p style="color: #585858;">线程中循环等待IE界面出现，并获取IE的”Frame Tab” “TabWindowClass” “Shell DocObject View”三个窗口的句柄，如果9秒内IE没有启动，则放弃劫持。</p>
<p style="color: #585858;"><a class="highslide-image" style="color: #069aef;" href="http://image.3001.net/images/20170403/14912247324506.png" target="_blank"><img src="http://image.3001.net/images/20170403/14912247324506.png!small" alt="ws4.png" width="690" data-original="http://image.3001.net/images/20170403/14912247324506.png!small" /></a></p>
<p style="color: #585858;">将wsafeei创建的窗口的父窗口设置为TabWindowClass，获取TabWindowClass的位置以及大小，对应设置 wsafeei创建的窗口为对应的位置和大小，将IE的ShellDocObjectVIew窗口隐藏掉，显示wsafeei创建的窗口，对应的webbrowser打开瑞星导航。为了不影响IE的正常使用，其注册了消息过滤函数，处理IE相关的消息。</p>
<p style="color: #585858;">到此为止，就成功的劫持掉了IE的默认主页。</p>
<h2 style="color: #373838;">三 结论</h2>
<p style="color: #585858;">通过在服务进程中监控进程启动，替换浏览器的窗口来劫持主页，可以避免与主页保护软件的正面对抗，达到劫持效果，思路令人佩服。如果用在正规的主页保护技术上那就更好了。</p>
<p style="color: #585858;">http://www.freebuf.com/articles/web/131156.html</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1622</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phurl  iis 伪静态</title>
		<link>https://www.softwareace.cn/?p=1477</link>
		<comments>https://www.softwareace.cn/?p=1477#comments</comments>
		<pubDate>Tue, 02 Aug 2016 06:54:41 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1477</guid>
		<description><![CDATA[新建 web.config [crayon-69e3cad1e68f8420932676/] &#160; 放 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>新建 web.config</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;configuration&gt;
    &lt;system.webServer&gt;
&lt;rewrite&gt;
  &lt;rules&gt;
    &lt;rule name="rule-one" stopProcessing="true"&gt;
      &lt;match url="/?(.*)" ignoreCase="false" /&gt;
      &lt;conditions&gt;
        &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /&gt;
        &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /&gt;
      &lt;/conditions&gt;
      &lt;action type="Rewrite" url="redirect.php?alias={R:1}" appendQueryString="false" /&gt;
    &lt;/rule&gt;
  &lt;/rules&gt;
&lt;/rewrite&gt;
    &lt;/system.webServer&gt;
&lt;/configuration&gt;</pre><p>&nbsp;</p>
<p>放在 phurl 根目录即可｛前提需要空间支持伪静态｝</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1477</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install DirectX SDK (June 2010) failed with error code S1023</title>
		<link>https://www.softwareace.cn/?p=1448</link>
		<comments>https://www.softwareace.cn/?p=1448#comments</comments>
		<pubDate>Thu, 10 Mar 2016 08:07:31 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1448</guid>
		<description><![CDATA[环境：64位,win7 问题：安装DirectX SDK (June 2010)失败 I was trying [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>环境：64位,win7</p>
<p>问题：安装DirectX SDK (June 2010)失败</p>
<p>I was trying to install Direct SDK (June 2010), everything went just fine, but when the installation started to do some post installation processes, it returned with an error like this:</p>
<p><img src="http://img.blog.csdn.net/20150418114632921" alt="" /></p>
<blockquote><p>Setup failed.</p>
<p>Errors were encountered during installation of redistributable packages. Please close all open programs and try running setup again. If problems persist, contact DirectX Developer Support.</p>
<p>Error Code: S1023</p></blockquote>
<p>I have tried looking in the log files in C:\Windows\Logs. There are 2 log files, DirectX.log and DirectX_SDK.log. I do not see any noticeable signs of “error” or “failure” of any kind.</p>
<p>In fact, the very last line in DirectX.log is:</p>
<p>dsetup32: Installation ended with value 0 = Installation succeeded</p>
<p>However the installation did fail. When I re-installed it for a second time, then finally found out that maybe has something to do with the VC 2010 redistributable run-time library. So I uninstalled it. and redo the installation for a third time, it installed perfectly.</p>
<p>So put it in a simple way, Solution for this issue:</p>
<p><strong><span style="color: #0000ff;">go to Control Panel&gt;Program &amp; Features and uninstall programs like this:</span><br />
<span style="color: #0000ff;">Microsoft Visual C++ 2010 x86/x64 redistributable – 10.0.(number over 30319)</span></strong></p>
<p>汉语就是：卸载控制面板-&gt;程序-&gt;Microsoft Visual C++ 2010 x86/x64 redistributable – 10.0.30319</p>
<p>不用卸载额外的Microsoft Visual C++ 2010 x86 Runtime,虽然很像</p>
<p><span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #0000ff;"><span style="color: #000000;">转自：http://rg4.net/archives/851.html</span></span></span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1448</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>获取外网IP</title>
		<link>https://www.softwareace.cn/?p=1440</link>
		<comments>https://www.softwareace.cn/?p=1440#comments</comments>
		<pubDate>Wed, 24 Feb 2016 12:44:39 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1440</guid>
		<description><![CDATA[https://api.ipify.org/ https://api.ipify.org/?format=js [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>https://api.ipify.org/</p>
<p>https://api.ipify.org/?format=json</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1440</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>git-svn — 让git和svn协同工作</title>
		<link>https://www.softwareace.cn/?p=1437</link>
		<comments>https://www.softwareace.cn/?p=1437#comments</comments>
		<pubDate>Tue, 23 Feb 2016 08:35:46 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1437</guid>
		<description><![CDATA[svn作为一个优秀源码版本的管理工具，可以适合绝大多数项目。但是因为它的采用中心化管理，不可避免的存在本地代码 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="color: #375362;">svn作为一个优秀源码版本的管理工具，可以适合绝大多数项目。但是因为它的采用中心化管理，不可避免的存在本地代码的备份和版本管理问题。也就是说对于尚未或暂无法提交到Subversion服务器的本地代码来说，存在着被误删除和版本更新无法回退两大情形。</p>
<p style="color: #375362;">git作为一个分布式版本管理工具，可以很好的解决这个问题。因为它的大多数操作是在本地进行的。这里要说的是git是如何做到既可以管理好本地代码又可以与已有的SVN中心库进行同步的。</p>
<p style="color: #375362;"><span id="more-3306"></span>支持去中心化，是Git与生俱来的特性，它在本地保留了从中心服务器clone出来的源码库的全部信息，这样，你在本地修改完代码后便可以直接提交到本地 的代码版本库中。本地代码的备份和版本管理的问题就这样被Git轻而一举的就解决了。而本地源码库与SVN中心源码库的同步操作则是由Git提供的 git-svn工具来完成的。</p>
<p style="color: #375362;"><strong>下面是一个git-svn的一般使用流程：</strong><br />
1、<strong>git-svn clone</strong> svn_repository<br />
2、修改本地代码，使用git add/commit将修改提交到本地git库<br />
3、定期使用<strong>git-svn rebase</strong>获取中心svn repository的更新<br />
4、使用<strong>git-svn dcommit</strong>命令将本地git库的修改同步到中心svn库</p>
<ul style="color: #375362;">
<li>检出一个已存在svn repository(类似于svn checkout)</li>
</ul>
<p style="color: #375362;">可以通过git-svn clone命令完成这个操作： git-svn clone svn_repository_url</p>
<p style="color: #375362;">一般情况下git svn clone这个操作会从第一个版本开始同步，如果版本号已经到了好几万（或更高？），这个操作会相当的费时。这时可以使用参数-r$REVNUMBER:HEAD检出指定版本后的代码。</p>
<p style="color: #375362;">因此，更好的步骤应该是这样：</p>
<p style="color: #375362;">svn info svn_repository_url, 记录最后的版本号，假设是260</p>
<p style="color: #375362;">假设要检出最后5个版本，做个简单的减法： 260 – 5 = 255</p>
<p style="color: #375362;">开始clone操作了：git-svn clone -r255:HEAD svn_repository_url</p>
<ul style="color: #375362;">
<li>从中心服务器的svn repository获取最新更新</li>
</ul>
<p style="color: #375362;">这个操作可以通过”git-svn rebase”完成。注意这里用的是rebase，而不是update。update命令对于通过git-svn检出的svn repostory的git版本库是不可用的。</p>
<ul style="color: #375362;">
<li>查看提交历史日志</li>
</ul>
<p style="color: #375362;">使用”git-svn log”，加上-v选项，还可以提供每次commit操作涉及的相关文件的详细信息。</p>
<ul style="color: #375362;">
<li>将本地代码同步到Svn服务器</li>
</ul>
<p style="color: #375362;">完成这一操作需要通过”git-svn dcommit”命令。这个命令会将你在本地使用git commit提交到本地代码库的所有更改逐一提交到svn库中。加上-n选项，则该命令不会真正执行commit到svn的操作，而是会显示会有哪些本地 变动将被commit到svn服务器。git-svn dcommit似乎不能单独提交某个本地版本的修改，而是一次批量提交所有与svn中心版本库的差异。</p>
<ul style="color: #375362;">
<li>提交时的冲突解决：</li>
</ul>
<p style="color: #375362;">如果你正在提交的文件在svn服务器上已经被别人改过，就会发生提交冲突。通常解决方法如下：</p>
<p style="color: #375362;">首先使用git-svn rebase获取svn服务器上的最新冲突文件，比如：conflict.c，这将导致与本地conflict.c冲突，不过此时svn版本信息已经添加到本地git库中(通过git log可以查看)，git-svn rebase提示你在解决conflict.c的冲突后，运行git rebase –continue完成rebase操作</p>
<p style="color: #375362;">打开conflict.c，修改代码，解决冲突</p>
<p style="color: #375362;">执行git rebase –continue，git提示：You must edit all merge conflicts and then mark them as resolved using git add</p>
<p style="color: #375362;">执行git add conflict.c，告知git已完成冲突解决</p>
<p style="color: #375362;">再次执行git rebase –continue，提示”Applying: git xxx”，此时”git xxx”版本又一次成功加入本地版本库，可通过git log查看；</p>
<p style="color: #375362;">执行git-svn dcommit将conflict.c的改动同步到svn中心库，到此算是完成一次冲突解决。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1437</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fatal error C1083: 无法打开预编译头文件:“Debug\xx.pch”: No such file or directory</title>
		<link>https://www.softwareace.cn/?p=1422</link>
		<comments>https://www.softwareace.cn/?p=1422#comments</comments>
		<pubDate>Wed, 06 Jan 2016 07:49:06 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1422</guid>
		<description><![CDATA[stdafx.cpp右键——属性，预编译头选“创建”，其它cpp选“使用”。]]></description>
				<content:encoded><![CDATA[<p>stdafx.cpp右键——属性，预编译头选“创建”，其它cpp选“使用”。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1422</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>执行Git命令时出现各种 SSL certificate problem 的解决办法</title>
		<link>https://www.softwareace.cn/?p=1378</link>
		<comments>https://www.softwareace.cn/?p=1378#comments</comments>
		<pubDate>Fri, 07 Aug 2015 06:18:07 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1378</guid>
		<description><![CDATA[比如我在windows下用git clone gitURL 就提示  SSL certificate prob [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>比如我在windows下用git clone gitURL</p>
<p>就提示  SSL certificate problem: self signed certificate</p>
<p>这种问题，在windows下出现得频率高些。我估计主要是git本身就是基于linux开发的，在windows上，容易缺失一些环境。</p>
<p>参考了一些文章，解决方法其实就是“直接不管ssl证书的事儿”-_-|||</p>
<p>方法如下：</p>
<p>1.创建临时环境变量：</p>
<p>windows上命令行输入：</p>
<div class="dp-highlighter bg_plain">
<div class="bar"></div>
<ol style="color: #5c5c5c;" start="1">
<li class="alt" style="color: inherit;"><span style="color: black;">set GIT_SSL_NO_VERIFY=true git clone  </span></li>
</ol>
</div>
<p>Linux下：</p>
<div class="dp-highlighter bg_plain">
<div class="bar"></div>
<ol style="color: #5c5c5c;" start="1">
<li class="alt" style="color: inherit;"><span style="color: black;">env GIT_SSL_NO_VERIFY=true git push  </span></li>
</ol>
</div>
<p>这里clon可以根据需要换成其他的git命令。</p>
<p>也可以把临时环境变量变为永久的，反正永远不验证ssl证书也没什么风险吧。。。</p>
<p>&nbsp;</p>
<p>2.用git自带的配置命令：</p>
<div class="dp-highlighter bg_plain">
<div class="bar"></div>
<ol style="color: #5c5c5c;" start="1">
<li class="alt" style="color: inherit;"><span style="color: black;">git config &#8211;global http.sslVerify false  </span></li>
</ol>
</div>
<p>问题解决。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1378</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>int、long、long long取值范围</title>
		<link>https://www.softwareace.cn/?p=1335</link>
		<comments>https://www.softwareace.cn/?p=1335#comments</comments>
		<pubDate>Tue, 26 May 2015 02:36:50 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[开发问题]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=1335</guid>
		<description><![CDATA[unsigned   int   0～4294967295 int   -2147483648～2147483 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="color: #454545;">unsigned   int   0～4294967295<br />
int   -2147483648～2147483647<br />
unsigned long 0～4294967295<br />
long   -2147483648～2147483647<br />
long long的最大值：9223372036854775807<br />
long long的最小值：-9223372036854775808<br />
unsigned long long的最大值：1844674407370955161</p>
<p style="color: #454545;">__int64的最大值：9223372036854775807<br />
__int64的最小值：-9223372036854775808<br />
unsigned __int64的最大值：18446744073709551615</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=1335</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
