摘要: 在爬虫系统中,在内存中维护着两个关于URL的队列,ToDo队列和Visited队列,ToDo队列存放的是爬虫从已经爬取的网页中解析出来的即将爬取的URL,但是网页是互联的,很可能解析出来的URL是已经爬取到的,因此需要VIsited队列来存放已经爬取过的URL。当爬虫从ToDo队列中取出一个URL的时候,先和Visited队列中的URL进行对比,确认此URL没有被爬取后就可以下载分析来。否则舍弃此URL,从Todo队列取出下一个URL继续工作。 然后,我们知道爬虫在爬取网页时,网页的量是比较大的,直接将所有的URL直接放入Visited队列是很浪费空间的。因此引入bloom filter... 阅读全文
posted @ 2014-03-06 00:21 轻度YYy 阅读(3235) 评论(5) 推荐(0) 编辑
摘要: join函数的作用,是让当前线程等待,直到调用join()的 线程结束或者等到一段时间,我们来看以下代码 1 package mian; 2 3 4 public class simpleplela { 5 static void threadMessage(String message... 阅读全文
posted @ 2014-08-04 20:09 轻度YYy 阅读(887) 评论(0) 推荐(0) 编辑
摘要: http://developer.android.com/sdk/installing/index.html基本上上面官网的链接可以解决所有问题,但是具体在安装过程中还是有一些坑。说说具体流程1安装jdk这个是为了让eclipse跑起来,提供jvm可以到oracle官网下载之后注意配置环境变量2... 阅读全文
posted @ 2014-04-15 19:48 轻度YYy 阅读(166) 评论(0) 推荐(0) 编辑
摘要: To add PPA in Ubuntu 14.04 / 13.10 / 13.04 / 12.10 / 12.04First download and install the key from Google Linux Repository. Or run the following comman... 阅读全文
posted @ 2014-04-13 22:57 轻度YYy 阅读(1221) 评论(0) 推荐(0) 编辑
摘要: 在构造文件流变量时候发现,fstream的第一个参数,即文件路径必须是const char *如:1 string s = "/home/user/1.txt";2 fstream file (s,ios::in);编译是不能通过的,必须将文件的路径改为const char *才可以。以下是三种转化方法:1 string str="abc";2 char *p=str.data();1 string str="gdfd";2 char *p=str.c_str();1 string str="hello";2 ch 阅读全文
posted @ 2014-02-21 11:15 轻度YYy 阅读(7004) 评论(0) 推荐(1) 编辑
摘要: 代码中在第一层循环中增加一个bool值,是为了防止在排序完成后还继续无谓的比较,最多会有(n-1)*(n-2)/2次循环。 1 #include 2 using namespace std; 3 void bumbleSort(int a[],int l) 4 { 5 for(int i = 0;ia[j+1])13 {14 if(b)15 b = false;16 int temp = a[j];17 a[j] = a[j+1];18 a[j+1] = temp;19 }20 21 }22 ... 阅读全文
posted @ 2014-02-20 15:09 轻度YYy 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 int partition(int a[],int p,int q){ 4 int x = a[q]; 5 int i = p-1; 6 for(int j = p;j<q;j++) 7 { 8 if(a[j]<x) 9 {10 i++;11 int temp = a[j];12 a[j] = a[i];13 a[i] = temp;14 }15 }16 a[q]=a[i+1];17 a[i+1]=x;18 return i+1;19 }20 void qsort(int a[],int p,int q){21 阅读全文
posted @ 2014-02-20 13:35 轻度YYy 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 其实把程序用到生活中,真的能节约不少时间!程序的力量是无穷滴!哥们的毕业设计是要做法律文书匹配之类的东东,有一步是要抽取所有的法律法规名称,而刚好我们要处理的文件中,法规的名称之前都有个‘.‘,所以用下面的代码处理很方便。以下分别是处理前后的文件格式:只有十几行的代码 1 #include 2 #include 3 #include 4 using namespace std; 5 int main(){ 6 fstream f("1.txt",ios::in|ios::out); 7 fstream ff("3.txt",ios::out); 8 st 阅读全文
posted @ 2014-02-20 11:08 轻度YYy 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 使用PPA(Personal Package Archive)在ubuntu上安装emacs1添加 PPA 到 apt repository 中: $ sudo add-apt-repository ppa:cassou/emacs $ sudo apt-get update2然后,可以使用apt-get方便地下载Emacs $ sudo apt-get install emacs24 emacs24-el emacs24-common-non-dfsg 阅读全文
posted @ 2014-02-08 22:13 轻度YYy 阅读(430) 评论(0) 推荐(0) 编辑