??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品狼人久久久久影院,久久国产免费直播,欧美精品九九99久久在观看http://m.shnenglu.com/polly-yang/category/16832.htmlzh-cnMon, 30 Jul 2012 11:57:12 GMTMon, 30 Jul 2012 11:57:12 GMT60vs + opencv 常见错误http://m.shnenglu.com/polly-yang/archive/2012/07/30/185613.htmlpollypollyMon, 30 Jul 2012 03:57:00 GMThttp://m.shnenglu.com/polly-yang/archive/2012/07/30/185613.htmlhttp://m.shnenglu.com/polly-yang/comments/185613.htmlhttp://m.shnenglu.com/polly-yang/archive/2012/07/30/185613.html#Feedback0http://m.shnenglu.com/polly-yang/comments/commentRss/185613.htmlhttp://m.shnenglu.com/polly-yang/services/trackbacks/185613.htmlA:应将解决Ҏq_改ؓwin64?br />工具栏上方的解决Ҏq_—》点M拉菜?#8212;》配|管理器—》活动解x案^?#8212;》新?#8212;》键入获选着新^?#8212;》x64
问题p军_Q哈哈!



QQError C1189 Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
A:Go to the project properties (Project menu, Properties).  Set 'Use of MFC' to "Use MFC in a Shared DLL".  You have to make this change for both the debug and release configurations

polly 2012-07-30 11:57 发表评论
]]>
CString ?string ?const char*、int、double之间的相互{?/title><link>http://m.shnenglu.com/polly-yang/archive/2012/07/24/184890.html</link><dc:creator>polly</dc:creator><author>polly</author><pubDate>Tue, 24 Jul 2012 12:34:00 GMT</pubDate><guid>http://m.shnenglu.com/polly-yang/archive/2012/07/24/184890.html</guid><wfw:comment>http://m.shnenglu.com/polly-yang/comments/184890.html</wfw:comment><comments>http://m.shnenglu.com/polly-yang/archive/2012/07/24/184890.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/polly-yang/comments/commentRss/184890.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/polly-yang/services/trackbacks/184890.html</trackback:ping><description><![CDATA[<p><span style="font-family: Times New Roman; font-size: 14pt">我们在写E序Ӟ常常会遇到类型{换的问题。现ȝ一些常见的cd转换?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">1Qconst char*QC风格字符Ԍ与string之间转换Q?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">             Q?Q?const char*可以直接对stringcd赋|例如Q?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">                       const char* pchar = "qwerasdf";</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">                       stringstr = pchar;</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">             Q?Q?string通过c_str()函数转换为C风格字符Ԍ例如Q?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">                       string str = "qwerasdf";</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">                       const char* pchar = str.c_str();</span></p> <p><span style="font-size: 18px"></span> </p> <p><span style="font-family: Times New Roman; font-size: 14pt">2Qconst char*cd可以直接lCStringcd赋|例如Q?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">               const char* pchar = "qwerasdf";</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">               CString str = pchar;</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">3Qstringcd变量转ؓ为Cstringcd变量</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">             CStringcd变量可以直接lstringcd变量赋|但是stringcd不能对CStringcd直接赋倹{通过前两c?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">      转换我们可以得到Q?/span><span style="font-family: Times New Roman; font-size: 14pt">stringcd变量转换为const char*cdQ然后再直接赋值就可以了。例如:</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">       CString cstrQ?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">       sring str = “asdasd”Q?/span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">       cstr = str.c_str();</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">      同理QCStrngcd变量先{换ؓstringcd在调用c_str()函数可以完成向</span><span style="font-family: Times New Roman; font-size: 14pt">const char*cd的{换。例如:</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">      CString cStr = "adsad";</span><span style="font-size: 18px">   </span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">      string str = cStr;  </span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">      const char* pchar = str.c_str();<br /></span><span style="font-family: Times New Roman; font-size: 14pt">4QdoubleQint转string<br /></span></p> <p><span style="font-size: 18px"></span>      <span style="font-family: Times New Roman; font-size: 14pt">double temp;</span><br />   <span style="font-family: Times New Roman; font-size: 14pt">stringstream strStream;</span><br />   <span style="font-family: Times New Roman; font-size: 14pt">strStream<<temp;</span><br />   <span style="font-family: Times New Roman; font-size: 14pt">string ss = strStream.str()</span> <br /><br /><span style="font-family: Times New Roman; font-size: 14pt">   string 转doubleQint </span><br /><span style="font-family: Times New Roman; font-size: 14pt">   string.atoi   ,   string.atof</span></p> <p><span style="font-family: Times New Roman; font-size: 14pt">     从上面我们可以上面看出,通过cd之间的相互{化,会本来要通过复杂的函数来完成的类型{换变得简单易懂?/span></p><img src ="http://m.shnenglu.com/polly-yang/aggbug/184890.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/polly-yang/" target="_blank">polly</a> 2012-07-24 20:34 <a href="http://m.shnenglu.com/polly-yang/archive/2012/07/24/184890.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个容易上手的XML解析器TinyXmlhttp://m.shnenglu.com/polly-yang/archive/2012/07/24/184820.htmlpollypollyTue, 24 Jul 2012 00:17:00 GMThttp://m.shnenglu.com/polly-yang/archive/2012/07/24/184820.htmlhttp://m.shnenglu.com/polly-yang/comments/184820.htmlhttp://m.shnenglu.com/polly-yang/archive/2012/07/24/184820.html#Feedback0http://m.shnenglu.com/polly-yang/comments/commentRss/184820.htmlhttp://m.shnenglu.com/polly-yang/services/trackbacks/184820.htmld和设|?/span>xml配置文g是最常用的操作,试用了几?/span>C++?/span>XML解析器,个h感觉TinyXML是用v来最舒服的,因ؓ它的API接口?/span>Java的十分类|面向对象性很好?/span>

TinyXML是一个开源的解析XML的解析库Q能够用?/span>C++Q能够在Windows?/span>Linux中编译。这个解析库的模型通过解析XML文gQ然后在内存中生?/span>DOM模型Q从而让我们很方便的遍历q棵XML树?/span>

DOM模型x对象模型,是将整个文档分成多个元素Q如书、章、节、段{)Qƈ利用树型l构表示q些元素之间的顺序关pM及嵌套包含关pR?br />    不过TinyXml需要用者手动释放new出的内存。初学C++者往往Ҏ造成内存泄露?/span>



polly 2012-07-24 08:17 发表评论
]]>
GetWindowRect与GetClientRect的区?/title><link>http://m.shnenglu.com/polly-yang/archive/2012/02/13/165507.html</link><dc:creator>polly</dc:creator><author>polly</author><pubDate>Mon, 13 Feb 2012 12:01:00 GMT</pubDate><guid>http://m.shnenglu.com/polly-yang/archive/2012/02/13/165507.html</guid><wfw:comment>http://m.shnenglu.com/polly-yang/comments/165507.html</wfw:comment><comments>http://m.shnenglu.com/polly-yang/archive/2012/02/13/165507.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/polly-yang/comments/commentRss/165507.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/polly-yang/services/trackbacks/165507.html</trackback:ping><description><![CDATA[<p><font color="#0000ff">先调用GetWindowRect后再调用ScreenToClient,q个时候得到的rect和直接用GetClientRect得到的值是相等的。有时候需要获得窗口矩形的大小和客户区矩Ş的大二者的|故需要分别调用GetWindowRect和GetClientRect。如果只需要获得客户区矩Ş的大,调用GetClientRectp了?font size="3">GetWindowRect</font>和GetClientRect函数的说明如下:</font></p> <p><strong>CWnd::GetClientRect</strong> <wbr> <wbr><br /> <wbr> <wbr> <wbr> void GetClientRect( LPRECT lpRect ) const;<br /><em><strong>Parameters:</strong><br />lpRect<br /></em> <wbr> <wbr> <wbr> Points to a RECT structure or a CRect object to receive the client coordinates. The left and top members will be 0. The right and bottom members will contain the width and height of the window.<br /><em>Remarks:</em><br /> <wbr> <wbr> <wbr> Copies the client coordinates of the CWnd client area into the structure pointed to by lpRect. The client coordinates specify the upper-left and lower-right corners of the client area. Since client coordinates are relative to the upper-left corners of the CWnd client area, the coordinates of the upper-left corner are (0,0).</p> <p><strong>CWnd::GetWindowRect</strong><br />void GetWindowRect( LPRECT lpRect ) const;<br /><em>Parameters:</em><br /><em>lpRect</em><br />Points to a CRect object or a RECT structure that will receive the screen coordinates of the upper-left and lower-right corners.<br /><em><strong>Remarks:</strong></em><br />Copies the dimensions of the bounding rectangle of the CWnd object to the structure pointed to by lpRect. The dimensions are given in screen coordinates relative to the upper-left corner of the display screen. The dimensions of the caption, border, and scroll bars, if present, are included.</p> <p><font color="#ff0000">GetWindowRect() 得到的是在屏q坐标系下的RECTQ(<font color="#800000">即以屏幕左上角ؓ原点</font>Q?br />GetClientRect() 得到的是在客户区坐标pM的RECTQ?Q?font color="#800000">即以所在窗口左上角为原?/font>Q?br /><br />GetWindowRect()取的是整个窗口的矩ŞQ?br />GetClientRect()取的仅是客户区的矩ŞQ也是说不包括标题栏,外框{;</font></p> <p><font color="#ff0000">W一个函数获得的是窗口在屏幕上的位置Q得到的l果可能是这样CRect(10,10,240,240);<br />W二个函数和它不同,它只获得了客户区的大,因此得到的结果Lq样CRect(0,0,width,height);</font></p> <p><font color="#ff0000">ScreenToClient() 是把屏q坐标系下的RECT坐标转换为客户区坐标pM的RECT坐标?/font></p> <p><font color="#3366ff"><font color="#0000ff">The GetClientRect function retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).</font></font></p> <p><font color="#ff0000">GetClientRect得到的是客户区的大小Q也是说这样得到的左上角永q是Q?Q?Q?/font></p> <p><font color="#0000ff">The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.</font></p> <p><font color="#ff0000">GetWindowRect 是窗口相对于整个屏幕的坐标,屏幕左上点ؓ0Q?</font></p> <p><font color="#ff0000">怺转化用ScreenToClient 或?ClientToScreen</font></p> <p><strong>ClientToScreen</strong><br />The ClientToScreen function converts the client coordinates of a specified point to screen coordinates.<br /><em>BOOL ClientToScreen(<br /> <wbr> <wbr> HWND hWnd, <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> // window handle for source coordinates<br /> <wbr> <wbr> LPPOINT lpPoint <wbr> <wbr> // pointer to structure containing screen coordinates<br />);</em><br /><em><strong>Parameters</strong></em><br /><em>hWnd</em><br />Handle to the window whose client area is used for the conversion.<br /><em>lpPoint<br /></em>Pointer to a POINT structure that contains the client coordinates to be converted. The new screen coordinates are copied into this structure if the function succeeds.<br /><em><strong>Return Values</strong></em><br />If the function succeeds, the return value is nonzero.<br /><font color="#3366ff"><font color="#000000">If the function fails, the return value is zero.<br /></font></font><font color="#3366ff"><font color="#0000ff">虽然存在调用GetWindowRect后再调用ScreenToClient==GetClientRectQ但ScreenToClientQ)和ClientToScreen()两者都是属于WINDOWS API函数Q可能是存在一定的冗余设计Q但意义不同?br />不过?Net Framework下对WINDOWS API函数q行了重新整理和优化Q在获取控g或窗口的屏幕坐标和客户区坐标时更方便的多Q只需要得C控g或窗口相对应屏幕坐标和客户区坐标属性值就可以?/font>?/font></p><font color="#7c7c7c"><strong>ScreenToClient</strong><br />The ScreenToClient function converts the screen coordinates of a specified point on the screen to client coordinates.<br /></font><font color="#7c7c7c"><em>BOOL ScreenToClient(<br /> <wbr> <wbr> HWND hWnd, <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> <wbr> // window handle for source coordinates<br /> <wbr> <wbr> LPPOINT lpPoint <wbr> <wbr> <wbr> // address of structure containing coordinates<br />);<br /></em><em><strong>ParametersQ?/strong></em><br /></font><font color="#7c7c7c"><em>hWnd<br /></em>Handle to the window whose client area will be used for the conversion.<br /></font><font color="#7c7c7c"><em>lpPoint<br /></em>Pointer to a POINT structure that contains the screen coordinates to be converted.<br /></font><font color="#7c7c7c"><em><strong>Return ValuesQ?br /></strong></em>If the function succeeds, the return value is nonzero.<br />If the function fails, the return value is zero.</font><img src ="http://m.shnenglu.com/polly-yang/aggbug/165507.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/polly-yang/" target="_blank">polly</a> 2012-02-13 20:01 <a href="http://m.shnenglu.com/polly-yang/archive/2012/02/13/165507.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>囑փ~辑http://m.shnenglu.com/polly-yang/archive/2011/10/28/159258.htmlpollypollyFri, 28 Oct 2011 02:08:00 GMThttp://m.shnenglu.com/polly-yang/archive/2011/10/28/159258.htmlhttp://m.shnenglu.com/polly-yang/comments/159258.htmlhttp://m.shnenglu.com/polly-yang/archive/2011/10/28/159258.html#Feedback0http://m.shnenglu.com/polly-yang/comments/commentRss/159258.htmlhttp://m.shnenglu.com/polly-yang/services/trackbacks/159258.html
Pen pen(Color::Black);
int width = abs(m_vecPoint[1].X - m_vecPoint[0].X);
int height = abs(m_vecPoint[1].Y - m_vecPoint[0].Y);
if (width<0||height<0)
{
graphic.DrawRectangle(&pen,m_vecPoint[1].X,m_vecPoint[1].Y,width,height);
}
else{
graphic.DrawRectangle(&pen,m_vecPoint[0].X,m_vecPoint[0].Y,width,height);
}


polly 2011-10-28 10:08 发表评论
]]>
MFC?:在视图中打开囄http://m.shnenglu.com/polly-yang/archive/2011/05/29/147629.htmlpollypollySun, 29 May 2011 08:54:00 GMThttp://m.shnenglu.com/polly-yang/archive/2011/05/29/147629.htmlhttp://m.shnenglu.com/polly-yang/comments/147629.htmlhttp://m.shnenglu.com/polly-yang/archive/2011/05/29/147629.html#Feedback0http://m.shnenglu.com/polly-yang/comments/commentRss/147629.htmlhttp://m.shnenglu.com/polly-yang/services/trackbacks/147629.html1//调用位图,执行E序时打开囄
2    CDC memdc;
3    CBitmap *olddc;
4    CBitmap bitmap;
5    bitmap.LoadBitmap(IDB_BITMAP1);
6    pDC=this->GetDC();
7    memdc.CreateCompatibleDC(pDC);
8    olddc=memdc.SelectObject(&bitmap);
9    pDC->BitBlt(0,0,rect.Width(),rect.Height(),&memdc,0,0,SRCCOPY);当然Q先免不了设|坐标系?img src ="http://m.shnenglu.com/polly-yang/aggbug/147629.html" width = "1" height = "1" />

polly 2011-05-29 16:54 发表评论
]]>
MFCE序?QGDId入门?随机?BitBlt()+CPenhttp://m.shnenglu.com/polly-yang/archive/2011/05/26/147303.htmlpollypollyThu, 26 May 2011 14:43:00 GMThttp://m.shnenglu.com/polly-yang/archive/2011/05/26/147303.htmlhttp://m.shnenglu.com/polly-yang/comments/147303.htmlhttp://m.shnenglu.com/polly-yang/archive/2011/05/26/147303.html#Feedback0http://m.shnenglu.com/polly-yang/comments/commentRss/147303.htmlhttp://m.shnenglu.com/polly-yang/services/trackbacks/147303.html
核心代码如下

 1// TODO: 在此处ؓ本机数据dl制代码
 2    CRect rect;
 3    GetClientRect(&rect);
 4
 5    pDC->SetMapMode(MM_ANISOTROPIC);
 6    pDC->SetWindowExt(100100);//H口逻辑大小Q?000*1000,
 7    pDC->SetViewportExt(100-100);//改变Y坐标方向--viewport使用物理大小
 8    pDC->SetViewportOrg(rect.left, rect.bottom);//讄H口中心点ؓ坐标pd?-Viewport使用物理大小 
 9    CPen PenNew(PS_GEOMETRIC,10,RGB(255,0,0));
10    CPen* pPenOld;
11    pPenOld=pDC->SelectObject(&PenNew);
12    srand((unsigned) time(NULL)); /*播种?/span>*/
13    pDC->MoveTo(50,50);
14    //pDC->LineTo(100,100);
15    for (int i=0;i<5;i++){
16        int x=rand()%500;
17        int y=rand()%500;
18        pDC->LineTo(x,y);
19        pDC->BitBlt(x,y,25,25,NULL,0,0,BLACKNESS);
20
21    }

22    pDC->SelectObject(pPenOld);
23    PenNew.DeleteObject();

Q?/p>

polly 2011-05-26 22:43 发表评论
]]>
MFCE序? 个h所得税计算?/title><link>http://m.shnenglu.com/polly-yang/archive/2011/05/24/147063.html</link><dc:creator>polly</dc:creator><author>polly</author><pubDate>Tue, 24 May 2011 15:15:00 GMT</pubDate><guid>http://m.shnenglu.com/polly-yang/archive/2011/05/24/147063.html</guid><wfw:comment>http://m.shnenglu.com/polly-yang/comments/147063.html</wfw:comment><comments>http://m.shnenglu.com/polly-yang/archive/2011/05/24/147063.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/polly-yang/comments/commentRss/147063.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/polly-yang/services/trackbacks/147063.html</trackback:ping><description><![CDATA[<img border="0" alt="" src="http://m.shnenglu.com/images/cppblog_com/polly-yang/未命?jpg" width="564" longdesc="" height="383" /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080"> 1</span><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #0000ff">void</span><span style="color: #000000">  Cpaytax2Dlg::OnEnChangeEdit1()<br /></span><span style="color: #008080"> 2</span><span style="color: #000000"><img id="Codehighlighter1_37_386_Open_Image" onclick="this.style.display='none'; Codehighlighter1_37_386_Open_Text.style.display='none'; Codehighlighter1_37_386_Closed_Image.style.display='inline'; Codehighlighter1_37_386_Closed_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_37_386_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_37_386_Closed_Text.style.display='none'; Codehighlighter1_37_386_Open_Image.style.display='inline'; Codehighlighter1_37_386_Open_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_37_386_Closed_Text"><img src="http://m.shnenglu.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_37_386_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080"> 3</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000"> TODO:  如果该控件是 RICHEDIT 控gQ则它将不会<br /></span><span style="color: #008080"> 4</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000"> 发送该通知Q除非重?nbsp;CDialog::OnInitDialog()<br /></span><span style="color: #008080"> 5</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000"> 函数q调?nbsp;CRichEditCtrl().SetEventMask()Q?br /></span><span style="color: #008080"> 6</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000"> 同时?nbsp;ENM_CHANGE 标志“?#8221;q算到掩码中?br /></span><span style="color: #008080"> 7</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /></span><span style="color: #008080"> 8</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000"> TODO:  在此d控g通知处理E序代码</span><span style="color: #008000"><br /></span><span style="color: #008080"> 9</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">    CEdit </span><span style="color: #000000">*</span><span style="color: #000000">wEdit1;<br /></span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    wEdit1</span><span style="color: #000000">=</span><span style="color: #000000">(CEdit</span><span style="color: #000000">*</span><span style="color: #000000">)GetDlgItem(IDC_EDIT1);<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000">wEdit1->SetWindowText( "FOO" );<br /></span><span style="color: #008080">12</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000">取?/span><span style="color: #008000"><br /></span><span style="color: #008080">13</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">    CString str;<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    GetDlgItem(IDC_EDIT1)</span><span style="color: #000000">-></span><span style="color: #000000">GetWindowText(str);<br /></span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    temp</span><span style="color: #000000">=</span><span style="color: #000000">atof(str);<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">17</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /><br /></span><span style="color: #008080">18</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">void</span><span style="color: #000000"> Cpaytax2Dlg::OnBnClickedOk()<br /></span><span style="color: #008080">19</span><span style="color: #000000"><img id="Codehighlighter1_423_749_Open_Image" onclick="this.style.display='none'; Codehighlighter1_423_749_Open_Text.style.display='none'; Codehighlighter1_423_749_Closed_Image.style.display='inline'; Codehighlighter1_423_749_Closed_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_423_749_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_423_749_Closed_Text.style.display='none'; Codehighlighter1_423_749_Open_Image.style.display='inline'; Codehighlighter1_423_749_Open_Text.style.display='inline';" align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_423_749_Closed_Text"><img src="http://m.shnenglu.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_423_749_Open_Text"><span style="color: #000000">{<br /></span><span style="color: #008080">20</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000"> TODO: 在此d控g通知处理E序代码</span><span style="color: #008000"><br /></span><span style="color: #008080">21</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">    UpdateData(TRUE);<br /></span><span style="color: #008080">22</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    PayTax paytax(temp);<br /></span><span style="color: #008080">23</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    temp2</span><span style="color: #000000">=</span><span style="color: #000000">paytax.calculate();<br /></span><span style="color: #008080">24</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//<br /></span><span style="color: #008080">25</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">    UpdateData(FALSE);<br /></span><span style="color: #008080">26</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    GetDlgItem(IDC_EDIT1)</span><span style="color: #000000">-></span><span style="color: #000000">SetFocus();<br /></span><span style="color: #008080">27</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    ((CEdit </span><span style="color: #000000">*</span><span style="color: #000000">)GetDlgItem(IDC_EDIT1))</span><span style="color: #000000">-></span><span style="color: #000000">SetSel(</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">,TRUE);<br /></span><span style="color: #008080">28</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /></span><span style="color: #008080">29</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    UpdateData(FALSE);<br /></span><span style="color: #008080">30</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    CString str;<br /></span><span style="color: #008080">31</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    str.Format(</span><span style="color: #000000">"</span><span style="color: #000000">%f</span><span style="color: #000000">"</span><span style="color: #000000">,temp2);<br /></span><span style="color: #008080">32</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    GetDlgItem(IDC_EDIT2)</span><span style="color: #000000">-></span><span style="color: #000000">SetWindowText(str); <br /></span><span style="color: #008080">33</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #008000">//</span><span style="color: #008000">OnOK();</span><span style="color: #008000"><br /></span><span style="color: #008080">34</span><span style="color: #008000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000"><br /></span><span style="color: #008080">35</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span><span style="color: #000000"><br /></span><span style="color: #008080">36</span><span style="color: #000000"><img align="top" src="http://m.shnenglu.com/images/OutliningIndicators/None.gif" alt="" /></span></div> <img src ="http://m.shnenglu.com/polly-yang/aggbug/147063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/polly-yang/" target="_blank">polly</a> 2011-05-24 23:15 <a href="http://m.shnenglu.com/polly-yang/archive/2011/05/24/147063.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>20110518 linux中IO调度法结http://m.shnenglu.com/polly-yang/archive/2011/05/18/146683.htmlpollypollyWed, 18 May 2011 10:32:00 GMThttp://m.shnenglu.com/polly-yang/archive/2011/05/18/146683.htmlhttp://m.shnenglu.com/polly-yang/comments/146683.htmlhttp://m.shnenglu.com/polly-yang/archive/2011/05/18/146683.html#Feedback0http://m.shnenglu.com/polly-yang/comments/commentRss/146683.htmlhttp://m.shnenglu.com/polly-yang/services/trackbacks/146683.html在Linux 2.6?有四U关于IO的调度算?下面l合结一?

1) NOOP

NOOP法的全写ؓNo Operation。该法实现了最最单的FIFO队列Q所有IOh大致按照先来后到的顺序进行操作。之所以说“大致”Q?/p>

原因是NOOP在FIFO的基上还做了盔RIOh的合qӞq不是完完全全按照先q先出的规则满IOh。NOOP假定I/Oh由驱动程序或者设

备做了优化或者重排了序(像一个智能控制器完成的工作那?。在有些SAN环境下,q个选择可能是最好选择。Noop 对于 IO 不那么操

心,Ҏ有的 IOh都用 FIFO 队列形式处理Q默认认?IO 不会存在性能问题。这也?CPU 也不用那么操心?a >www.linuxidc.com当然

Q对于复杂一点的应用cdQ用这个调度器Q用戯己就会非常操心?


2) Deadline scheduler

DEADLINE在CFQ的基上,解决了IOh饿死的极端情c除了CFQ本nh的IO排序队列之外QDEADLINE额外分别IO和写IO提供了FIFO

队列。读FIFO队列的最大等待时间ؓ500msQ写FIFO队列的最大等待时间ؓ5s。FIFO队列内的IOh优先U要比CFQ队列中的高,Q而读FIFO

队列的优先又比写FIFO队列的优先高。优先可以表示如下Q?

FIFO(Read) > FIFO(Write) > CFQ

deadline 法保证对于既定?IO h以最的延迟旉Q从q一点理解,对于 DSS 应用应该会是很适合的?/p>

3) Anticipatory scheduler

CFQ和DEADLINE考虑的焦点在于满零散IOh上。对于连l的IOhQ比如顺序读Qƈ没有做优化。ؓ了满随机IO和顺序IO混合的场景,

Linuxq支持ANTICIPATORY调度法。ANTICIPATORY的在DEADLINE的基上,为每个读IO都设|了6ms 的等待时间窗口。如果在q?ms内OS?/p>

C盔R位置的读IOhQ就可以立即满

Anticipatory schedulerQas) 曄一度是 Linux 2.6 Kernel ?IO scheduler 。Anticipatory 的中文含义是”预料? 预想?#8221;, q个

词的揭CZq个法的特点,单的_有个 IO 发生的时候,如果又有q程h IO 操作Q则生一个默认的 6 毫秒猜测旉Q猜?/p>

下一?q程h IO 是要q什么的。这对于随即d会造成比较大的延时Q对数据库应用很p糕Q而对?Web Server {则会表现的不错?/p>

q个法也可以简单理解ؓ面向低速磁盘的Q因为那?#8221;猜测”实际上的目的是ؓ了减磁头移动时间?/p>

4QCFQ

CFQ法的全写ؓCompletely Fair Queuing。该法的特Ҏ按照IOh的地址q行排序Q而不是按照先来后到的序来进行响应?

在传l的SAS盘上Q磁盘寻道花Ml大多数的IO响应旉。CFQ的出发点是对IO地址q行排序Q以量的盘旋{ơ数来满_可能多的

IOh。在CFQ法下,SAS盘的吞吐量大大提高了。但是相比于NOOP的缺ҎQ先来的IOhq不一定能被满I可能会出现饿ȝ情况?

Completely Fair Queuing Qcfq, 完全公^队列) ?2.6.18 取代?Anticipatory scheduler 成ؓ Linux Kernel 默认?IO scheduler

。cfq Ҏ个进E维护一?IO 队列Q各个进E发来的 IO h会被 cfq 以轮循方式处理。也是Ҏ一?IO h都是公^的。这使得

cfq 很适合Lȝ应用(eg: OLTP DB)。我所知道的企业 Linux 发行版中QSUSE Linux 好像是最先默认用 cfq ?

查看和修改IO调度器的法非常单。假设我们要对sdaq行操作Q如下所C:

cat /sys/block/sda/queue/scheduler

echo “cfq” > /sys/block/sda/queue/scheduler

ȝ:

1 CFQ和DEADLINE考虑的焦点在于满零散IOh上。对于连l的IOhQ比如顺序读Qƈ没有做优化。ؓ了满随机IO和顺序IO混合的场?/p>

QLinuxq支持ANTICIPATORY调度法。ANTICIPATORY的在DEADLINE的基上,为每个读IO都设|了6ms的等待时间窗口。如果在q?ms内OS?/p>

C盔R位置的读IOhQ就可以立即满?/p>

IO调度器算法的选择Q既取决于硬件特征,也取决于应用场景?

在传l的SAS盘上QCFQ、DEADLINE、ANTICIPATORY都是不错的选择Q对于专属的数据库服务器QDEADLINE的吞吐量和响应时间都表现良好?/p>

然而在新兴的固态硬盘比如SSD、Fusion IO上,最单的NOOP反而可能是最好的法Q因为其他三个算法的优化是基于羃短寻道时间的Q?/p>

固态硬盘没有所谓的寻道旉且IO响应旉非常短?/p>

2 对于数据库应? Anticipatory Scheduler 的表现是最差的。Deadline ?DSS 环境表现?cfq 更好一点,?cfq l合来看表现更好一

些。这也难?RHEL 4 默认?IO 调度器设|ؓ cfq. ?RHEL 4 ?RHEL 3Q整?IO 改进q是不小的?

 



polly 2011-05-18 18:32 发表评论
]]>
20110518 模式识别-q邻聚类法http://m.shnenglu.com/polly-yang/archive/2011/05/18/146626.htmlpollypollyWed, 18 May 2011 02:26:00 GMThttp://m.shnenglu.com/polly-yang/archive/2011/05/18/146626.htmlhttp://m.shnenglu.com/polly-yang/comments/146626.htmlhttp://m.shnenglu.com/polly-yang/archive/2011/05/18/146626.html#Feedback0http://m.shnenglu.com/polly-yang/comments/commentRss/146626.htmlhttp://m.shnenglu.com/polly-yang/services/trackbacks/146626.html教材上的法Ҏ没讲明白,琢磨了好久。其实分cL果很不好。数据分析sample如下Q?br />    3.20     2.00----0
    4.60     5.70----0
    1.50     5.00----0
    1.80     6.90----3
    6.10     5.50----0
    7.40     4.90----5
    7.20     9.30----6
    8.40     0.40----7
    9.00     2.70----8
    4.30     1.20----0


polly 2011-05-18 10:26 发表评论
]]>
ۺþþ| ĻƷѾþ| þþþavӰ| ƷӰӾþۺ| ɫþˬˬƬaV| ƷŮٸaѾþ| 뾫Ʒþһ| ۺϾƷ㽶þ| þһҹ| 99þþƷ鶹| þþþ?V| þþһƷ99þþƷ88| ƷþþӰ| þþƷhþþƷ帣ӰԺ1421 | ǾþþƷ| ˾Ʒþۺ| ŷһþþ| ݺɫþþһ| þӰԺҹƬ| ٸ߳ҽоþþþþ| þ㽶Ƶ| ˾ƷþѶ| һþþƷһ| 97þóƷɰ | þþƷһ99| ޹Ʒþþ| þþƷ| þҹۺϾþ| þþƷɭ| ݺɫݺݺݺݺɫۺϾþ| þþþseɫ͵͵޾Ʒav| þ99ƷþþþþҰ| ˾þô߽ӰԺ95| þ99Ʒþþþþþþþ| ޾Ʒþþþ66| þþþþþۺϺݺۺ| þþWWW| Ƭѹۿþ| һþۺ³³ŷһ | þñۺϾþ| ޹þ|