鍍金池/ 問答/ 網(wǎng)絡(luò)安全問答
心夠野 回答

webpack吧,用的人多呀

  1. 一個(gè)map和reduce完成不了. 中間要再加一個(gè)combiner.
  2. 捋一下思路
    假設(shè)a.txt文件里數(shù)據(jù)是{tom jack tom jack rose tom}
    那么map的輸出就是
    <tom,1> <jack,1> <tom,1> <jack,1> <rose,1> <tom,1>
    然后匯總工作到reduce去做.reduce接收的就是這樣的數(shù)據(jù)
    <tom,[1,1,1]><jack,[1,1]><rose,[1]>
    reducer輸出的是<tom,3><jack,2><rose,1>, 這樣就統(tǒng)計(jì)出來了. 當(dāng)然這是普通的做法

你現(xiàn)在想要實(shí)現(xiàn)的是同級單詞在a文件和b文件...中各出現(xiàn)的次數(shù).
假設(shè)有兩個(gè)文件a.txtb.txt.
a文件里面的數(shù)據(jù)是{tom jack tom jack rose tom}
b文件里面的數(shù)據(jù)是{google apple tom google rose}
把編號換成了文件名.
map的輸出就是這樣<tom:a.txt,1> <jack:a.txt,1> <tom:a.txt,1><jack:a.txt,1> <rose:a.txt,1>

           <google:b.txt,1><apple:b.txt,1><tom:b.txt,1>....

這樣的數(shù)據(jù)給到reducer,reducer統(tǒng)計(jì)不了.因?yàn)閗ey不相同.key有的是<tom:a.txt,1><tom:b.txt,1>.
為了解決這個(gè)問題,map輸入的內(nèi)容不要直接到reducer中,中間加一層combiner來處理匯總數(shù)據(jù)
combiner接收<tom:a.txt,1><tom:b.txt,1>
combiner把key做一下切割 .切割成<tom, a.txt:1 ><tom , b.txt:2> ,這樣key相同了.就可以統(tǒng)計(jì)了
下面把代碼貼上 注[我用的是文件的名稱,不是文件里的開頭編號,要用的話還得把文件名換成編號,這樣做有寫問題,你可以下去試一試.我找到解決辦法在補(bǔ)充.]
mapper類

public class WCMapper extends Mapper<LongWritable,Text,Text,Text>{

    Text text = new Text();
    Text val = new Text( "1" );

    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

        String line = value.toString();
        String [] strings = line.split( " " ); //根據(jù)空格切割

        FileSplit fileSplit = (FileSplit) context.getInputSplit();// 得到這行數(shù)據(jù)所在的文件切片
        String fileName = fileSplit.getPath().getName();// 根據(jù)文件切片得到文件名

        for (String s : strings){
            text.set(s + ":" + fileName);
            context.write(text,val);
        }
    }
}

combiner類

public class WCCombiner extends Reducer<Text,Text,Text,Text> {
    Text text = new Text( );
    @Override
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        //map傳進(jìn)來的是 <apple:2 , 1> <google:2 ,1>

        int sum = 0; //統(tǒng)計(jì)詞頻
        for (Text val : values){
            sum += Integer.parseInt(val.toString());
        }

        //切割key
        int index = key.toString().indexOf( ":" );
        text.set(key.toString().substring( index + 1 ) + ":" + sum); // value ---> 2:1
        key.set( key.toString().substring( 0,index )); // key --> apple
        context.write( key,text );
    }
}

reducer類:

public class WCReduce  extends Reducer<Text,Text,Text,Text>{


    Text result = new Text(  );
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        String file = new String();

        for (Text t : values){
            file += t.toString();
        }

        result.set( file );

        context.write( key,result);
    }
}

注[本地鏈接的linux環(huán)境hadoop] ,要在本機(jī)的/etc/hosts文件中添加 export HADOOP_USER_NAME=hdfs
a.txt和b.txt都是單詞,以空格分割,你可以做假數(shù)據(jù)測試一下.
這是測試結(jié)果.

clipboard.png

貓館 回答

遠(yuǎn)程調(diào)試要求實(shí)際運(yùn)行代碼的機(jī)器里,php.ini配置文件里的xdebug.remote_host、xdebug.remote_port必須是IDE軟件所在機(jī)器的IP和端口號。這點(diǎn)非常重要。

其他參考:https://www.cnblogs.com/52fhy...

選擇 回答

你好,樓主有解決嗎

她愚我 回答

一般導(dǎo)出就好了啊。不過我覺得AI輸出的SVG太臟,所以喜歡用Inkscape直接打開AI,然后再輸出為SVG。
當(dāng)然,如果這些方法輸出的還有問題,那不排除是源文件本身的問題。

魚梓 回答

可能原因是vue-loader的版本沒跟上其他包的版本導(dǎo)致解析器不運(yùn)行,在我把vue-loader包全都更新到14.2.3之后,該錯(cuò)誤就不報(bào)了

膽怯 回答

你的if (!($(this)[href=pre_url])) {}這個(gè)我沒看懂是什么意思,不是這樣判斷的
$('#a').remove();是直接刪除id=a你的用法不對
$("a[href!='']").each(function() {})多余了$("a[href!='']").on('mouseenter')會給所有選擇到的元素添加事件

$(document).ready(function() {
    $("a[href!='']").on('mouseenter', function(event) {
        var bool = false;
        var pre_url = $(this).attr("href");
        $("link").each(function() {
            if (($(this).attr("href")==pre_url)) {//判斷是否已經(jīng)存在存在則不添加
                bool = true
            }
        });
        if(!bool){
            $("head").append('<link rel="prerender" href="' + pre_url + '">');
        }
    });
    $("a[href!='']").on('mouseleave', function(event) {
        var pre_url = $(this).attr("href");//只要鼠標(biāo)移出就刪除 所有不用判斷
        $('link[href="' + pre_url +'"]').remove();
    });
});
冷咖啡 回答

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hisen</groupId>
<artifactId>BookSystem_V0</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>BookSystem_V0 Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
    <!-- 單元測試 -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>
    <!-- 1.日志 -->
    <!-- 實(shí)現(xiàn)slf4j接口并整合 -->
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.1.1</version>
    </dependency>
    <!-- 2.數(shù)據(jù)庫 -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.37</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>
    <!-- DAO: MyBatis -->
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis-spring</artifactId>
        <version>1.2.3</version>
    </dependency>
    <!-- 3.Servlet web -->
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.5.4</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
    </dependency>
    <!-- 4.Spring -->
    <!-- 1)Spring核心 -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <!-- 2)Spring DAO層 -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <!-- 3)Spring web -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
</dependencies>
<build>
    <finalName>BookSystem_V0</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

</project>

葬憶 回答

報(bào)錯(cuò)是你的網(wǎng)絡(luò)連接問題,檢查一下你的網(wǎng)絡(luò)情況,看代理有沒有問題。

吃藕丑 回答

form data 然后又得有 json 那種多維度的,在一些項(xiàng)目里面確實(shí)有

尕筱澄 回答

好吧,這個(gè)問題我自己來回答啦。

在linux系統(tǒng)上,使用tcpdump抓包結(jié)束之后會提示:

抓包結(jié)束的提示

簡單來說, captured是tcpdump處理過之后,得到的數(shù)據(jù)包數(shù)量,亦即最終獲得的pcap文件中數(shù)據(jù)包數(shù)量; received是經(jīng)過過濾器處理的所有數(shù)據(jù)包; dropped則是未經(jīng)處理的數(shù)據(jù)包數(shù)量。
received by filter的結(jié)果這取決于運(yùn)行tcpdump的操作系統(tǒng)及其配置。如果指定一個(gè)過濾器,包無論是否被篩選器表達(dá)式匹配,即使他們被篩選器表達(dá)式匹配,無論tcpdump是否讀取和處理他們,都會進(jìn)行計(jì)算,即收到一個(gè)包,received by filter會加1。如果sock的接收buffer被填滿時(shí),則把這個(gè)數(shù)據(jù)包丟棄,將dropped by kernel加1,所以 received by filter和dropped by kernel的計(jì)數(shù)由內(nèi)核維護(hù)。
造成丟包的原因,是由于libcap抓到包后,tcpdump上層沒有及時(shí)的取出,導(dǎo)致libcap緩沖區(qū)溢出,從而丟棄了未處理包,此處即顯示為dropped by kernel。這里的kernel并不是說是被linux內(nèi)核拋棄的,而是被tcpdump的內(nèi)核,即libcap拋棄掉的。

解決辦法也有一些,比如:
1、-n 參數(shù),禁止反向域名解析()
2、-s 參數(shù),控制抓取數(shù)據(jù)包的長度
(采用更大的捕捉范圍既增加了處理報(bào)文的時(shí)間,又相應(yīng)的減少了報(bào)文的緩沖數(shù)量,可能導(dǎo)致報(bào)文的丟失。嘗試把snaplen設(shè)的盡量小,只要能夠容納需要的協(xié)議信息就可以。)
3、將數(shù)據(jù)包輸出到cap文件
4、用sysctl修改SO_REVBUF參數(shù),增加libcap緩沖區(qū)長度

方法1我試過了,效果不理想。
方法2也試過了,效果不錯(cuò)。但我本來就是要測抓包性能的,肯定得把包抓全啊,想想之后放棄了這個(gè)方案。
方法3這個(gè).....我本來就是輸出到文件里的,但還是有丟包的問題,所以好像并沒有什么卵用。
方法4感覺有點(diǎn)復(fù)雜,不過前面解釋里也提到是因?yàn)榫彌_區(qū)不夠才導(dǎo)致的丟包,遂覺得這方法有門,不過就是麻煩了一點(diǎn)。然后靈機(jī)一動(dòng),我查到了tcpdump里有個(gè)-B參數(shù)可以修改緩沖區(qū)大小,哈哈!!

所以最后的解決辦法就是:我使用-B參數(shù)修改了tcpdump的緩沖區(qū)大小?。。?br>這里要注意的是如果未指定 -B 選項(xiàng),那么緩沖區(qū)大小缺省為32768,既然這樣我就乘二試了試,-B 65535。
嘻嘻,一下子什么丟包都飛走了~~

選擇 回答

講真,不太理解題主想表達(dá)的。。。建議以后提問盡量簡化,不需要的代碼可以刪除(比如前面ele自己的提供的案例)
圈重點(diǎn):ele的表單驗(yàn)證對應(yīng)的是el-form-item標(biāo)簽的prop變量,驗(yàn)證的值是綁定的v-model的值,需要注意的是prop變量必須是el-form標(biāo)簽綁定的:data對象的屬性,否則也無法驗(yàn)證

陌如玉 回答

探測以下允不允許這些報(bào)頭,該地址支持什么method,有沒有觸發(fā)同源保護(hù)等等,否則貿(mào)貿(mào)然請求過去,萬一不行,很浪費(fèi)資源和時(shí)間。

司令 回答

主要關(guān)鍵解解決辦法:===》》適用于所有東西的安裝

安裝有關(guān)環(huán)境配置類的軟件及其他,一般情況下切記不要安裝到c盤programfiles下,否則會出現(xiàn)各種問題的報(bào)錯(cuò)?。。∏杏?!

nvm安裝步驟:

1、下載nvm-setup安裝包

2、打開安裝包,選擇nvm的存放路徑,以及nodejs的存放路徑,這里切記不要選擇到c:/program files,這里的兩個(gè)路徑是為了自動(dòng)在系統(tǒng)中添加環(huán)境變量的路徑;

3、打開nvm文件夾下的settings.txt文件,在最后添加以下代碼:

node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

將下載鏡像源指向淘寶(這步也很重要,否則在安裝node的時(shí)候會出現(xiàn)卡死,npm安裝不成功的情況)

4、打開cmd,nvm install v版本號,

5、nvm use 版本號

6、node -v,npm -v查看node是否安裝成功

安裝好之后的node文件夾截圖:
clipboard.png

如果出現(xiàn)nvm use之后 node版本依然沒有選中 或者其他等等情況,那就卸載nvm重新安裝繼續(xù)試!

心夠野 回答

不是PHP的問題. 是Java的事.

你這兒應(yīng)該使用的是 form 方式上傳的. 這是application/x-www-form-urlencoded格式.
你的&沒轉(zhuǎn)義, 在服務(wù)器商肯定接收不到正確數(shù)據(jù).

你可以直接上傳json格式字符串, 在PHP里用file_get_contents('php://input') 取值. 然后解析.