当前位置: 首页 > 编程日记 > 正文

(转自Timon's wang blogs)C#实现web信息自动抓取

原文转自:http://www.csharp.net.cn/post/C实现web信息自动抓取.html
主要为了学习一下相关的网络蜘蛛,为自己获取信息使用
背景

 

随着Internet的普及,网络信息正以极高的速度增长,在这么多数据中找到自己需要的信息是一件很繁琐的事情,找到需要的信息后如何获取也是件麻烦的事。这就需要Internet信息抓取程序来代替人工的操作。

所谓Internet信息抓取程序,就是程序会按照用户的关键词或关键网站来收集相应的信息,并提供给用户想要的信息格式。

 

信息量的增加会带来信息网站发布人员工作量的剧增,为实现信息发布系统实现信息自

动发布、减少工作人员工作量、即时跟踪最新信息,就需要自动信息提供程序,因此Internet信息抓取程序应运而生。

 

目标

 

实现自定义网站信息分类抓取,存入本地数据库、生成静态页面或其它用户定义的信息结构,并下载与信息相关的多媒体文件。

 

开发

 

l         目标站点结构分析

本步骤是准确抓取信息个关键。

首先要选择更新频率高的页面做为抓取地址,然后分析要抓取内容页面url特点。

然后分析要抓取信息页面的元素特性,比如标题位置,内容位置 等,得到定位标记点。

将以上信息写成自己的配置文件或存到数据库中。

每个网站都需要分析,写出单独的配置文件,供抓取程序使用。

 

l         信息提取

根据配置文件取得要抓取页面url,使用HttpWebRequest类获取内容:

//获取http页面函数

public string Get_Http(string a_strUrl,int timeout)

{

string strResult ;

try

{

HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(a_strUrl) ;

myReq.Timeout = timeout;

HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse();

Stream myStream = HttpWResp.GetResponseStream () ;

StreamReader sr = new StreamReader(myStream , Encoding.Default);

StringBuilder strBuilder = new StringBuilder();

while (-1 != sr.Peek())

{

strBuilder.Append(sr.ReadLine()+"\r\n");

}

strResult = strBuilder.ToString();

}

catch(Exception exp)

{

strResult = "错误:" + exp.Message ;

}

return strResult ;

}

获取页面内容后,分析页面中连接地址取到要抓取的url:

//处理页面标题和链接

public string SniffWebUrl( string urlStr,string blockB,string blockE )

{

string urlch1 = "";

string urlch2 = "";

int end_n1 = 0;

int end_nums = 0;

int end_nums1 = 0;

int end_nums2 = 0;

int end_nums3     = 0;

string reUTStr = "";

string reTitle = "";

string ret = "";

try

{

int pos01 = urlStr.IndexOf( "." );

int pos02 = urlStr.LastIndexOf( "/" );

if( pos01 < 0 )

{

return "";

}

if( pos02 < 0 )

{

return "";

}

int pos03 = urlStr.IndexOf( "/",pos01 );

if ( pos03 < 0 )

{

urlch1 = urlStr;

urlch2 = urlStr;

}

else

{

urlch1 = urlStr.Substring( 0,pos03 );

urlch2 = urlStr.Substring( 0,pos02 );

}

string tmpAllStr = new PublicFun().Get_Http( urlStr ,time1);

int pos1 = tmpAllStr.IndexOf( blockB );

int pos2 = tmpAllStr.IndexOf( blockE,pos1 + blockB.Length );

if ( pos1>0 && pos2>0 && pos2>pos1 )

{

ret = tmpAllStr.Substring( pos1 + blockB.Length,pos2 - pos1 - blockB.Length );

ret = ret.Substring( ret.IndexOf( "<" ));

while( ret.IndexOf( "<A" ) >= 0 )

{

ret = ret.Substring( 0,ret.IndexOf( "<A" ) ) + "<a" + ret.Substring( ret.IndexOf( "<A" ) + 2 );

}

while( ret.IndexOf( "</A" ) >=0 )

{

ret = ret.Substring( 0,ret.IndexOf( "</A" ) ) + "</a" + ret.Substring( ret.IndexOf( "</A" ) + 3 );

}

while( ret.IndexOf( "Href=" ) >=0 )

{

ret = ret.Substring( 0,ret.IndexOf( "Href=" )) + "href=" + ret.Substring( ret.IndexOf( "Href=" ) + 5 );

}

while( ret.IndexOf( "HREF=" ) >=0 )

{

ret = ret.Substring( 0,ret.IndexOf( "HREF=" )) + "href=" + ret.Substring( ret.IndexOf( "HREF=" ) + 5 );

}

while( ret.IndexOf( "href='" ) >=0 )

{

ret = ret.Substring( 0,ret.IndexOf( "href='" )) + "href=\"" + ret.Substring( ret.IndexOf( "href='" ) + 6 );

}

}

tmpAllStr = ret;

int begin_nums = tmpAllStr.IndexOf( "href=" );

while ( begin_nums >= 0 )

{

string tmpStrA = "";

string tmpStrB = tmpAllStr.Substring( begin_nums + 5,1 );

if ( tmpStrB == "\"" )

{

end_n1 = begin_nums + 6;

if ( ( end_n1 + 1 ) > tmpAllStr.Length )

{

return "";

}

tmpStrA = tmpAllStr.Substring( begin_nums+6,1 );

}

else

{

end_n1 = begin_nums + 5;

tmpStrA = tmpStrB;

}

if ( tmpStrA == "#" )

{

tmpAllStr = tmpAllStr.Substring( end_n1 );

begin_nums = tmpAllStr.IndexOf( "href=" );

}

else

{

end_nums1 = tmpAllStr.IndexOf( " ",end_n1 );

end_nums2 = tmpAllStr.IndexOf( ">",end_n1 );

end_nums3 = tmpAllStr.IndexOf( "</a",end_nums2 );

if ( ( end_nums3 >= 0 ) && ( end_nums2 >= 0 ) )

{

reTitle = tmpAllStr.Substring( end_nums2 + 1,end_nums3 - end_nums2 - 1 );

if ( end_nums1 > end_nums2 )

{

end_nums = end_nums2;

}

else

{

if ( end_nums1 < 0 )

{

end_nums = end_nums2;

}

else

{

end_nums = end_nums1;

}

}

string str4 = tmpAllStr.Substring( end_nums-1, end_nums - end_nums + 1 );

if ( str4 =="\"" || str4 == "'" )

{

end_nums = end_nums - 1;

}

string sTotalOne = tmpAllStr.Substring( end_n1,end_nums - end_n1 );

if ( sTotalOne.IndexOf( "http://" ) <0 )

{

if ( sTotalOne.IndexOf( "/" ) == 0 )

{

sTotalOne = urlch1 + sTotalOne;

}

else

{

int linshiIntNum = 0;

int flags = 0;

string urlChange = urlStr;;

while( sTotalOne.IndexOf( "../" ) >= 0 )

{

sTotalOne = sTotalOne.Substring( sTotalOne.IndexOf( "../" ) + 3 );

linshiIntNum = linshiIntNum + 1;

flags = flags +1;

}

while( ( urlChange.LastIndexOf( "/" ) >= 0 ) && ( linshiIntNum >= 0 ) )

{

urlChange = urlChange.Substring( 0,urlChange.LastIndexOf( "/" ) );

linshiIntNum = linshiIntNum - 1;

}

if ( flags == 0 )

{

sTotalOne = urlch2 + "/" + sTotalOne;

}

else

{

sTotalOne = urlChange + "/" + sTotalOne;

}

}

}

reUTStr = reUTStr + new PublicFun().RemoveHtmlCode( reTitle ) + sTotalOne;

tmpAllStr = tmpAllStr.Substring( end_nums3 + 4 );

begin_nums = tmpAllStr.IndexOf( "href=" );

}

else

{

begin_nums = -1;

}

}

}

return reUTStr;

}

catch( Exception e)

{

return "";

}

}

得到要抓取内容的url后,处理该页面:

//获取链接内容并分类处理

public string GetWebContent( string gatherUrl,string subUrl,string subTitle,string b_Content,string e_Content,string b_Filter,string e_Filter,string root )

{

string tmpAllStr = "";

string dfStrB = "";

string dfStrE = "";

string rePicStr = "";//图片返回路径

string reContentStr = "";

string picHtml = "images"; //本地图片路径

string urlch1 ="";

string urlch2 ="";

int pos1 = gatherUrl.IndexOf( "." );

int pos2 = gatherUrl.LastIndexOf( "/" );

if( pos1 < 0 )

{

return "";

}

if( pos2 < 0 )

{

return "";

}

int pos3 = gatherUrl.IndexOf( "/",pos1 );

if ( pos3 < 0 )

{

urlch1 = gatherUrl;

urlch2 = gatherUrl;

}

else

{

urlch1 = gatherUrl.Substring( 0,pos3 );

urlch2 = gatherUrl.Substring( 0,pos2 );

}

tmpAllStr = new PublicFun().Get_Http( subUrl,time1 );

//取稿源

string docFromStr = "";

if ( dfStrB != "" && dfStrE != "" )

{

if ( tmpAllStr != "" )

{

int b_docF = tmpAllStr.IndexOf( dfStrB );

if ( b_docF > 0 )

{

int e_docF = tmpAllStr.IndexOf( dfStrE,b_docF + dfStrB.Length );

if ( e_docF > 0 && e_docF > b_docF && e_docF - b_docF < 20 )

{

docFromStr = tmpAllStr.Substring( b_docF + dfStrB.Length, e_docF - b_docF - dfStrB.Length );

}

}

}

}

//取内容

if ( tmpAllStr != "" )

{

int begin_strnum = tmpAllStr.IndexOf( b_Content );

if ( begin_strnum < 0 )

{

return "";

}

int end_strnum = tmpAllStr.IndexOf( e_Content,begin_strnum + b_Content.Length );

if ( end_strnum < 0 )

{

return "";

}

string sTotalSubM = "";

if ( end_strnum > begin_strnum )

{

sTotalSubM = tmpAllStr.Substring ( begin_strnum,end_strnum - begin_strnum );

}

if ( sTotalSubM == "" )

{

return "";

}

//过滤无用信息

int bfnum = sTotalSubM.IndexOf( b_Filter );

if ( bfnum > -1 )

{

int efnum = sTotalSubM.IndexOf( e_Filter,bfnum );

if ( efnum > -1 )

{

if ( efnum > bfnum )

{

sTotalSubM = sTotalSubM.Substring( 0,bfnum ) + sTotalSubM.Substring( efnum + e_Filter.Length );

}

}

}

//格式化图片标记

while( sTotalSubM.IndexOf( "Src=" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "Src=" ) ) + "src=" + sTotalSubM.Substring( sTotalSubM.IndexOf( "Src=" ) + 4 );

}

while( sTotalSubM.IndexOf( "SRC=" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "SRC=" ) ) + "src=" + sTotalSubM.Substring( sTotalSubM.IndexOf( "SRC=" ) + 4 );

}

while( sTotalSubM.IndexOf( "src='" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "src='" ) ) + "src=\"" + sTotalSubM.Substring( sTotalSubM.IndexOf( "src='" ) + 5 );

}

//取图片地址

int end_n12 = 0;

int end_nums2 = 0;

int begin_nums2 = sTotalSubM.IndexOf( "src=" );

while( begin_nums2 >= 0 )

{

String tmpStr = sTotalSubM.Substring( begin_nums2 + 4,1 );

if ( tmpStr == "\"" )

{

end_n12 = begin_nums2 + 5;

}

else

{

end_n12 = begin_nums2 + 4;

}

int end_nums2a = sTotalSubM.IndexOf( " ",end_n12 );

int end_nums2b = sTotalSubM.IndexOf( ">",end_n12 );

if ( end_nums2b < 0 )

{

break;

}

if ( end_nums2a > end_nums2b )

{

end_nums2 = end_nums2b;

}

else

{

if (end_nums2a<0)

{

end_nums2 = end_nums2b;

}

else

{

end_nums2 = end_nums2a;

}

}

tmpStr = sTotalSubM.Substring( end_nums2-1,1 );

if ( tmpStr == "\"" || tmpStr == "'" )

{

end_nums2 = end_nums2 - 1;

}

string tmpPicStr = sTotalSubM.Substring( end_n12,end_nums2 - end_n12 );

if ( tmpPicStr.IndexOf( "http://" ) < 0 )

{

if ( tmpPicStr.IndexOf( "/" ) == 0 )

{

tmpPicStr = urlch1 + tmpPicStr;

}

else

{

int linshiIntNum = 0;

int flags = 0;

string urlChange = subUrl;

while( tmpPicStr.IndexOf( "../" ) >= 0 )

{

tmpPicStr = tmpPicStr.Substring( tmpPicStr.IndexOf("../") + 3 );

linshiIntNum = linshiIntNum + 1;

flags = flags + 1;

}

while( ( urlChange.LastIndexOf( "/" ) >= 0 ) && ( linshiIntNum >= 0 ) )

{

urlChange = urlChange.Substring( 0,urlChange.LastIndexOf( "/" ) );

linshiIntNum = linshiIntNum - 1;

}

if ( flags == 0 )

{

tmpPicStr = urlch2 + "/" + tmpPicStr;

}

else

{

tmpPicStr = urlChange + "/" + tmpPicStr;

}

}

}

//tmpPicStr = tmpPicStr.ToLower();

string tmpPicStrTmp = tmpPicStr.ToLower();

//if ( tmpPicStr.IndexOf( ".jpg" ) > 0 || tmpPicStr.IndexOf( ".gif" ) > 0 || tmpPicStr.IndexOf( ".bmp" ) > 0 )

if ( tmpPicStrTmp.IndexOf( ".jpg" ) > 0 || tmpPicStrTmp.IndexOf( ".gif" ) > 0 || tmpPicStrTmp.IndexOf( ".bmp" ) > 0 )

{

rePicStr = rePicStr + "||" + tmpPicStr ;

int flagN2 = tmpPicStr.LastIndexOf( "/" );

string fileN2 = picHtml + tmpPicStr.Substring( flagN2 );

sTotalSubM = sTotalSubM.Substring( 0,end_nums2 ) + ">******" + fileN2 + "******<" + sTotalSubM.Substring( end_nums2 );

begin_nums2 = sTotalSubM.IndexOf( "src=", end_nums2 + fileN2.Length + 22 );

}

else

{

begin_nums2 = sTotalSubM.IndexOf( "src=", end_nums2 + 4 );

}

}

if ( rePicStr.Length > 2 )

rePicStr = rePicStr.Substring(2);

//内容处理 格式化关键标记

while( sTotalSubM.IndexOf( "<P" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "<P" ) ) + "|****|<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "<P" ) + 2 );

}

while( sTotalSubM.IndexOf( "<p" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "<p" ) ) + "|****|<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "<p" ) + 2 );

}

while( sTotalSubM.IndexOf( "</P" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "</P" ) ) + "|****|<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "</P" ) + 3 );

}

while( sTotalSubM.IndexOf( "</p" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "</p" ) ) + "|****|<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "</p" ) + 3 );

}

while( sTotalSubM.IndexOf( "<br" ) >=0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "<br" ) ) + "+****+<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "<br" ) + 3 );

}

while( sTotalSubM.IndexOf( "<BR" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "<BR" ) ) + "+****+<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "<BR" ) + 3 );

}

while( sTotalSubM.IndexOf( "<Br" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "<Br" ) ) + "+****+<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "<Br" ) + 3 );

}

while( sTotalSubM.IndexOf( "<bR" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "<bR" ) ) + "+****+<" + sTotalSubM.Substring( sTotalSubM.IndexOf( "<bR" ) + 3 );

}

//去除html标记

int linshiInt1 = sTotalSubM.IndexOf( "<" );

int linshiInt2 = sTotalSubM.IndexOf( ">" );

if ( linshiInt2 < linshiInt1 )

{

sTotalSubM = sTotalSubM.Substring( linshiInt2 + 1 );

}

int linshiInt11 = sTotalSubM.LastIndexOf( "<" );

int linshiInt12 = sTotalSubM.LastIndexOf( ">" );

if ( linshiInt12 < linshiInt11 )

{

sTotalSubM = sTotalSubM.Substring( 0,linshiInt12 + 1 );

}

linshiInt1 = sTotalSubM.IndexOf( "<" );

while ( linshiInt1 >= 0 )

{

linshiInt2 = sTotalSubM.IndexOf( ">",linshiInt1 );

if ( linshiInt2 >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,linshiInt1 ) + sTotalSubM.Substring( linshiInt2 + 1 );

}

else

{

sTotalSubM = sTotalSubM.Substring( 0,linshiInt1 );

}

linshiInt1 = sTotalSubM.IndexOf("<");

}

//还原关键标记

int linshiInt3 = 0;

int linshiInt4 = 0;

while( sTotalSubM.IndexOf( "+****+" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "+****+" ) ) + "<br>\n" + sTotalSubM.Substring( sTotalSubM.IndexOf( "+****+" ) + 9 );

}

while( sTotalSubM.IndexOf( "|****|" ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( "|****|" ) ) + "<br>\n" + sTotalSubM.Substring( sTotalSubM.IndexOf( "|****|" ) + 9 );

}

while( sTotalSubM.IndexOf( "******" ) >= 0 )

{

linshiInt3 = sTotalSubM.IndexOf( "******" ) + 9;

linshiInt4 = sTotalSubM.IndexOf( "******",linshiInt3 );

if ( linshiInt4 >= 0 )

{

int tmpPos = sTotalSubM.IndexOf( "******" );

string tmpStr1 = sTotalSubM.Substring( 0,tmpPos );

string tmpStr2 = sTotalSubM.Substring( linshiInt3,linshiInt4 - linshiInt3 );

string tmpStr3 = sTotalSubM.Substring( linshiInt4 + 9 );

sTotalSubM = tmpStr1 + "<img src=" + tmpStr2 + ">" + tmpStr3;

}

else

{

break;

}

}

//去除内容中的标题

if ( sTotalSubM.IndexOf( subTitle ) >= 0 )

{

sTotalSubM = sTotalSubM.Substring( 0,sTotalSubM.IndexOf( subTitle ) ) + sTotalSubM.Substring( sTotalSubM.IndexOf( subTitle ) + subTitle.Length );

}

reContentStr = sTotalSubM;

//调用下载图片功能

//下载图片到指定目录

string[] img_Url = new PublicFun().split( rePicStr,"||" );

for ( int i=0;i<img_Url.Length;i++ )

{

if ( img_Url[i] != "" )

{

new PublicFun().Get_Img( img_Url[i],10000,root + "\\images\\" + img_Url[i].Substring( img_Url[i].LastIndexOf("/")+1 ) );

}

}

}

return reContentStr;

}

以上方法返回要取得的信息,包括标题内容,图片地址等。

下载页面中图片:

//下载图片

public void Get_Img(string a_strUrl,int timeout,string filepath)

{

try

{

HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(a_strUrl) ;

myReq.Timeout = timeout;

HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse();

Stream myStream = HttpWResp.GetResponseStream () ;

Bitmap map = new Bitmap( myStream );

PictureBox picB = new PictureBox();

picB.Image = (Image)map;

string path = filepath.Substring( 0,filepath.LastIndexOf( "\\" ) );

if (!Directory.Exists(path))

{

CreateDir( path );

}

picB.Image.Save(filepath);

}

catch(Exception exp)

{

string ss = exp.Message;

WriteLog( filepath.Substring(0,filepath.LastIndexOf("\\")) + "\\error.log",a_strUrl + "--" + ss + "\r\n");

}

}

l         保存文件或入库

上面取得的信息可以按自己的要求保存。

 

****设计的时候没有使用url按层次循环抓取,这样定义抓取url效率更高,速度更快。

转载于:https://www.cnblogs.com/dagon007/archive/2009/09/11/1564452.html

相关文章:

数据结构-栈与队列

栈的定义 栈是限定仅在表尾进行插入和删除操作的线性表 我们把允许插入和删除的一端称为栈顶 (top) &#xff0c;另一端称为栈底 (bottom) &#xff0c;不含任何数据元素的栈称为空栈。 栈又称为后进先出 (Last In Filrst Out) 的线性表&#xff0c;简称LIFO结构。 理解栈的定义…

雷观(七):靠谱的程序员,不是随便一个码农就可以做到的

在学习Web开发4年之后&#xff0c;我自己可以独立做一些基本的项目了。在加入前单位秒针&#xff0c;也做了几个Web项目。 我发现一个现象&#xff0c;很多公司大部分的Web项目&#xff0c;用到的技术很少&#xff0c;主要就是SSH等框架&#xff0c;实现一些行业的业务逻辑&…

1032 Sharing

思路很简单&#xff0c;不要想多了&#xff0c;就是找第一个出现的共同字母&#xff0c;即使后面不一样了也没关系。 经验收获如下&#xff1a; 1. 5位整数算小整数&#xff0c;用静态链表&#xff0c;本质上是哈希。 2. 读入字符型的时候千万注意空格。 AC代码 #include&…

Magento开发的特点有哪些?

Magento是一套专业开源的电子商务系统&#xff0c;也是目前主流的外贸网站购物系统&#xff0c;都是居于PHP语言开发的&#xff0c;数据库使用的是Mysql&#xff0c;且浏览界面很适合欧美用户的使用习惯。Magento开发设计得非常灵活&#xff0c;具有模块化架构体系和丰富的功能…

Linux多任务编程之五:exit()和_exit()函数(转)

来源&#xff1a;CSDN 作者&#xff1a;王文松 转自&#xff1a;Linux公社 ------------------------------------------------------------------------------------------------------------------------------------------------ wait()和waitpid() 函数说明 wait()函数用…

LogMiner日志分析工具的使用

1.安装logminer&#xff1a; 要安装LogMiner工具&#xff0c;必须首先要运行下面这样两个脚本&#xff0c; $ORACLE_HOME/rdbms/admin/dbmslm.sql $ORACLE_HOME/rdbms/admin/dbmslmd.sql. 这两个脚本必须均以SYS用户身份运行。 *************使用字典文件…

1052 Linked List Sorting

1. 开始测试点4不通过&#xff0c;得分24/25&#xff0c;是忽略了所有节点都不在链表上的特殊情况。 2. 其实就是用静态链表&#xff0c;把结点根据值的大小&#xff0c;升序排列&#xff0c;所以一开始把每个结点的key赋值为超出最大值的maxn&#xff0c;是为了方便输出。 3…

C#尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

用VS2012调试时发现在调用数据集时提示“尝试读取或写入受保护的内存。这通常指示其他内存已损坏。” 用管理员身份运行CMD&#xff0c;输入netsh winsock reset并回车 转载于:https://www.cnblogs.com/CandiceW/p/4204552.html

TFS2008 + Windows2003 + Sql2005 安装注意事项

TFS2008并不是一个很容易安装的软件&#xff0c;很多时候能否顺利安装成功跟人品有关(笑)&#xff0c;要想一次安装成功&#xff0c;强烈建议准备一个全新的干净系统。 1.系统 最好采用刚安装好的windows2003&#xff0c;注意要打上sp2&#xff0c;安装IIS(如果IIS默认站点的主…

发票拍照识别OCR

发票拍照识别系统还可与政府、企事业单位、工商等多个行业的业务流程系统无缝结合&#xff0c;辅助办公人员进行发票等单据的信息录入&#xff0c;提高资料电子化、数据格式化的效率。 那么发票拍照识别系统有哪些技术特点呢&#xff1f; 1、中安发票拍照识别系统支持安卓andro…

1097 Deduplication on a Linked List

1. 开始测试点4不通过&#xff0c;检查后发现是犯了低级错误&#xff0c;把表示绝对值有无出现的整型数组的大小设置为了4000(题目中说绝对值不会超过10的4次方)&#xff0c;所以最小也该是10001。 2. 我认为和其他链表题相比&#xff0c;本题是不需要给结点加特殊属性用来排序…

搞定MyBatis

对于从事 Java EE 的开发人员来说&#xff0c;iBatis 是一个再熟悉不过的持久层框架了&#xff0c;在 Hibernate、JPA 这样的一站式对象 / 关系映射&#xff08;O/R Mapping&#xff09;解决方案盛行之前&#xff0c;iBaits 基本是持久层框架的不二选择。即使在持久层框架层出不…

6-6.用HLSL定义点光源

6-6.用HLSL定义点光源问题直到现在&#xff0c;你已经用定向光照亮你的场景&#xff0c;它对添加阳光到3D世界很有用。常常&#xff0c;你也将需要一个单点光照&#xff0c;例如手电筒或爆炸。这种光源叫点光源。方案从你的XNA项目传递点光源的3D位置到你的XNA effect。为每个顶…

2018 JVM 生态报告:79% 的 Java 开发者使用 Java 8

百度智能云 云生态狂欢季 热门云产品1折起>>> 2018 JVM 生态调查报告已于近日发布&#xff0c;该报告由 Snyk 和 The Java Magazine&#xff08;Oracle 的双月刊&#xff09;联合推出&#xff0c;旨在了解 JDK 的实现、工具、平台和应用方面的前景。基于超过 10200 …

广度优先搜索(BFS)模板

伪代码 void BFS(int S){queue<int> q;q.push(s);while(!q.empty()){取出队首元素top;访问队首元素top;将队首元素出队;将top的下一层结点中未曾入队的结点全部入队&#xff0c;并设置为已入队;} } 说明 1. 定义队列q&#xff0c;并将起点s入队 2. 写一个while循环&a…

static关键字和内存使用

1 static静态的&#xff0c;用来修饰属性&#xff0c;方法&#xff0c;代码块&#xff0c;内部类 2 当其中一个变量对此属性进行修改&#xff0c;会导致其他对象对此属性的一个调用 vs 实例变量&#xff1a;对象各有一套副本 3 静态变量和方法随着类的加载而加载&#xff0c;可…

转载:用 Tomcat 和 Eclipse 开发 Web 应用程序

原文地址:http://www.ibm.com/developerworks/cn/opensource/os-eclipse-tomcat/所需的组件 Eclipse V3.2 Callisto 集成开发环境 (IDE) 包括了用于 Web 开发及与服务器集成的工具。所以&#xff0c;除了软件开发工具箱 (SDK) 之外&#xff0c;只需安装 Eclipse 和 Apache Tomc…

【学习——字符串】字符串之一网打尽quq

学弟lyh上午讲课&#xff0c;喜闻乐见的制胡窜 一上午讲惹KMP&#xff0c; manachar&#xff0c; trie树&#xff0c; AC自动机 orz 例题都是洛咕咕上的&#xff0c; 贴一下&#xff08;督促自己不要咕 AC自动机不会qaq&#xff08;并且没有学的意向 manachar 没写过 P4555 […

分别用BFS和DFS求给定的矩阵中“块”的个数

目录 背景介绍 BFS实现 基本思想 获取相邻位置元素技巧 BFS函数 DFS实现 基本思想 DFS函数 完整代码 背景介绍 背景 给出一个mxn的矩阵&#xff0c;矩阵中的元素为0或1。称位置(x,y)与其上下左右四个位置(x,y1),(x,y-1),(x-1,y),(x1,y)是相邻的。如果矩阵中有若干(…

[Python_7] Python Socket 编程

0. 说明 Python Socket 编程 1. TCP 协议 [TCP Server] 通过 netstat -ano 查看端口是否开启 # -*-coding:utf-8-*-"""TCP 协议的 Socket 编程&#xff0c;Server 端Server 端绑定到指定地址&#xff0c;监听特定的端口&#xff0c;接受发来的连接请求 "&q…

2014.12.01 B/S之windows8.1下安装IIS

1、打开 控制面板——程序——程序和功能——启用或关闭windows功能 2、找到Internet信息服务 3、等待安装完毕即可 4、控制面板——系统和安全——管理工具——Internet Information Services (IIS)管理器 默认路径为 C:\inetpub\wwwroot 路径更改以后记得更改权限。 转载于:h…

[分享]C# 获取Outlook帐号和密码

[分享]C# 获取Outlook帐号和密码http://www.vjsdn.com/bbs/bbsTopicDetails.aspx?pid108281214 转载于:https://www.cnblogs.com/vjsdn/archive/2009/09/26/1574341.html

BFS:走出迷宫并输出最小步数

目录 背景 描述 例子 思路 完整代码 收获总结 背景 描述 给定一个n*m大小的迷宫&#xff0c;其中*代表不可通过的墙壁&#xff0c;而“.”代表墙壁&#xff0c;S表示起点&#xff0c;T代表重点。移动过程中&#xff0c;如果当前位置是(x,y)(下标从0开始)&#xff0c;且…

人工智能和机器学习领域有哪些有趣的开源项目

人工智能和机器学习领域有哪些有趣的开源项目&#xff1f;投递人 itwriter 发布于 2014-12-02 11:21 评论(0) 有20人阅读 原文链接 [收藏] 本文简要介绍了 10 款 Quora 上网友推荐的 人工智能和机器学习领域方面的开源项目。 GraphLab GraphLab 是一种新的面向机器学习…

复杂度归纳--小结

一、复杂度分析的4个概念1.最坏情况时间复杂度&#xff1a;代码在最理想情况下执行的时间复杂度。2.最好情况时间复杂度&#xff1a;代码在最坏情况下执行的时间复杂度。3.平均时间复杂度&#xff1a;用代码在所有情况下执行的次数的加权平均值表示。4.均摊时间复杂度&#xff…

KDE社区:首个KDialogue正式开放

今天KDE社区与“People Behind KDE” 合作推出一个非常有意思的栏目&#xff0c;叫作KDialogue。 关于KDialogue&#xff0c;有点类似头脑风暴。简言之就是成员向社区发起关于KDE的话题&#xff08;或某一问题&#xff09;&#xff0c;然后KDE的开发者会被邀请参与这个话题。KE…

1091 Acute Stroke 需再做

这是BFS的典型应用场景&#xff1a;求给定矩阵中块(由相邻的点组成)的大小之和。不同的是这一次是三维。 判断是否邻接的依据是是否有公共边&#xff0c;还是可以用上增量数组的技巧 int X[6] {0,0,1,-1,0,0};//增量数组 int Y[6] {1,-1,0,0,0,0}; int Z[6] {0,0,0,0,1,-…

Ext UI 第一步

Code//Ext.onReady(function(){ var _panelnew Ext.Panel({ renderTo:Ext.getBody(), title:"XXX" });});空面板 加按钮方法:addButton(String/Object _config,Function _handler,Object _scope):添加一个按钮对象到面板Codevar loadfunction(){ …

深入浅出 Java Concurrency (29): 线程池 part 2 Executor 以及Executors[转]

Java里面线程池的顶级接口是Executor&#xff0c;但是严格意义上讲Executor并不是一个线程池&#xff0c;而只是一个执行线程的工具。真正的线程池接口是ExecutorService。 下面这张图完整描述了线程池的类体系结构。 首先Executor的execute方法只是执行一个Runnable的任务&…

WPF的消息机制(二)- WPF内部的5个窗口之隐藏消息窗口

原文:WPF的消息机制&#xff08;二&#xff09;- WPF内部的5个窗口之隐藏消息窗口版权声明&#xff1a;本文为博主原创文章&#xff0c;未经博主允许不得转载。 https://blog.csdn.net/powertoolsteam/article/details/6109036 目录 WPF的消息机制&#xff08;一&#xff09;-让…