mozilla

网站流量分析项目day02

北慕城南 提交于 2019-11-30 16:06:20
1. 数据采集之Flume Taildir Source 相当于exec + spool的功能,还有断点续传功能。Flume1.7版本以上才有此功能,可以监控一个目录,并且根据正则表达式对目录中文件名对文件进行实时收集。 注意1:当只以文件大小的方式进行滚动,如果文件不满足条件,会永远处于临时状态。 解决办法1:停止Flume(不推荐) 解决方法2:设置参数:hdfs.idleTimeout,当文件不满足滚动条件的时候,文件在一定时间(hdfs.idleTimeout)内没有任何操作,此时让其执行滚动。 注意2:Flume设置某一种滚动方式,在满足条件后,文件滚动到了第一个datanode后,还需要向其他副本复制,这个也是需要花费时间的,默认是当每个副本都复制完Flume才会认为完成,这时候Flume就会还认为没有写入成功,会继续传递数据。 解决办法:设置参数hdfs.minBlockReplicas=1,这时候Flume就会认为检测到只有一个副本,只要一个写入成功就会认为成功,其他的复制过程还是由hdfs完成。 2. 模块开发之数据预处理 根据目标制定规则,过滤掉“不和规定”的数据,清洗无意义的数据。 a. 实现方式:MR 一般字段比较多,这时候我们会封装成javabean对象,有了javabean对象我们就还要实现writable序列化接口

render HTML (convert to bitmap)

萝らか妹 提交于 2019-11-30 16:02:44
Can somebody recommend the best (and preferably portable) way to render HTML documents onto a bitmap? As far as I understand my main 2 options are WebKit and Gecko, but I wasn't able to find a good starting point on how to do it. When I last tried doing this 5 years ago, I ended up using Gecko to send the document to a printer, which is not really what I need. I need rendering to a in-memory bitmap. To clarify: server side, no Java, no .NET, batch processing, performance, not interactive, no Javascript. You can do this from the command line using webkit2png.py , which uses Python and QtWebKit

Python爬虫对知乎问题下的图片进行爬取

微笑、不失礼 提交于 2019-11-30 12:06:06
知乎的反爬做得很严格 1.翻页信息在首页的url不更新 2.要拿到所有图片需要翻页,同时不能用问题首页的url,信息所在如下图,翻页信息,data里面几乎有所有需要的信息 3.访问频率限制,这严重影响了爬虫的速度,我多次用try-except做出调整,防止程序崩溃 这就是我爬取知乎信息后的一些经验分享,有很多不足,谢谢指正 详细思路在代码和注释中: #爬取知乎回答下面照片的爬虫 #难点:异步加载,同时翻页信息不在html中 import requests import json from bs4 import BeautifulSoup import re import os import random from time import sleep jsError = 0 #统计json报错次数,使用了一个全局变量 #在网上找了多个user-agent,然后每次访问时利用随机库在其中随机选择一个 headerstr = '''Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0) Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Mozilla/5.0

IE & Firefox - custom drop down could not remove native arrows

旧城冷巷雨未停 提交于 2019-11-30 06:25:05
问题 I'm trying create a custom drop down control and I need to hide the arrows from the native controls. I'm using the following CSS , which is working for Chrome and Safari, but not in Mozilla and IE. select.desktopDropDown { appearance: none; -moz-appearance:none; /* Firefox */ -webkit-appearance:none; /* Safari and Chrome */ } Here is a [jsfiddle][1]. 回答1: Use this it will work but with IE10+ and for FF : Your css should look like this: select.desktopDropDown::-ms-expand { display: none; }

CSS Border for checkbox

拟墨画扇 提交于 2019-11-30 04:51:03
问题 I am applying a style for a checkbox from jQuery $("#reg_checkbox").css("border","thin solid red"); The border works fine in IE but not in mozilla , how can I make it browser compatible ? 回答1: Use Outline: http://jsfiddle.net/Kqcx7/1/ $('#reg_checkbox').css('outline-color', 'red'); $('#reg_checkbox').css('outline-style', 'solid'); $('#reg_checkbox').css('outline-width', 'thin'); 回答2: First result on Google - seems like this one worked for them: http://www.webdeveloper.com/forum/showthread.php

IE 11 browser recognizes itself as Mozilla [duplicate]

这一生的挚爱 提交于 2019-11-30 04:07:47
问题 This question already has answers here : Get browser name by jquery (3 answers) Closed 5 years ago . I am working on MVC application, .net 4.5 framework, VS 2010. I have a piece of Javascript code that identifies which browser the application is running. If the browser is Firefox then a particular block of code will be executed if not another block code will get executed. With IE 11 I am having a weird problem. The browser (ie 11) recognizes itself as Mozilla. javascrip code : if ($.browser

CSS学习(4)更多的选择器

落花浮王杯 提交于 2019-11-30 03:46:38
1.通配符选择器 * 表示选中所有元素 *{color:red;} 2.属性选择器 根据属性名和属性值选中元素 https://developer.mozilla.org/zh-CN/docs/Web/CSS/Attribute_selectors 3.伪类选择器 选中某些元素时的某种状态 hover:鼠标悬停时的状态 active:鼠标按下时的状态 a:hover{color:red;} 4.伪元素选择器 https://developer.mozilla.org/zh-CN/docs/Web/CSS/pseudo-elements 组合选择器 https://developer.mozilla.org/zh-CN/docs/Web/Guide/CSS/Getting_Started/Selectors 来源: https://www.cnblogs.com/1016391912pm/p/11553667.html

[翻译]Mozilla的JSON

半腔热情 提交于 2019-11-30 00:59:53
JSO N 原文地址:https://developer.mozilla.org/en-US/docs/JSON 已经提交至Mozilla,地址是:https://developer.mozilla.org/zh-CN/docs/JSON 译者能力有限,欢迎拍砖 感觉这个文章有些地方已经超越我的能力了,很难翻译成人话~~别的不说了,拍砖吧亲们~~ 不过话说回来感觉这文章看的人应该不多~ 正文开始 JSON ( JavaScript Object Notation ) JSON ( JavaScript Object Notation ) 是一个数据交换格式。它非常的接近于 JavaScript 语法的子集,尽管它不是一个严格的子集。(详细见 JavaScript参考 中的 JSON 。)当你在写任何基于JavaScript的应用程序的时候它都是非常有用的,包括网站和浏览器拓展。举个例子,也许你会把用户信息储存成JSON格式并放到 cookie 中,或者你会把拓展偏好(extension preferences)储存成为JSON格式在一个字符串值(string-valued)的浏览器偏好(browser preference)中。 JSON 的才能是由数、布尔,字符串,null以及数组(按照值的顺序排列)甚至对象(string-value mappings)这些值的表示来组成的

PDF.js scale PDF on fixed width

♀尐吖头ヾ 提交于 2019-11-29 21:03:45
I have a fixed box where I want to display my PDF's in rendered by PDF.js. As PDF.js documentation is not really accessible (spitting through their source files), I'd like to know whether it's possible to scale a rendered PDF on a fixed width. When I set as CSS: canvas { width: 600px; } for the canvas displaying the PDF, the PDF gets stretched, and the quality gets poor. halex I updated the example from the Pdf.js github http://jsbin.com/pdfjs-prevnext-v2/edit#html,live to scale properly to a fixed canvas width. See http://jsfiddle.net/RREv9/ for my code. The important line is var viewport =

-moz-background-clip: *text* in Mozilla

可紊 提交于 2019-11-29 20:30:27
问题 Is there a good way to implement this in Mozilla? I have done it successfully in Webkit using -webkit-background-clip: text;. I have been trying to implement it into Firefox with no success. MDN has it listed as -moz-background-clip but there is no 'text' attribute. The finalized CSS3 attribute is background-clip but I have not been able to find if 'text' is a valid option across engines or if it is a webkit only thing. Thanks in advance for the clarification! 回答1: I think Webkit is on their