鍍金池/ 問答
初念 回答

我調(diào)用正常, 你檢查一下weexpack版本

祉小皓 回答

你先把body打出來看看

青黛色 回答

改成ssh方式clone,或者改下http.postBuffer的值

厭遇 回答

按照你的寫法需要更換stars數(shù)組的值,但是你不是就一個(gè)評(píng)分,所以一個(gè)數(shù)組肯定是不行的,所以這個(gè)思路并不好

換個(gè)思路,就兩種圖片,黃色的總在前面,灰色的總在后面,那可以這么實(shí)現(xiàn)

data = ["5", "1", "3", "2", "1"]
imgs = {
    off: './img/net_more/star_off.png',
    on: './img/net_more/star_on.png'
}
<li v-for="(item,index) of data">
    <img class="stars" v-for="star in 5" :src="star <= item ? imgs.off : imgs.on" alt="1">
</li>

使用聚合查詢

db.projects.aggregate([{
    $lookup:{
        from:'users',
        localField: 'userId',
        foreignField: '_id',
        as: 'userinfo'
        }
},{
    $match:{
        'userinfo.sex': '0'
}},{"$unwind": "$remark"}])
選擇 回答

好像沒有這種api。

但是不知道你是什么需求,一定要分開放置script標(biāo)簽。

因?yàn)榉旁趆ead里面的標(biāo)簽會(huì)阻塞頁面加載,拖慢渲染速度,一般都會(huì)把css放頭部,js放底部

單頁面本身html就少,放頭部底部關(guān)系不大。

凹凸曼 回答

你可以f12調(diào)試
查看html結(jié)構(gòu)
看看label的css類名
然后 重新寫一份

艷骨 回答

let reg=/w+-w+/g;

伐木累 回答

看來是跟透明度有關(guān)系,非常不理解

萌吟 回答

用re.sub直接替換空格感覺更方便些

import re  
  
text = "I am an handsome boy"  
print(re.sub(r'\s+', '', text))  
殘淚 回答
const str="1232{按鈕1}{按鈕2}765432";
const result=str.split(/(?=\{)|(?<=})/g);
//?["1232", "{按鈕1}", "{按鈕2}", "765432"]

然后把數(shù)字字符串轉(zhuǎn)成數(shù)字。

result.map(str=>{let num=parseInt(str); if(num)return num; return str;});

使用了向前匹配和向后匹配,看這篇


可以用函數(shù)處理,逐個(gè)字符串進(jìn)行判斷。
最好自己嘗試實(shí)現(xiàn)以下這個(gè)函數(shù)...

const str = "1232{按鈕1}{按鈕2}765432";
function handleStr(str) {
  const result = [];
  //表示是否在處理花括號(hào)內(nèi)的字符
  let inBraceNow = false;
  for (let i = 0; i < str.length; i++) {
    const currentChar = str[i];
    if (inBraceNow) {
      result[result.length - 1] += currentChar;
      if (currentChar == "}") {
        inBraceNow = false;
      }
    } else {
        //遇到"{"開始進(jìn)入花括號(hào)處理階段...
      if (currentChar == "{") {
        result.push("{");
        inBraceNow = true;
      } else {
          // result數(shù)組為空時(shí),需要初始化
          //如果數(shù)組最后一個(gè)不能轉(zhuǎn)為數(shù)字,說明是剛進(jìn)入數(shù)字處理階段,需要傳入一個(gè)0
        if (result.length == 0||(!+result[result.length-1])) {
          result.push(0);
        }
        result[result.length - 1] =10*result[result.length - 1]+(+currentChar);
      }
    }
  }
  return result;
}
console.log(handleStr(str));
初念 回答

自己回答一下吧, 翻看了django1.7 bulk_create 的源碼, 上面有一段有意思的注釋:

# So this case is fun. When you bulk insert you don't get the primary
# keys back (if it's an autoincrement), so you can't insert into the
# child tables which references this. There are two workarounds, 1)
# this could be implemented if you didn't have an autoincrement pk,
# and 2) you could do it by doing O(n) normal inserts into the parent
# tables to get the primary keys back, and then doing a single bulk
# insert into the childmost table. Some databases might allow doing
# this by using RETURNING clause for the insert query. We're punting
# on these for now because they are relatively rare cases.

解決方法有兩種, 1)主鍵不設(shè)置為自增長(zhǎng),意思是需要自己指定主鍵的值嘍?沒理解錯(cuò)吧
2)老老實(shí)實(shí)的一條條的插入吧

想了一下還是一條條插入,放到事務(wù)里面去操作. 不知道還有沒有更好的辦法

久舊酒 回答

問題已經(jīng)解決了

這個(gè)問題的 關(guān)鍵點(diǎn)setSelection() 方法的執(zhí)行時(shí)機(jī)

先說下如何解決

  • 布局中不需要做任何多余的設(shè)置
<RelativeLayout
    <!-- 這兩個(gè)設(shè)置不需要了,因?yàn)榻酉聛硪诔绦蚩傇O(shè)定 -->
    android:focusable="false"
    android:focusableInTouchMode="true" />
    <EditText />
</RelativeLayout>
  • Java代碼部分
public class MainActivity extends AppCompatActivity {
    private boolean isFirst = true; // 是否是第一次點(diǎn)擊 EditText
    private InputMethodManager mIMM; // 第一次點(diǎn)擊時(shí),軟鍵盤不自動(dòng)彈出,所以要手動(dòng)彈出
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mIMM = (InputMethodManager) (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        mEditText = findViewById(R.id.xxx);
        
        // 關(guān)鍵部分
        mEditText.setFocusable(false);
        mEditText.setOnClickListener( v -> {
            if(isFirst) {
                mEditText.setFocusableInTouchMode(true);
                mEditText.requestFocus();
                mEditText.setSelection(mEditText.getText().length());
                mIMM.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
                isFirst = false;
            }
        });
    }
}

再說下嘗試的過程

1. 直接設(shè)置 setSelection()

因?yàn)橹霸O(shè)置了 android:focusabelInTouchMode="true",所以直接設(shè)置是沒有效果的,第一次點(diǎn)擊EditText區(qū)域,會(huì)自動(dòng)彈出軟鍵盤,并且光標(biāo)位置是手指點(diǎn)擊的位置

2. 自定義 EditText,重寫 onSelectionChanged(int selStart, int selEnd)方法

這個(gè)方法感知光標(biāo)位置的變化,編寫如下代碼,可控制光標(biāo)始終在結(jié)尾處:

    @Override
    protected void onSelectionChanged(int selStart, int selEnd) {
        super.onSelectionChanged(selStart, selEnd);
            if (selStart == selEnd) { // 不考慮多個(gè)文字被選中
                setSelection(getText().length());
            }
    }

這個(gè)方法的執(zhí)行時(shí)機(jī)在自定義EditText對(duì)象初始化之前,并且在沒點(diǎn)擊之前,或者點(diǎn)擊時(shí)會(huì)多次執(zhí)行該方法,不好控制是否是第一次點(diǎn)擊。因此也沒有嘗試成功

總結(jié)

不知道有沒有更好的解決方案?期待你的回答。


2018-05-28 補(bǔ)充

實(shí)際項(xiàng)目總可能會(huì)遇到一個(gè)頁面中有多個(gè)EditText,那么 isFirstTouch 就可能被多個(gè)EditText共用,如果有這個(gè)問題存在的話,一種解決方案是自定義EditText:

public class MyEditText extends EditText {
    private boolean isFirstTouch = true;
    // 構(gòu)造方法中調(diào)用 init() 方法
    private void init() {
        post( () -> {
            setFocusable(false);
            if(isFirst) {
                setFocusableInTouchMode(true);
                requestFocus();
                setSelection(mEditText.getText().length());
                inputMethodManger.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
                isFirst = false;
            }
        });
    }
}
萌小萌 回答

file:///訪問模式換成http://xxxxxx

別瞎鬧 回答

應(yīng)該是android打包環(huán)境的問題

溫衫 回答

因?yàn)槟阌昧藃edirect, 可以與此有關(guān)

在nginx配置里增加proxy_redirect試試:

location /{
...
      proxy_redirect   / /;
...
}
話寡 回答

openssl 確實(shí)有點(diǎn)小特殊,我也沒弄過,但是授人以漁,教你方法。
看到開源代碼,第一反應(yīng)是在configure中配置,但是下載代碼了發(fā)現(xiàn)沒有configure,還好我比較聰明,他有config,其實(shí)也有configure,只是Configure,首字母大寫。
然后發(fā)現(xiàn)他沒有配置選項(xiàng),我就 grep -r "-m64" ./ 看是在哪里配置的,結(jié)果發(fā)現(xiàn)在Configure中有大量的的-m64。
再看前面的linux-ppc64,我就明白了,原來他是根據(jù)目標(biāo)系統(tǒng)預(yù)先設(shè)定好編譯選項(xiàng),那么出現(xiàn)-m64 的原因是識(shí)別錯(cuò)了編譯器。
再反過來查找,發(fā)現(xiàn)編譯器的識(shí)別是在config里面做的,識(shí)別完成了,最后幾行的代碼是perl ./Configure $OUT,看明白了吧,要么讓config識(shí)別正確的編譯器,要么干脆根據(jù)你的系統(tǒng)寫死$OUT算了。

老梗 回答

圖片描述
已經(jīng)解決,謝謝各位大神,如圖

互擼娃 回答

修改url_mode