09 2015 档案
摘要:每次循环把最小的值往前移C++代码:Sorter.hpp#ifndef _Algorithm_Sorter_H_#define _Algorithm_Sorter_H_template class Sorter{public: static void selectionSort(Item a[...
阅读全文
摘要:UDP provides an end-to-end service different from that of TCP.In fact, UDP performs only two functions:(1) it adds another layer of addressing (ports)...
阅读全文
摘要:1. 预定义函数对象C++标准库内含许多预定义的函数对象,也就是内置的函数对象。你可以充分利用他们,不必自己费心去写一些自己的函数对象。要使用他们,你只要包含如下头文件#include eg:set> coll; // sort elements with > coll; // sort eleme...
阅读全文
摘要:1. 赋值和显示采用$(info $(variable_name))显示内部变量eg:FOO=bar$(info $(FOO))运行结果:#: makebar2. 从命令行外部改变BUILD_DEBUG := yes.PHONY: allall: @echo BUILD_DEBUG is $(...
阅读全文
摘要:我们再来看一个复杂的例子需求:我们需要对集合内每个元素加上一个特定的值代码如下:AddInt.hclass AddInt{private: int theValue; // the value to addpublic: // constructor initializes the...
阅读全文
摘要:WikiScraper.javapackage master.haku.scrape;import org.jsoup.Jsoup;import org.jsoup.nodes.Document;import java.net.*;import java.io.*;public class Wiki...
阅读全文
摘要:下面我们创建一个真正的爬虫例子爬取我的博客园个人主页首页的推荐文章列表和地址scrape_home_articles.pyfrom urllib.request import urlopenfrom bs4 import BeautifulSoupimport rehtml = urlopen("h...
阅读全文
摘要:符号描述 例子(表达式)例子(匹配的字符串) *Matches the preceding character, subexpression, or bracketed character,0 or more times匹配0次或多次a*b*aaaaaaaa,aaabbbbb, bbbbbb ...
阅读全文
摘要:1. 定义在STL中,可以把函数传递给算法,也可以把函数对象传递给算法。那么,什么是函数对象呢?我们来看下它的声明:class X{public: // define function call operator return-value operator() (arguments) const...
阅读全文
摘要:关于lambda的基础知识,请参考上一篇的地址如下:http://www.cnblogs.com/davidgu/p/4825625.html我们再举个STL使用Lambda来进行排序的例子,如下:Person.h#ifndef _Domain_Models_Person_H_#define _Do...
阅读全文
摘要:申请iOS开发者证书http://blog.csdn.net/htttw/article/details/7939405如何向App Store提交应用http://www.cocoachina.com/newbie/tutorial/2013/0508/6155.html
阅读全文
摘要:Lambda始自C++ 11,是一种在表达式或语句内指定函数行为的定义式。你可以定义函数行为作为对象,以inline实参的形式传给算法作为predicate(判断式)。eg:std:transform(coll.begin(), coll.end(), // sourcecoll.begin(),/...
阅读全文
摘要:1. What Is a Socket?(什么是套接字)A socket is an abstraction through which an application may send and receive data, in muchthe same way as an open-file han...
阅读全文
摘要:Binary Predicate(双参判断式)的用途是:比较两个参数的特定属性我们先建一个领域模型类:Person.h#ifndef _Domain_Models_Person_H_#define _Domain_Models_Person_H_#include #include #include ...
阅读全文
摘要:Predicate是一种特殊的辅助函数,它会返回Boolean,常常被用来作为排序或者查找准则。Predicate会有1个或者2个操作数。Unary Predicate(单参判断式)例子:我们先写一个算法,如下:MathUtil.h#ifndef _Math_Util_H_#define _Math...
阅读全文
摘要:handle_excpetion.pyfrom urllib.request import urlopenfrom urllib.error import HTTPErrorfrom bs4 import BeautifulSoupimport sysdef getLogo(url): try...
阅读全文
摘要:目标:我们解析百度首页的logobs_baidu_logo.pyfrom urllib.request import urlopenfrom bs4 import BeautifulSouphtml = urlopen("http://www.baidu.com")bsObj = Beautiful...
阅读全文
摘要:1. 安装Beautiful Soup下载地址http://www.crummy.com/software/BeautifulSoup/bs4/download/4.4/解压后,进入根目录控制台下运行:python setup.py install运行结果:Processing dependenci...
阅读全文
摘要:目录 结构: core |____ __init__.py |____ basic |____ __init__.py |____ database |____ __init__.py |____ mysql |____ __init__.py |____ mysql_db.py |____ tes
阅读全文
摘要:函数作为参数,相当于C++的函数指针, C#的委托for_each函数参数:#include #include #include #include "FuncParamTest.h"#include "../../Core/ContainerUtil.h"using namespace std;vo...
阅读全文
摘要:remove(移除):这个操作并不是真正地删除元素,它会移除指定的元素,然后后面的元素依次前移,最后用别的元素来补充。erase(释放):这个操作会指定释放区间的头和尾迭代器(iterator)。如果要一次性删除指定元素:coll.erase(remove(coll.begin(), coll.en...
阅读全文