cto

阅读 / 问答 / 标签

英文cable gland与cable connector中文意思有什么不同

cableconnector:线材连接器cablegland:电缆密封套再看看别人怎么说的。

如何使用webcollector爬取搜索引擎

使用webcollector爬取搜索引擎,按照关键字搜索的结果页面,解析规则可能会随百度搜索的改版而失效。代码如下:[java] view plain copypackage com.wjd.baidukey.crawler; import java.io.ByteArrayInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.net.URLEncoder; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.TimeZone; import org.apache.poi.poifs.filesystem.DirectoryEntry; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import cn.edu.hfut.dmic.contentextractor.ContentExtractor; import cn.edu.hfut.dmic.webcollector.model.CrawlDatum; import cn.edu.hfut.dmic.webcollector.model.CrawlDatums; import cn.edu.hfut.dmic.webcollector.model.Page; import cn.edu.hfut.dmic.webcollector.plugin.ram.RamCrawler; public class BdiduKeywordCrawler extends RamCrawler{ private Connection connection; private PreparedStatement pstatement; // 连接MySql数据库,用户名root,密码mahao String url = "jdbc:mysql://localhost:3306/wjd"; String username = "root"; String password = "mahao"; //保存抽取到的数据 StringBuilder result = new StringBuilder(); public BdiduKeywordCrawler(String keyword, int maxPageNum) throws Exception { for (int pageNum = 1; pageNum <= maxPageNum; pageNum++) { String url = createUrl(keyword, pageNum); CrawlDatum datum = new CrawlDatum(url) .putMetaData("keyword", keyword) .putMetaData("pageNum", pageNum + "") .putMetaData("pageType", "searchEngine") .putMetaData("depth", "1"); addSeed(datum); } } @Override public void visit(Page page, CrawlDatums next) { String keyword = page.getMetaData("keyword"); String pageType = page.getMetaData("pageType"); int depth = Integer.valueOf(page.getMetaData("depth")); if (pageType.equals("searchEngine")) { int pageNum = Integer.valueOf(page.getMetaData("pageNum")); System.out.println("成功抓取关键词" + keyword + "的第" + pageNum + "页搜索结果"); // || div[class=result-op c-container xpath-log ]>h3>a Elements results = page.select("div[class=result c-container ]>h3>a"); // Elements results1 = page.select("div[class=result-op c-container xpath-log]>h3>a");//,div[id=result-op c-container xpath-log]>h3>a //System.out.println(results1.get(0)); //results.add(results1.get(0)); for (int rank = 0; rank < results.size(); rank++) { Element result = results.get(rank); /* * 我们希望继续爬取每条搜索结果指向的网页,这里统称为外链。 * 我们希望在访问外链时仍然能够知道外链处于搜索引擎的第几页、第几条, * 所以将页号和排序信息放入后续的CrawlDatum中,为了能够区分外链和 * 搜索引擎结果页面,我们将其pageType设置为outlink,这里的值完全由 用户定义,可以设置一个任意的值 * 在经典爬虫中,每个网页都有一个refer信息,表示当前网页的链接来源。 * 例如我们首先访问新浪首页,然后从新浪首页中解析出了新的新闻链接, * 则这些网页的refer值都是新浪首页。WebCollector不直接保存refer值, * 但我们可以通过下面的方式,将refer信息保存在metaData中,达到同样的效果。 * 经典爬虫中锚文本的存储也可以通过下面方式实现。 * 在一些需求中,希望得到当前页面在遍历树中的深度,利用metaData很容易实现 * 这个功能,在将CrawlDatum添加到next中时,将其depth设置为当前访问页面 的depth+1即可。 */ CrawlDatum datum = new CrawlDatum(result.attr("abs:href")) .putMetaData("keyword", keyword) .putMetaData("pageNum", pageNum + "") .putMetaData("rank", rank + "") .putMetaData("pageType", "outlink") .putMetaData("depth", (depth + 1) + "") .putMetaData("refer", page.getUrl()); next.add(datum); } } else if (pageType.equals("outlink")) { /*int pageNum = Integer.valueOf(page.getMetaData("pageNum")); int rank = Integer.valueOf(page.getMetaData("rank")); String refer = page.getMetaData("refer");*/ try { String content = ContentExtractor.getContentByUrl(page.getUrl()); /*String line = String.format( "第%s页第%s个结果:标题:%s(%s字节) depth=%s refer=%s", pageNum, rank + 1, page.getDoc().title(), content, depth, refer);*/ String line = String.format("标题:%s 来源:%s 正文:%s", page.getDoc().title(),page.getUrl(),content); HashMap<String, String> data = new HashMap<String,String>(); Date currentDate = new java.util.Date(); SimpleDateFormat myFmt = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); TimeZone timeZoneChina = TimeZone.getTimeZone("Asia/Shanghai");// 获取中国的时区 myFmt.setTimeZone(timeZoneChina);// 设置系统时区 String grabTime = myFmt.format(currentDate);// new Date()为获取当前系统时间 data.put("title", page.getDoc().title()); data.put("from", page.getUrl()); data.put("content", content); data.put("grabTime", grabTime); //String line = String.format("标题:%s ", page.getDoc().title()); //持久化到word文档中 //是否为线程安全??? //synchronized(this) { String destFile = "D:\"+"Result"+keyword+".doc"; result.append(line); //将result写到doc文件中 write2File(destFile,result.toString()); //添加到数据库中 addResultData(data); //} System.out.println(line); } catch (Exception e) { //e.printStackTrace(); System.out.println("链接"+page.getUrl()+"失效"); } } } //将数据保存到mysql数据库中 private void addResultData(HashMap<String, String> data) { String title = data.get("title"); String source_url = data.get("from"); String content = data.get("content").replaceAll("\?{2,}", "");//去掉字符串中出现的多个连续问号。 //抓取时间 String grabTime = data.get("grabTime"); /*SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); Date date = null; try { date = format.parse(grabTime); } catch (Exception e) { e.printStackTrace(); }*/ //System.out.println("抓取时间"+grabTime); try { connection = DriverManager.getConnection(url, username, password); String sql = "INSERT INTO wjd_keyword_search_table(TITLE,GRAP_TIME,CONTENT,SOURCE_URL) VALUES(?,?,?,?)"; String checkSql = "select 1 from wjd_keyword_search_table where TITLE="" + title + """; Statement statement = connection.prepareStatement(checkSql); ResultSet result = statement.executeQuery(checkSql); if (!result.next()) { // 如果数据库中不存在该记录,则添加到数据库中 pstatement = connection.prepareStatement(sql); pstatement.setString(1, title); //pstatement.setString(2, date); pstatement.setString(2,grabTime); pstatement.setString(3, content); pstatement.setString(4, source_url); pstatement.executeUpdate(); } } catch (SQLException e) { e.printStackTrace(); } } /** * 将数据持久化到本地doc文件中 * @param destFile * @param line */ private void write2File(String destFile, String line) { try { //doc content ByteArrayInputStream bais = new ByteArrayInputStream(line.getBytes()); POIFSFileSystem fs = new POIFSFileSystem(); DirectoryEntry directory = fs.getRoot(); directory.createDocument("WordDocument", bais); FileOutputStream ostream = new FileOutputStream(destFile); fs.writeFilesystem(ostream); bais.close(); ostream.close(); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) throws Exception { String[] keywordsList = {"网络爬虫","搜索引擎"}; int pageToal =5; for (String keyword : keywordsList) { BdiduKeywordCrawler crawler = new BdiduKeywordCrawler(keyword, pageToal); crawler.start(); } } /** * 根据关键词和页号拼接百度搜索对应的URL */ public static String createUrl(String keyword, int pageNum) throws Exception { int first = (pageNum-1) * 10; keyword = URLEncoder.encode(keyword, "utf-8"); return String.format("https://www.baidu.com/s?wd=%s&pn=%s", keyword, first); } }

focus factor 是什么药品,?

美国多维生素补脑营养片,英文介绍:America"s #1 Selling Brain Health SupplementSupports and Maintains Memory, Concentration, and Focus.Think about this...your brain is the most sophisticated, powerful computer ever created, and yet when was the last time you gave it an upgrade? You make your living from your brain. You can"t afford not to give it the nourishment it needs. It"s time for FOCUSfactor, America"s #1 selling Brain Health Supplement.FOCUSfactor is a dietary supplement that contains a unique blend of:VitaminsMineralsAntioxidantsBotanical ExtractsOmega-3 OilsFOCUSfactor supports memory, concentration and focus† through a combination of premium ingredients such as:DHA Omega-3Vitamin DPhosphatidylserineVitamin B-6 and B-12Vitamin ECalciumIronFOCUSfactor"s nutrients and their sources are carefully chosen to support healthy brain function.All naturalNo preservativesNo artificial colorsDoctor-formulatedProprietary, patent-pending blend of nutrientsNo caffeine. No ephedra. No ma huang.It"s never too early or too late to begin working on improving your brain health.These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure or prevent any disease.Suggested Use:As a supplement for adults, take 4 FOCUSfactor tablets in the morning with food. To accommodate body weight, activity level, stress level and/or inadequate diet, take more tablets in the afternoon, up to a maximum of 8 tablets per day.

10年做到CTO 一个美国程序员的职业晋升路[1]

10年做到CTO 一个美国程序员的职业晋升路[1]   我在美国工作了十年,十年的时间,不长也不短,我从一名普通的程序员成长为FreeWheel的CTO。在这期间发生了许多事情,结识了很多朋友,他们在我的成长过程中伸出了无私的援助之手。可以说,没有他们,就没有今天的我。我想,就和大家分享一些我十年中最感动,印象最深刻的小事情吧,也希望能借此机会结识更多的"朋友。   我的职业生涯,从DoubleClick开始。进入DoubleClick,起始于一个机缘巧合,九年以后,我在离开DoubleClick时的告别信中讲道:“……destiny landed me at Doub-leClick……”,指的就是这个巧合。   一个幸运苹果的故事(the story of a fortune cookie)   ——偶入DoubleClick十年前当我准备去纽约度春假时,接到了一个电话。电话是DoubleClick 的一个叫John Bongiorno的猎头打来的,我至今仍记得这个名字,因为“Bongiorno” 是意大利语“早晨好”的意思。他在网上见到了我的简历,希望我能到DoubleClick去面试。坦白讲,我当时并没有在找工作,我答应了他只是因为DoubleClick的总部在纽约,而我正好要去纽约玩。   在到达纽约的当天,我在纽约的朋友请我吃晚饭。你一定听说过国外的中餐馆有一个咱们在国内没见过的习惯:餐后赠送客人幸运饼果“fortune cookie”。我的fortune cookie中的纸条上写着:“You are offered a dream of your life time, say YES!” ,第一次见到如此好的寓意,我很高兴地把纸条放到钱包里。   第二天下午去面试,见到很多人,其中两个人给我印象深刻,一个是Vince Li ,他后来成为我最好的朋友,专注于技术上的发展,是DoubleClick最出色的架构师;另一个是John Heider,当时的工程部副总裁。我和John的谈话进行得非常愉快,他在谈话结束时出乎意料地对我说:“I have such a great feeling that I am going to offer you a job, right at this moment. What do you say?”我很震惊,记起了那个幸运饼果中的小纸条,就拿给他看。John爽朗地笑着,告诉我会很快收到通知书。我真的很快就接到了通知,特别的是,John还随信寄来了一张卡片,他在亲笔题名的卡片上写道:“Diane, I wish your next fortune cookie says DoubleClick, YES!”我非常感动,没想到他会记住我们谈话中一个微不足道的小插曲,更没想到他还为此写了卡片。就因为这张卡片,我在毕业的当天就卷起铺盖到了DoubleClick. John给我上的第一课,便是如何用心去雇人。多年以后在CSDN的CTO论坛上,我曾谈到“用心交人,用心雇人,用心培养人”的重要性,我的第一个老师就是John Heider.   ;

contractor是什么意思 翻译contractor的意思

英音 ["kɔntræktə] ;,美音 ["kɔntræktə] ;,名词 1. 立约人,订约人 2. 承包人,承包商;承揽人 ;合约商 3. 收缩物;【解剖学】收缩肌 4. (定约桥牌的)庄家,定约人;明手 ,(law) a party to a contract,the bridge player in contract bridge who wins the bidding and can declare which suit is to be trumps,a bodily an that contracts,someone (a person or firm) who contracts to build things,contractor supervisor 工地监工员 ,rib contractor 肋骨合拢器 ,contractor report 合同户报告 ,contractor plan 【计】 合同计划 ,forwarding contractor 【法】 承揽运送业, 承揽运输人 ,registered contractor 【法】 注册承包商 ,general contractor 总包者,总承包者 ,advertising contractor 【经】 广告承包商 ,prime contractor 主要订约商 ,contractor fee 给承包人(或包工单位)的报酬 ,contractor n. 1. 立约人,订约人 2. 承包人,承包商;承揽人 ;合约商3. 收缩物;【解剖学】收缩肌 4. (定约桥牌的)庄家,定约人;明手,wood contractor 木材包商,sub contractor 分承包人,副承包商,co contractor 【经】 联合承包商

bioaccumulation factor简称BAF,代表什么意思,怎样计算?

生物积累系数可通过生物蓄积因子BCF转化得到

factors influencing the choice of domestication and foreignization

Currently, most Chinese scholars use foreignization /domestication as their English renditions for yihua/guihua. Does the Chinese debate originate with Venuti (1995)? A historical review shows that Lu Xun used the term of guihua (assimilation or domestication) in talking about translation as early as 1935. And the word yihua is already included in Dictionary of Modern Chinese published in 1978 and reprinted in 1991. This means that the two terms are not recent loan words from the West. Then

绿灯侠里面的反派(Hector)是谁?为什么变成那样?

电影版里是Hal儿时的玩伴,父亲是政府高官,暗恋卡罗。因对Abin sur进行尸检时被黄色力量感染,就变得像视差怪一样了。

linux系统启动提示:mount:can"t read "proc/mounts":no such file or directory 不知道如何解决?谢谢了

这个问题正常使用不应该出现。你什么系统?

victorian是什么意思

人名:维多利亚;维多利亚女王其他:维多利亚时代;维多利亚女王时代的人

aberctombie 是什么意思

Abercrombie 是美国的一服装品牌,全名: Abercrombie & Fitch,公司网站:abercrombie.com这品牌在美国青少年中非常流行。服装设计很漂亮,价格不贵,是一大众名牌。这aberctombie估计是厂家故意将字母r 改成了 t,可以说是自己的品牌,但实为故意 让顾客错以为是美国的Abercrombie 品牌

英语翻译 it involves many factors对吗 ,用involve时如何译

可以用"It involves many factors." 也可用被动语态:Many factors are involved in it. ---- 你可根据需要选用一种.

什么是ick factor?what the heck is that?

意思是:ick 因素?那是什么鬼东西?前面那个我也不知道是什么

numerous factors

对一些人来说,他们别无选择,就像提供资金就能恢复快速道路的运转那样自然.而对另外一些人,最终选择的做出则出于众多的考虑因素.

vuldetector.exe 怎样卸载

点击——开始——设置——控制面板——添加或删除软件——找到vcredist_x86.exe——删除——重启电脑。 也可以用360来删除。

You"d better see a doctor about that cough. 这英语里about cough是什么成分,在这里是什么意思?

名词,咳嗽。about that cough整个短语作状语

director,superior,leader有何区别

director:导演、主任、总监、处长... superior:上级的...、占优势的... leader:领导、首领、指挥者、乐队指挥、领唱者、领奏者... 我还没说全,自己查查字典吧!

direction和 director

direction[dəˈrekʃn]n. 方向;指导;趋势;用法说明director [dɪ"rektə]n. 主任,主管;导演;人事助理希望能够帮助到您

collect的用法和其后缀的一些用法 collect collection collectible collective collector

collecting 收集 动词进行时 BE+V ING 表示正在干什么 collect 收集 动词一般时 做谓语 S +V+O 什么干什么 collector 收藏家 名词 做主语或者宾语 collection 收藏 名词 做主语或者宾语
 首页 上一页  29 30 31 32 33 34