鍍金池/ 問答/ Linux問答
萌二代 回答

盡量使用npm安裝

不舍棄 回答

修改你賬號下的.bashrc文件,將
#If not running interactively, don't do anything

case $- in
 *i*) ;; 
 *) return;; 

esac
修改為:
#If not running interactively, don't do anything
# case $- in
# i) ;;
# *) return;;
#esac

或者將你的nvm環(huán)境變量改寫在.bashrc文件的頭部

私有包多半是不能同步的,私有把是你自己的別人看不見,怎么同步

心沉 回答
  1. github上紅色的部分不是依賴,是這個(gè)項(xiàng)目的topic,或者說tag
  2. 因?yàn)樯厦娴脑颍阅阋詾椴灰粯?。不過不一樣也是常見的,github上一般你看到的是最新的開發(fā)版本
  3. devDependencies是只在開發(fā)環(huán)境需要的依賴,盡量不要位置寫錯(cuò),否則有些命令可能會(huì)多下載或少下載依賴。
念初 回答

使用rxjava吧
線程操作比較方便

package com.github.rxjavatest

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.bumptech.glide.Glide
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.BiFunction

class MainActivity : AppCompatActivity() {

    lateinit var recyclerView: RecyclerView

    val list = arrayListOf<String>()
    val adapter = ImageAdapter(list)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        recyclerView = findViewById(R.id.recyclerView)
        recyclerView.layoutManager = GridLayoutManager(this, 3)
        recyclerView.adapter = adapter

        initImage()
    }

    private fun initImage() {
        val imageGetter = ImageGetter("http://588ku.com/beijing/0-0-pxnum-4-8-0-0-0-1/")
        val imgOb = imageGetter.getImageObserable()

        val imageGetter2 = ImageGetter("http://588ku.com/beijing/0-0-pxnum-4-8-0-0-0-2/")
        val imgOb2 = imageGetter2.getImageObserable()

        Observable.zip(imgOb, imgOb2, BiFunction<List<String>, List<String>, List<String>> { t1, t2 ->
            val list = arrayListOf<String>()
            list.addAll(t1)
            list.addAll(t2)
            list
        }).observeOn(AndroidSchedulers.mainThread())
                .subscribe {
                    list.addAll(it)
                    adapter.notifyDataSetChanged()
                }
    }
}

class ImageAdapter(val list: List<String>) : RecyclerView.Adapter<VH>() {

    override fun onBindViewHolder(holder: VH?, position: Int) {

        holder?.apply {
            val src = list[position]
            Glide
                    .with(itemView)
                    .load(src)
                    .into(img)
        }
    }

    override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): VH {
        val view = LayoutInflater.from(parent?.context)?.inflate(R.layout.item_img, parent, false)
        return VH(view)
    }

    override fun getItemCount(): Int {
        return list.size
    }

}

class VH(itemView: View?) : RecyclerView.ViewHolder(itemView) {

    val img: ImageView by lazy { itemView!!.findViewById<ImageView>(R.id.iv_image) }

}
package com.github.rxjavatest

import android.annotation.SuppressLint
import android.util.Log
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import java.util.concurrent.Executors


/**
 * Created by cai on 2018/2/12.
 */
class ImageGetter(var url: String) {
    
    fun getImageObserable(): Observable<ArrayList<String>> {
        return Observable
                .create<Document> {
                    val doc = Jsoup.connect(url)
                            .get()
                    it.onNext(doc)
                    it.onComplete()
                }
                .subscribeOn(Schedulers.io())
                .map {
                    it.select("div a img")
                }
                .map {
                    val list = arrayListOf<String>()
                    it.forEach {
                        val image = it.attr("data-original")
                        list.add(image)
                    }
                    list
                }
                .observeOn(AndroidSchedulers.mainThread())
    }

    @SuppressLint("SetJavaScriptEnabled")
    companion object {
    }

}

val Any.TAG
    get() = this.javaClass.simpleName

fun Any.logger(msg: Any?) {
    Log.i(TAG, msg.toString())
}

簡單寫了個(gè)demo
項(xiàng)目地址

這里用JSoup爬數(shù)據(jù)
然后Rxjava返回?cái)?shù)據(jù)流處理結(jié)果的img src的集合的Observable

在實(shí)際Activity中同時(shí)獲得兩個(gè)Observable,使用zip操作符組合,然后在主線程中將圖片添加到list
刷新adapter

使用Glide加載圖片

OrgChart只支持一個(gè)root節(jié)點(diǎn)。
可以通過css方式視覺上實(shí)現(xiàn)。

吢涼 回答

你好,我也遇到這個(gè)問題,請問您解決了嗎

命多硬 回答
  1. 修改本地git的config,包括email和name。
  2. 重新生成sshkey

clipboard.png
nginx訪問靜態(tài)文件和uwsgi是沒啥關(guān)系的,都是一樣的配制方法.無論用gunicorn還是uwsgi都是這么配置.
這是我隨手截圖的寫法,用的是root,
按照alias寫法,就要在下邊的路徑加上/static/
你看看加上尾部的/行不行.

還有就是nginx是否有權(quán)限訪問你的文件目錄的問題.看一下nginx運(yùn)行的用戶是誰

薄荷糖 回答

git,在服務(wù)器建個(gè)庫,把代碼拉到本地,修改提交就能更新服務(wù)器代碼

不討喜 回答

使用 echo 也可以
你也可以寫到文件里面,然后重定向標(biāo)準(zhǔn)輸入

巫婆 回答

docker logs scheduler 看日志

話寡 回答

https://segmentfault.com/q/10...
——————————————————————————————
第一次回復(fù)時(shí)沒看你的內(nèi)容,只回應(yīng)了標(biāo)題所以貼了個(gè)網(wǎng)址
下面正式回復(fù)
你的問題不是cookies的問題,我根據(jù)那篇文章改了下運(yùn)行成功了,你自己對照下

package main

import (
    "fmt"
    "io"
    "io/ioutil"
    "log"
    "net/http"
    "net/http/cookiejar"
    "net/url"
    "regexp"
    "strings"
)

var cookies_lagou []*http.Cookie

const (
    login_url_lagou string = "https://passport.lagou.com/login/login.html"

    post_login_info_url_lagou string = "https://passport.lagou.com/login/login.json"

    username_lagou string = "13330295142"
    password_lagou string = "4525674692ac06e619cdb3f1b4b65b08"
)

func getToken(contents io.Reader) (string, string) {

    data, _ := ioutil.ReadAll(contents)

    regCode := regexp.MustCompile(`X_Anti_Forge_Code = '(.*?)';`)
    if regCode == nil {
        log.Fatal("解析Code出錯(cuò)...")
    }

    //提取關(guān)鍵信息
    code := regCode.FindAllStringSubmatch(string(data), -1)[0][1]

    regToken := regexp.MustCompile(`X_Anti_Forge_Token = '(.*?)';`)
    if regToken == nil {
        fmt.Println("MustCompile err")
    }

    //提取關(guān)鍵信息
    token := regToken.FindAllStringSubmatch(string(data), -1)[0][1]

    return token, code
}

func login_lagou() {
    //獲取登陸界面的cookie
    jar, _ := cookiejar.New(nil)
    client := &http.Client{
        Jar: jar,
    }
    req, _ := http.NewRequest("GET", login_url_lagou, nil)
    res, _ := client.Do(req)
    // for k, v := range res.Cookies() {
    //     fmt.Printf("%v=%v\n", k, v)
    // }
    token, code := getToken(res.Body)
    fmt.Println(token, code)
    //post數(shù)據(jù)
    postValues := url.Values{}
    postValues.Add("isValidate", "true")
    postValues.Add("username", username_lagou)
    postValues.Add("password", password_lagou)
    postValues.Add("request_form_verifyCode", "")
    postValues.Add("submit", "")
    // body := ioutil.NopCloser(strings.NewReader(postValues.Encode())) //把form數(shù)據(jù)編下碼
    // requ, _ := http.NewRequest("POST", post_login_info_url_lagou, nil)

    requ, _ := http.NewRequest("POST", post_login_info_url_lagou, strings.NewReader(postValues.Encode()))
    requ.Header.Set("Referer", "https://passport.lagou.com/login/login.html")
    requ.Header.Set("X-Requested-With", "XMLHttpRequest")
    requ.Header.Set("X-Anit-Forge-Token", token)
    requ.Header.Set("X-Anit-Forge-Code", code)
    requ.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0")
    requ.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")

    //for _, v := range res.Cookies() {
    //    requ.AddCookie(v)
    //}

    res, _ = client.Do(requ)
    //cookies_lagou = res.Cookies()
    data, _ := ioutil.ReadAll(res.Body)
    res.Body.Close()
    fmt.Println(string(data))
}

func main() {
    login_lagou()
}

運(yùn)行結(jié)果

15f131a3-74b0-4914-bd6e-2672f36675e1 28747049
{"content":{"rows":[]},"message":"該帳號不存在或密碼(驗(yàn)證碼)誤,請重新輸入","state":400,"submitCode":23207051,"submitToken":"666f51d4-ccef-462a-bb56-55cb97c5231a"}

Process finished with exit code 0
乖乖噠 回答

可以把字符串變成數(shù)字類型

情已空 回答
grep "2018-04-26" logfile.log | cut -d "|" -f2 | cut -d "=" -f2
陌顏 回答

應(yīng)該沒差別吧。你這個(gè)錯(cuò)誤第二次就沒有了吧。第一次是創(chuàng)建個(gè)文件吧

孤星 回答

lua-nginx-moduleOpenSSL 1.1.0不兼容
你換成OpenSSL 1.0.2就好了