在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ Java問答
夏木 回答

這是一個很常見的功能,樹菜單可以考慮用的是EasyUI Tree做的,勾選后顯示標(biāo)簽這是簡單的js。這是EasyUI 中文網(wǎng)站,有關(guān)tree的使用。http://www.jeasyui.net/demo/5...

爆扎 回答

連接慢的主要原因是DNS解析導(dǎo)致
一、測試查找具體原因:
1、使用ssh -v host進(jìn)行debug

ssh -v 192.168.100.10

然后就會輸出一大堆debug,通過debug信息就可以看到連接到什么地方被耽擱了
比如會顯示如下信息:
[html] view plain copy
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found

2、檢測連接時間

time ssh root@192.168.100.10 exit

二、解決方法(建議一個個設(shè)置,因?yàn)槊總€人連接慢的原因都不一樣):

注意:修改之后記得重啟sshd服務(wù)

service sshd restart

1、關(guān)閉DNS反向解析
在linux中,默認(rèn)就是開啟了SSH的反向DNS解析,這個會消耗大量時間,因此需要關(guān)閉。

vi /etc/ssh/sshd_config

UseDNS=no

在配置文件中,雖然UseDNS yes是被注釋的,但默認(rèn)開關(guān)就是yes

2、關(guān)閉SERVER上的GSS認(rèn)證
在authentication gssapi-with-mic有很大的可能出現(xiàn)問題,因此關(guān)閉GSS認(rèn)證可以提高ssh連接速度。

vi /etc/ssh/sshd_config

GSSAPIAuthentication no

3、修改server上nsswitch.conf文件

vi /etc/nsswitch.conf

找到
hosts: files dns
改為
hosts:files

hosts: files dns這一行含義是對于訪問的主機(jī)進(jìn)行域名解析的順序,是先訪問file,也就是/etc/hosts文件,如果hosts中沒有記錄域名,則訪問dns,進(jìn)行域名解析,如果dns也無法訪問,就會等待訪問超時后返回,因此等待時間比較長。
注意:如果SERVER需要通過域名訪問其他服務(wù)器,則需要保留此行。

4、修改SERVER上resolv.conf文件
4.1、刪除/etc/resolv.conf中所有不使用的IP。
4.2、把nameserver全部刪除,問題也能解決,但是服務(wù)器就無法上網(wǎng)了。
4.3、如果SERVER曾經(jīng)配置過雙網(wǎng)卡,則在該文件中會有一行目前不使用的IP地址,刪除該行即可。

5、修改SERVER上hosts文件
在SERVER上/etc/hosts文件中把客戶端的IP和HOSTNAME加入

6、打開SERVER上的IgnoreRhosts參數(shù)
IgnoreRhosts參數(shù)可以忽略以前登錄過主機(jī)的記錄,設(shè)置為yes后可以極大的提高連接速度

vi /etc/ssh/sshd_config

IgnoreRhosts yes

7、修改客戶端的hosts文件
將目標(biāo)SERVER的IP和域名加上去,使得本機(jī)的DNS服務(wù)能解析目標(biāo)地址。

vi /etc/hosts

192.168.100.11 doiido.com

注:hosts文件格式為'目標(biāo)SERVER_IP 目標(biāo)SERVER_NAME'。但是使用這個方法有一個弊端,如果需要給每臺SERVER都添加一個域名解析。

8、修改客戶端配置文件ssh_conf(注意,不是sshd_conf)

vi /etc/ssh/ssh_conf

找到
GSSAPIAuthentication yes
改為
GSSAPIAuthentication no

兔寶寶 回答

getOne 是 lazy load 的

你加上這個 spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true

涼心人 回答

自己寫一個函數(shù)行不?如果你你是用Java 8:

Function<BigDecimal, String> format = x -> BigDecimal.ZERO.equals(x) ?"-0.00" : String.format("%.2f", x);
System.out.println(format.apply(new BigDecimal(0)));
System.out.println(format.apply(new BigDecimal(1)));
System.out.println(format.apply(new BigDecimal(-1)));
妖妖 回答

1.如何抓取多個網(wǎng)站的文章?
答:不同的網(wǎng)站,意味著html結(jié)構(gòu)、分頁格式都會不一樣,只能針對不同的網(wǎng)頁,寫不同的解析程序。
2.如何整理爬蟲信息?
答:你肯定是知道要抓取什么內(nèi)容的不是嗎?如標(biāo)題,內(nèi)容,作者等等,無非就是key-value,將值存在數(shù)據(jù)庫對應(yīng)的字段即可。

情皺 回答

//因?yàn)槭敲ご蜻^來的,我驗(yàn)證的數(shù)據(jù)并不是這個,但是為了符合題目還是寫了這個,所以參數(shù)有可能在表格中位置會
//有點(diǎn)不對,但是實(shí)驗(yàn)一下還是可以很容易看出來的。

    String[] p = {"p1","p2"};
    String[] price = {"10","20"};
    int rindex = 0;
    Name name;
    HSSFWorkbook workbook = new HSSFWorkbook();//excel文件對象
    HSSFSheet sheet = workbook.createSheet("Info");//工作表對象
    HSSFSheet hidesheet = workbook.createSheet("hideSheet");//隱藏一些信息
    
    HSSFRow row = hidesheet.createRow(rindex++);
    //設(shè)置物品編號
    for(int i=0;i<p.size();i++) {
        HSSFCell cell = row.createCell(i);
        cell.setCellValue(p[i]);
    }
    // 名稱管理
    name = workbook.createName();
    name.setNameName("物品編號");
            name.setRefersToFormula("hidesheet!$A$"+rindex+":$"+judgePos(p.size())+"$"+rindex);
    for(int i=0;i<p.size();i++){
        HSSFRow row = hidesheet.createRow(rindex++);
        HSSFCell cell = row.createCell(0);
        cell.setCellValue(p[i]);
        cell = row.createCell(1);
        cell.setCellValue(price[i]);
    }
    String[] title = {"物品編號","物品價格"};
    setTitle(sheet ,title,0);
    
    HSSFRow allocationRow = sheet.createRow(rindex++);
    **allocationRow.createCell(4).setCellFormula("LOOKUP(A2,hideSheet!A2:A3,hideSheet!B2:B3)");**
    
    // 得到驗(yàn)證對象
    DataValidation validation = getDataValidationByFormula("物品編號",2,1);
    // 工作表添加驗(yàn)證數(shù)據(jù)
    sheet.addValidationData(validation);
    
    // 生成輸入文件
    File file = new File(filePath);
    FileOutputStream out = new FileOutputStream(file);

    workbook.write(out);
    out.close();
    

//以上大概就是個全過程,主要是設(shè)置LOOKUP函數(shù),我原先一直沒搞出來是因?yàn)楹瘮?shù)參數(shù)寫錯了,搞半天沒搞出來,今天搞出來了。
//用到的函數(shù)我也貼一下,有些用別人的,有些自己寫的。

/**

 * 返回所在列的字符
 * @param size
 * @return
 */
public String judgePos(int size) {
    String[] args= {"A","B","C","D","E","F","G","H","I","J","K","L","M","N",
            "O","P","Q","R","S","T","U","V","W","X","Y","Z"};
    boolean tag=true;
    StringBuffer reversepos=new StringBuffer();
    while(tag) {
        int pos=size%26;
        if(pos==0) {
            pos=25;
            size--;
        }else {
            pos-=1;
        }
        int result = size/26;
        if(result==0) {
            reversepos.append(args[pos]);
            tag=false;
        }else {
            reversepos.append(args[pos]);
            size/=26;
        }
    }
    return reversepos.reverse().toString();

}
/**
 * 創(chuàng)建表頭
 * @param sheet
 * @param title
 */
public void setTitle(HSSFSheet sheet,String[] title,int index) {
    HSSFRow row = sheet.createRow(index);
    for(int i=0;i<title.length;i++) {
        HSSFCell userNameLableCell = row.createCell(i);
        userNameLableCell.setCellValue(title[i]);
    }
}


/**
 * 使用已定義的數(shù)據(jù)源方式設(shè)置一個數(shù)據(jù)驗(yàn)證
 *
 * @param formulaString
 * @param startRow
 * @param startCol
 * @return
 */
public static DataValidation getDataValidationByFormula(String formulaString,int startRow,int startCol) {
    // 加載下拉列表內(nèi)容
    DVConstraint constraint = DVConstraint.createFormulaListConstraint(formulaString);

    // 設(shè)置數(shù)據(jù)有效性加載在哪個單元格上。
    // 四個參數(shù)分別是:起始行、終止行、起始列、終止列
    int firstRow = startRow-1;
    int lastRow = startRow-1;
    int firstCol = startCol - 1;
    int lastCol = startCol - 1;
    CellRangeAddressList regions = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol);
    // 數(shù)據(jù)有效性對象
    DataValidation validation = new HSSFDataValidation(regions, constraint);
    return validation;
}

}

六扇門 回答

好吧,我改好了。
是公司內(nèi)部上傳文件的代碼有點(diǎn)問題。
最老的那位前輩解決了。
他說word 2007以上版本的多次寫字節(jié)到輸出流出現(xiàn)報錯,所以他改成了下面這樣:

// 一次寫入多個字節(jié)到輸出流中,減少IO訪問次數(shù)
while((numBytesRead = in.read(buffer)) != -1) {
    out.write(buffer, 0, numBytesRead);
}
菊外人 回答

如果是系統(tǒng)安裝,可以直接用服務(wù)管理腳本進(jìn)行管理,
如ubuntu下/etc/init.d/tomcat8
使用命令

$ sudo service tomcat8 restart

腳本內(nèi)容如下:

 stop)
log_daemon_msg "Stopping $DESC" "$NAME"

set +e
if [ -f "$CATALINA_PID" ]; then 
start-stop-daemon --stop --pidfile "$CATALINA_PID" \
--user "$TOMCAT8_USER" \
--retry=TERM/20/KILL/5 >/dev/null
if [ $? -eq 1 ]; then
log_progress_msg "$DESC is not running but pid file exists, cleaning up"
elif [ $? -eq 3 ]; then
PID="`cat $CATALINA_PID`"
log_failure_msg "Failed to stop $NAME (pid $PID)"
exit 1
fi
rm -f "$CATALINA_PID"
rm -rf "$JVM_TMP"
else
log_progress_msg "(not running)"
fi
log_end_msg 0
set -e
;;

基本的思路是先用start-stop-daemon發(fā)停止信號給tomcat進(jìn)程, 如果進(jìn)程不能順利結(jié)束,再用kill殺掉. 這里TERM/20/KILL/5意思是先發(fā)送TERM信號20秒沒有結(jié)束接著發(fā)送KILL信號,超時時間為5秒.
如果你自己管理,也可以參考上面腳本來完成.

魚梓 回答

threading.Lock鎖實(shí)現(xiàn)線程同步。


另外遍歷一個數(shù)組請用for item of arr:遍歷,不要用for i in range(len(arr)):

離殤 回答

兄弟我現(xiàn)在也是跟你情況一樣 生產(chǎn)上上傳視頻文件也出現(xiàn)這個異常,請問這個問題怎么解決的啊

萌吟 回答
請問怎么改造可以讓后臺POST時候收到收到參

network看你前端本來就沒問題,而問題就變成后端接收不到參數(shù),那么后端可以處理什么content-type呢?(這是接口定義的問題,人家定義不接受form data你發(fā)過去有啥用)

一開始以為你是發(fā)送請求的截圖,原來是后臺給的成功實(shí)例。。
當(dāng)然有問題,application/x-www-form-urlencoded發(fā)送數(shù)據(jù)的格式是a=b&c=d,而你發(fā)的是json字符串,你可以用qs模塊轉(zhuǎn)一下。

      if (type == 'POST') {
        sendData = JSON.stringify(data);
      }

      requestObj.open(type, url, true);
      requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      requestObj.send(sendData);

然后以后有關(guān)Network的問題,有什么不成功請截個圖發(fā)出來才能看到你到底發(fā)送了什么。

做不到 回答

匹配結(jié)果查看

正則如下【本人不會py,只能給正則了】:

([^()]+)\(([^()]*)\)

或者直接這樣也行,替換為空

祈歡 回答

原因沒找到,不過又好了,無奈。

呆萌傻 回答

當(dāng)你只需要一個不變的空列表的時候就用得到empytList啊,emptyMap同理。還有一點(diǎn)可以看一下源碼:

private static class EmptyList<E>
        extends AbstractList<E>
        implements RandomAccess, Serializable {
    private static final long serialVersionUID = 8842843931221139166L;

    public Iterator<E> iterator() {
        return emptyIterator();
    }
    public ListIterator<E> listIterator() {
        return emptyListIterator();
    }

    public int size() {return 0;}
    public boolean isEmpty() {return true;}

    public boolean contains(Object obj) {return false;}
    public boolean containsAll(Collection<?> c) { return c.isEmpty(); }

    public Object[] toArray() { return new Object[0]; }

    public <T> T[] toArray(T[] a) {
        if (a.length > 0)
            a[0] = null;
        return a;
    }

    public E get(int index) {
        throw new IndexOutOfBoundsException("Index: "+index);
    }

    public boolean equals(Object o) {
        return (o instanceof List) && ((List<?>)o).isEmpty();
    }

    public int hashCode() { return 1; }

    @Override
    public boolean removeIf(Predicate<? super E> filter) {
        Objects.requireNonNull(filter);
        return false;
    }
    @Override
    public void replaceAll(UnaryOperator<E> operator) {
        Objects.requireNonNull(operator);
    }
    @Override
    public void sort(Comparator<? super E> c) {
    }

    // Override default methods in Collection
    @Override
    public void forEach(Consumer<? super E> action) {
        Objects.requireNonNull(action);
    }

    @Override
    public Spliterator<E> spliterator() { return Spliterators.emptySpliterator(); }

    // Preserves singleton property
    private Object readResolve() {
        return EMPTY_LIST;
    }
}

EmptyList里面沒有用來描述列表信息及保存列表元素的成員變量,獲取EmptyList對象與直接new一個ArrayListLinkedList相比,可以節(jié)省不必要的空間。

瘋浪 回答

stream,讀一次就空了啊。就像袋子里有個蘋果,你拿出來袋子就空了。要么把你讀出來的stream set回去,要么把你讀出來的stream作為參數(shù)傳遞,不能多次讀stream。

誮惜顏 回答

以某一個表的字段為主,其他的表相關(guān)字段設(shè)成外鍵,通過數(shù)據(jù)庫級聯(lián)更新的機(jī)制,會很簡單,因?yàn)槟阒恍枰轮鞅淼淖侄渭纯?

薔薇花 回答

github上搜索PLC和Android

她愚我 回答
  1. 你的檔名不要取的跟 module 的名字一樣
  2. 你 pycharm 的 python 應(yīng)該是可以正確的 import scapy, 不要執(zhí)行 script, 在 pycharm 中開一個 interactive shell, from scapy.all import * 試試看!

我回答過的問題: Python-QA