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

鍍金池/ 問答/ C問答
涼心人 回答

sudo autoreconf -ivf 就是這一句解決了問題

不討囍 回答

csdn上面的,直接搬了過來:

因為要做觀點,觀點的屋子類似于知乎的話題,所以得想辦法把他給爬下來,搞了半天最終還是妥妥的搞定了,代碼是python寫的,不懂得麻煩自學哈!懂得直接看代碼,絕對可用


#coding:utf-8
"""
@author:haoning
@create time:2015.8.5
"""
from __future__ import division  # 精確除法
from Queue import Queue
from __builtin__ import False
import json
import os
import re
import platform
import uuid
import urllib
import urllib2
import sys
import time
import MySQLdb as mdb
from bs4 import BeautifulSoup


reload(sys)
sys.setdefaultencoding( "utf-8" )


headers = {
   'User-Agent' : 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0',
   'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
   'X-Requested-With':'XMLHttpRequest',
   'Referer':'https://www.zhihu.com/topics',
   'Cookie':'__utma=51854390.517069884.1416212035.1416212035.1416212035.1; q_c1=c02bf44d00d240798bfabcfc95baeb56|1455778173000|1416205243000; _za=b1c8ae35-f986-46a2-b24a-cb9359dc6b2a; aliyungf_tc=AQAAAJ1m71jL1woArKqF22VFnL/wRy6C; _xsrf=9d494558f9271340ab24598d85b2a3c8; cap_id="MDNiMjcwM2U0MTRhNDVmYjgxZWVhOWI0NTA2OGU5OTg=|1455864276|2a4ce8247ebd3c0df5393bb5661713ad9eec01dd"; n_c=1; _alicdn_sec=56c6ba4d556557d27a0f8c876f563d12a285f33a'
}


DB_HOST = '127.0.0.1'
DB_USER = 'root'
DB_PASS = 'root'


queue= Queue() #接收隊列
nodeSet=set()
keywordSet=set()
stop=0
offset=-20
level=0
maxLevel=7
counter=0
base=""


conn = mdb.connect(DB_HOST, DB_USER, DB_PASS, 'zhihu', charset='utf8')
conn.autocommit(False)
curr = conn.cursor()


def get_html(url):
    try:
        req = urllib2.Request(url)
        response = urllib2.urlopen(req,None,3) #在這里應該加入代理
        html = response.read()
        return html
    except:
        pass
    return None


def getTopics():
    url = 'https://www.zhihu.com/topics'
    print url
    try:
        req = urllib2.Request(url)
        response = urllib2.urlopen(req) #鍦ㄨ繖閲屽簲璇ュ姞鍏ヤ唬鐞?
        html = response.read().decode('utf-8')
        print html
        soup = BeautifulSoup(html)
        lis = soup.find_all('li', {'class' : 'zm-topic-cat-item'})
        
        for li in lis:
            data_id=li.get('data-id')
            name=li.text
            curr.execute('select id from classify_new where name=%s',(name))
            y= curr.fetchone()
            if not y:
                curr.execute('INSERT INTO classify_new(data_id,name)VALUES(%s,%s)',(data_id,name))
        conn.commit()
    except Exception as e:
        print "get topic error",e
        


def get_extension(name):  
    where=name.rfind('.')
    if where!=-1:
        return name[where:len(name)]
    return None




def which_platform():
    sys_str = platform.system()
    return sys_str


def GetDateString():
    when=time.strftime('%Y-%m-%d',time.localtime(time.time()))
    foldername = str(when)
    return foldername 


def makeDateFolder(par,classify):
    try:
        if os.path.isdir(par):
            newFolderName=par + '//' + GetDateString() + '//'  +str(classify)
            if which_platform()=="Linux":
                newFolderName=par + '/' + GetDateString() + "/" +str(classify)
            if not os.path.isdir( newFolderName ):
                os.makedirs( newFolderName )
            return newFolderName
        else:
            return None 
    except Exception,e:
        print "kk",e
    return None 


def download_img(url,classify):
    try:
        extention=get_extension(url)
        if(extention is None):
            return None
        req = urllib2.Request(url)
        resp = urllib2.urlopen(req,None,3)
        dataimg=resp.read()
        name=str(uuid.uuid1()).replace("-","")+"_www.guandn.com"+extention
        top="E://topic_pic"
        folder=makeDateFolder(top, classify)
        filename=None
        if folder is not None:
            filename  =folder+"http://"+name
        try:
            if "e82bab09c_m" in str(url):
                return True
            if not os.path.exists(filename):
                file_object = open(filename,'w+b')
                file_object.write(dataimg)
                file_object.close()
                return '/room/default/'+GetDateString()+'/'+str(classify)+"/"+name
            else:
                print "file exist"
                return None
        except IOError,e1:
            print "e1=",e1
            pass
    except Exception as e:
        print "eee",e
        pass
    return None #如果沒有下載下來就利用原來網(wǎng)站的鏈接


def getChildren(node,name):
    global queue,nodeSet
    try:
        url="https://www.zhihu.com/topic/"+str(node)+"/hot"
        html=get_html(url)
        if html is None:
            return
        soup = BeautifulSoup(html)
        p_ch='父話題'
        node_name=soup.find('div', {'id' : 'zh-topic-title'}).find('h1').text
        topic_cla=soup.find('div', {'class' : 'child-topic'})
        if topic_cla is not None:
            try:
                p_ch=str(topic_cla.text)
                aList = soup.find_all('a', {'class' : 'zm-item-tag'}) #獲取所有子節(jié)點
                if u'子話題' in p_ch:
                    for a in aList:
                        token=a.get('data-token')
                        a=str(a).replace('\n','').replace('\t','').replace('\r','')
                        start=str(a).find('>')
                        end=str(a).rfind('</a>')
                        new_node=str(str(a)[start+1:end])
                        curr.execute('select id from rooms where name=%s',(new_node)) #先保證名字絕不相同
                        y= curr.fetchone()
                        if not y:
                            print "y=",y,"new_node=",new_node,"token=",token
                            queue.put((token,new_node,node_name))
            except Exception as e:
                print "add queue error",e
    except Exception as e:
        print "get html error",e
        
    


def getContent(n,name,p,top_id):
    try:
        global counter
        curr.execute('select id from rooms where name=%s',(name)) #先保證名字絕不相同
        y= curr.fetchone()
        print "exist?? ",y,"n=",n
        if not y:
            url="https://www.zhihu.com/topic/"+str(n)+"/hot"
            html=get_html(url)
            if html is None:
                return
            soup = BeautifulSoup(html)
            title=soup.find('div', {'id' : 'zh-topic-title'}).find('h1').text
            pic_path=soup.find('a',{'id':'zh-avartar-edit-form'}).find('img').get('src')
            description=soup.find('div',{'class':'zm-editable-content'})
            if description is not None:
                description=description.text
                
            if (u"未歸類" in title or u"根話題" in title): #允許入庫,避免死循環(huán)
                description=None
                
            tag_path=download_img(pic_path,top_id)
            print "tag_path=",tag_path
            if (tag_path is not None) or tag_path==True:
                if tag_path==True:
                    tag_path=None
                father_id=2 #默認為雜談
                curr.execute('select id from rooms where name=%s',(p))
                results = curr.fetchall()
                for r in results:
                    father_id=r[0]
                name=title
                curr.execute('select id from rooms where name=%s',(name)) #先保證名字絕不相同
                y= curr.fetchone()
                print "store see..",y
                if not y:
                    friends_num=0
                    temp = time.time()
                    x = time.localtime(float(temp))
                    create_time = time.strftime("%Y-%m-%d %H:%M:%S",x) # get time now
                    create_time
                    creater_id=None
                    room_avatar=tag_path
                    is_pass=1
                    has_index=0
                    reason_id=None  
                    #print father_id,name,friends_num,create_time,creater_id,room_avatar,is_pass,has_index,reason_id
                    ######################有資格入庫的內(nèi)容
                    counter=counter+1
                    curr.execute("INSERT INTO rooms(father_id,name,friends_num,description,create_time,creater_id,room_avatar,is_pass,has_index,reason_id)VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",(father_id,name,friends_num,description,create_time,creater_id,room_avatar,is_pass,has_index,reason_id))
                    conn.commit() #必須時時進入數(shù)據(jù)庫,不然找不到父節(jié)點
                    if counter % 200==0:
                        print "current node",name,"num",counter
    except Exception as e:
        print "get content error",e       


def work():
    global queue
    curr.execute('select id,node,parent,name from classify where status=1')
    results = curr.fetchall()
    for r in results:
        top_id=r[0]
        node=r[1]
        parent=r[2]
        name=r[3]
        try:
            queue.put((node,name,parent)) #首先放入隊列
            while queue.qsize() >0:
                n,p=queue.get() #頂節(jié)點出隊
                getContent(n,p,top_id)
                getChildren(n,name) #出隊內(nèi)容的子節(jié)點
            conn.commit()
        except Exception as e:
            print "what's wrong",e  
            
def new_work():
    global queue
    curr.execute('select id,data_id,name from classify_new_copy where status=1')
    results = curr.fetchall()
    for r in results:
        top_id=r[0]
        data_id=r[1]
        name=r[2]
        try:
            get_topis(data_id,name,top_id)
        except:
            pass




def get_topis(data_id,name,top_id):
    global queue
    url = 'https://www.zhihu.com/node/TopicsPlazzaListV2'
    isGet = True;
    offset = -20;
    data_id=str(data_id)
    while isGet:
        offset = offset + 20
        values = {'method': 'next', 'params': '{"topic_id":'+data_id+',"offset":'+str(offset)+',"hash_id":""}'}
        try:
            msg=None
            try:
                data = urllib.urlencode(values)
                request = urllib2.Request(url,data,headers)
                response = urllib2.urlopen(request,None,5)
                html=response.read().decode('utf-8')
                json_str = json.loads(html)
                ms=json_str['msg']
                if len(ms) <5:
                    break
                msg=ms[0]
            except Exception as e:
                print "eeeee",e
            #print msg
            if msg is not None:
                soup = BeautifulSoup(str(msg))
                blks = soup.find_all('div', {'class' : 'blk'})
                for blk in blks:
                    page=blk.find('a').get('href')
                    if page is not None:
                        node=page.replace("/topic/","") #將更多的種子入庫
                        parent=name
                        ne=blk.find('strong').text
                        try:
                            queue.put((node,ne,parent)) #首先放入隊列
                            while queue.qsize() >0:
                                n,name,p=queue.get() #頂節(jié)點出隊
                                size=queue.qsize()
                                if size > 0:
                                    print size
                                getContent(n,name,p,top_id)
                                getChildren(n,name) #出隊內(nèi)容的子節(jié)點
                            conn.commit()
                        except Exception as e:
                            print "what's wrong",e  
        except urllib2.URLError, e:
            print "error is",e
            pass 
            
        
if __name__ == '__main__':
    i=0
    while i<400:
        new_work()
        i=i+1

說下數(shù)據(jù)庫的問題,我這里就不傳附件了,看字段自己建立,因為這確實太簡單了,我是用的mysql,你看自己的需求自己建。

有什么不懂得麻煩去去轉盤網(wǎng)找我,因為這個也是我開發(fā)的,上面會及時更新qq群號,這里不留qq號啥的,以免被系統(tǒng)給K了。

薔薇花 回答

你的矛盾毫無邏輯。
假設現(xiàn)在有一個函數(shù)計算兩個數(shù)的和 Sum函數(shù),你的測試數(shù)據(jù)可以是任何兩個數(shù)a,b。按你的意思是,你可以自動生成a,b兩個數(shù),那么Sum就沒有意義了,很明顯Sum函數(shù)是測試a,b作為輸入項的前提。

賤人曾 回答

打印出object有問題么

詆毀你 回答

68行:
分號可省略,這就好像

int main()
{
    return 0;
}

后面不需要分號一樣。

70行:
沒有大括號分號就不能省略,
類似于你先聲明foo,這里要分號

void foo();

再寫main

int main()
{
    foo();
    return 0;
}

然后定義foo,這里不要分號

void foo()
{
    printf("foo");
    return;
}

另:
至于override只是一個附加的標識符,
表明函數(shù)是重載的。。。

任她鬧 回答

估計是static惹的禍。它會一直保存每一次測試用例的結果,并不會重新開始計數(shù)。所以你直接對那個失敗的測試用例可以過,而對多個測試用例(也就是commit)過不了

風清揚 回答

用定位要注意定位父級

<view class='imgbox'>
  <image class='ico' mode='scaleToFill' src='{{ico}}></image>
    <text class="txt">{{text}}</text>
</view>
.imgbox{
  position: relative;
  width: 600rpx;
  height: 400rpx;
}
.ico{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.txt{
   position: relative;
}

使勁操 回答

1、只要“||”前面為false,無論“||”后面是true還是false,結果都返回“||”后面的值。

2、只要“||”前面為true,無論“||”后面是true還是false,結果都返回“||”前面的值。

3、只要“&&”前面是false,無論“&&”后面是true還是false,結果都將返“&&”前面的值;

4、只要“&&”前面是true,無論“&&”后面是true還是false,結果都將返“&&”后面的值;

奧特蛋 回答

通常的做法是:直接明文寫出所使用的密碼編號

使勁操 回答

打包路徑問題 點開控制臺network 仔細看看報404的路徑 一定和你想的不一樣

玄鳥 回答

顯然是refs-component這個組件沒有focus方法,你沒有引用在input上

Vue.component('refs-component',{
  template:`<input ref='input' type="text" />`,
  methods: {
     focus(){
         this.$refs.input.focus();
     }
  }    
})

這樣試試

淺時光 回答

我也遇到了 這個問題,目前復制到了 支付寶好友聊天窗口 去執(zhí)行

葬憶 回答

基于語義的話就不要光用tf-idf model了,用lsi、lda model試試。

笨小蛋 回答

LayIM,這個是基于這個第三方的插件頁面的接入案例,應該能給點靈感

執(zhí)念 回答

一個非空數(shù)組,只有一個元素出現(xiàn)奇數(shù)次,其余出現(xiàn)偶數(shù)次,找出那個元素:

    int singleNumber(vector<int>& nums) {
      return std::accumulate(nums.begin(), nums.end(), 0, [](int res, int n) { 
          res ^= n;
          return res;
        });
    }

一個非空數(shù)組,只有一個元素出現(xiàn)1次,其余出現(xiàn)3次,找出那個元素:

    int singleNumber(vector<int>& nums) {
      int twos = 0;
      return std::accumulate(nums.begin(), nums.end(), 0, [&twos] (int ones, int n) { 
          ones ^= n & ~twos; 
          twos ^= n & ~ones; 
          return ones;
        });
    }

一個非空數(shù)組,只有兩個元素出現(xiàn)1次,其余出現(xiàn)2次,找出那兩個元素:

     vector<int> singleNumber(vector<int>& nums) {
               
        int xr=nums[0];
        for(int i=1;i<nums.size();i++)
            xr=xr^nums[i];
        
        int pos=xr&~(xr-1);

        int x=0,y=0;
        for(int i=0;i<nums.size();i++)
            if((pos)&nums[i])
                x=x^nums[i];
            else
                y=y^nums[i];
        
        vector <int> res;
        res.push_back(x);
        res.push_back(y);
        return res;
    }

卡馬克算法:

//
// 計算參數(shù)x的平方根的倒數(shù)
//
float InvSqrt (float x)
{
    float xhalf = 0.5f*x;
    int i = *(int*)&x;
    i = 0x5f3759df - (i >> 1); // 計算第一個近似根
    x = *(float*)&i;
    x = x*(1.5f - xhalf*x*x); // 牛頓迭代法
    return x;
}
遲月 回答

OP的意思是覺得鏈接的資料不足夠理解這個函數(shù)嗎?
用google搜下, 以下是可能有用的鏈接:
https://docs.microsoft.com/en...

https://stackoverflow.com/que...

https://cboard.cprogramming.c...

http://en.cppreference.com/w/...

Update:
這是一個X-Y problem. 你需要搞懂的是這些keyword的意思, 而不是單純的"如何看 c語言中函數(shù)(strcat_s)說明". 利用好搜索引擎, 比如google, 知道學習c語言一些常見的參考站點, 比如man page, cppreference的c版, Stack Overflow.

舉個例子, http://en.cppreference.com/w/... 這里就有對errno_t的說明:

a typedef for the type int, used to self-document functions that return errno values
尐飯團 回答

試一下執(zhí)行命令:

xcode-select --install
疚幼 回答

感覺你沒明白cookie是怎么產(chǎn)生的,cookie是web服務器保存在瀏覽器中的信息,當然也可以手動寫入;
你的h5的交互依賴登錄狀態(tài)還是怎么著?