鍍金池/ 問答
有點壞 回答

圖片描述


    class User {
        private String country;
        private String province;
        private String name;

        public User(String country, String province, String name) {
            this.country = country;
            this.province = province;
            this.name = name;
        }

        public String getCountry() {
            return country;
        }

        public void setCountry(String country) {
            this.country = country;
        }

        public String getProvince() {
            return province;
        }

        public void setProvince(String province) {
            this.province = province;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
    class Res {
        private String country;
        private String province;
        private Integer count;

        public Res(String country, String province, Integer count) {
            this.country = country;
            this.province = province;
            this.count = count;
        }

        public String getCountry() {
            return country;
        }

        public void setCountry(String country) {
            this.country = country;
        }

        public String getProvince() {
            return province;
        }

        public void setProvince(String province) {
            this.province = province;
        }

        public Integer getCount() {
            return count;
        }

        public void setCount(Integer count) {
            this.count = count;
        }
    }

    @Test
    public void test1() throws Exception {
        List<Res> result = new ArrayList<>();

        List<User> list = new ArrayList<>();
        list.add(new User("中國", "北京", "張三"));
        list.add(new User("中國", "北京", "張三"));
        list.add(new User("中國", "北京", "李四"));
        list.add(new User("中國", "北京", "李四"));
        list.add(new User("中國", "北京", "李四"));
        list.add(new User("中國", "北京", "王五"));
        list.add(new User("中國", "湖南", "張三"));
        list.add(new User("中國", "湖南", "張三"));
        list.add(new User("中國", "湖南", "張三"));

        list.stream()
                .collect(Collectors.groupingBy(e -> e.getProvince()))
                .forEach((k, v) -> {
                    StringBuilder count = new StringBuilder("0");
                    v.stream().
                            collect(Collectors.groupingBy(e -> e.getName()))
                            .forEach((k2, v2) -> {
                                if (v2.size() > 1) {
                                    int c = Integer.parseInt(count.toString());
                                    count.delete(0, count.length());
                                    count.append(c + v2.size());
                                }
                            });
                    result.add(new Res(v.get(0).getCountry(), v.get(0).getProvince(), Integer.parseInt(count.toString())));
                    count.delete(0, count.length());
                });
        System.out.println(new ObjectMapper().writeValueAsString(result));
    }

StringBuilder只是起了一個計數(shù)的作用, 雖然有點low~

真難過 回答

如果是報超出范圍可以先判斷一下

r = each.xpath("./td[2]/text()").extract()
item['position_Type'] = r[0] if r else None
妖妖 回答

^[a-z]([a-z]|((?<!_)_))*[a-z]$

題主說明是javascript,是支持負(fù)向零寬斷言的(TAT)。上面的表達(dá)式?jīng)]法用。

建議分兩部分判斷:

  1. 第一部分判斷只包含小寫字母和下劃線和頭尾
    ^[a-z][a-z_]*[a-z]$
  2. 第二部分判斷兩個相連的下劃線
    str.indexOf("__") === -1

我剛才以為js支持負(fù)向斷言,是因為chrome的v8引擎自己實現(xiàn)了這個功能。。。

題外話,推薦正則表達(dá)式測試網(wǎng)站:regex101,可以直接在下面寫測試數(shù)據(jù)看匹配情況,記得flag選擇multiline支持多行數(shù)據(jù)。

ps.正則表達(dá)式相關(guān)的問題建議加上相應(yīng)語言的標(biāo)簽或者說明語言,因為有些語言的正則表達(dá)式實現(xiàn)是不同的。

替身 回答

這個是語言設(shè)定的時候?qū)?shù)值類型定死的。
就像int是整型,double是雙精度一樣。
你只要記得它能存儲多少有效數(shù)據(jù)就可以了。

近義詞 回答

單一組件的state放在組件內(nèi)就好,多個組件共享的state再放到store

你的瞳 回答

提問記得減小別人回答的成本,比如這里最好給一個直接可以運行的Option

解決方案是用offset屬性

http://echarts.baidu.com/opti...

clipboard.png

陌如玉 回答

@click.stop.prevent="beActive(index)"

---》 @click.stop.prevent="beActive($event,index)"

這里改下試試。

鹿惑 回答

手冊上40003是openid的問題,你檢查下看看是不是openid存取有問題。

放開她 回答

改成這樣的,多添加一個屬性即可

new HtmlWebpackPlugin({
  filename: "login",
  template: "./public/index.html", // 模板文件
  chunks: ["common", "login"], // 選擇使用哪些生成的文件
  chunksSortMode: "manual" // manual根據(jù)chunks的位置手動排序
})

重點是這個:chunksSortMode

骨殘心 回答

為什么要在最后才配置這個?這個應(yīng)該放在最前面,你試試放在第一個看看效果!

爆扎 回答

上面的元素使用了浮動,但并未清除浮動導(dǎo)致的

別硬撐 回答

我看到里面有幾行 Dosgi.requiredJavaVersion=1.8,看看是不是只能用 1.8

不討囍 回答

1、刪除今天以前的數(shù)據(jù),那是說每天凌晨刪除昨天數(shù)據(jù)即可,你一天就1000W?刪除也不需要排序,直接delete from table where 。。 limit 1000即可。另外也可以每次刪除更少量的數(shù)據(jù),避免產(chǎn)生鎖,執(zhí)行頻率高一點就行。
2、也可以采用分區(qū)的方式,按天分區(qū),每天刪除過期分區(qū)表

這個問題本人已解決,在File ImageFile=new File(strImageUrl);打斷點,開啟調(diào)試模式,
斷點運行到GeoTiffReader reader=new GeoTiffReader(ImageFile);時,按F5(進入函數(shù)內(nèi)部),但是沒有運行函數(shù),而是跳到classloader.class。
為了加載類時唯一,改為org.geotools.gce.geotiff.GeoTiffReader reader=new org.geotools.gce.geotiff.GeoTiffReader(ImageFile);運行正常。
圖片是GeoTiffReader類的內(nèi)部函數(shù)。
圖片描述

哎呦喂 回答

再次自問自答一波,反復(fù)看了 文檔 以及
Github 上的一些 issue 得出的結(jié)論:

  • 首先看文檔
默認(rèn)情況下,「索引」會從模型的 toArray 方法中讀取數(shù)據(jù)來做持久化。如果要自定義同步到搜索索引的數(shù)據(jù),可以覆蓋模型上的 toSearchableArray 方法:
...
public function toSearchableArray()
{
    $array = $this->toArray();

    // Customize array...

    return $array;
}
...
  • 看來我之前的理解是錯誤的,文檔的意思是你必須用基于 toArray() 方法返回的數(shù)據(jù)才行,所以如果你需要篩選要索引的數(shù)據(jù)的話,你必須圍繞它來作文章,例如你只想要索引文章的標(biāo)題和內(nèi)容的話:
...
public function toSearchableArray()
{
    #_ Read Data & Filter Field
    $Arr_Posts = array_only($this -> toArray(), ['title', 'content']);
    #_ Back to Scout
    return $Arr_Posts;
}
...
脾氣硬 回答

input和下拉框作為兄弟節(jié)點定位到同一個父元素。

愿如初 回答

。。主題less可以放在你的自己項目目錄下管理,就行了吖。