當(dāng)然在哪個(gè)分支就只能pull,push哪個(gè)分支啊,不然要分支幹嘛
編輯菜單、是可以自定義吧!菜單添加到導(dǎo)航里面
這個(gè)你只要用addtoset就行了,如果存在就不修改原document,沒(méi)有就添加,確保唯一性:
db.items.update({_id:"docId"}, {$addToSet:{"cfr_delay.2018_01_22": "你的值"}});
多說(shuō)一句判斷:用$exists:
db.collection.find({ "cfr_delay.2018_01_22": { $exists: true, $ne: null } })
// $ne:null 可加可不加 看情況說(shuō)得對(duì)。。
var express = require('express')
var bodyParser = require('body-parser')
var app = express()
// create application/json parser
var jsonParser = bodyParser.json()//獲取JSON解析器中間件
// create application/x-www-form-urlencoded parser
var urlencodedParser = bodyParser.urlencoded({ extended: false })//url-encoded解析器 把/usr/share/man/man1 文件夾移動(dòng)到/usr/share/man/pl/man1,問(wèn)題解決
鬧劇一場(chǎng),上面的內(nèi)容是主動(dòng)重啟服務(wù)器時(shí)的日志記錄。節(jié)點(diǎn)1掛了,客戶搞錯(cuò)了去重啟節(jié)點(diǎn)2才出現(xiàn)了上面的日志。沉痛的教訓(xùn),忙活大半天。
window.onresize
$.each($('.imgBlock'),function(index,el){
$(this).click(function(){
console.log(index);
})
})
function showBigImg(buttons){
buttons.parent().children().each(function(i,e){
if($(this).is(buttons)){
console.log(i)
}
})
}計(jì)時(shí)器 從播放開(kāi)始 5分鐘后執(zhí)行你的邏輯
使用relative,元素沒(méi)有脫離了文檔流,所以float生效,
使用absolute,元素脫離了文檔流,所以失效了
后端需要解決跨域。也就是設(shè)置響應(yīng)頭。?;蛘咴?0上設(shè)置一下反向代理
php -m 查看實(shí)際的擴(kuò)展包, 如果還沒(méi)有, 重新編譯安裝.
用css預(yù)處理器less或sass,把公共的樣式封裝成一個(gè)可以重用的類(lèi),可以看看這里:https://www.w3cplus.com/css/less
你要注意后面括號(hào)里面的內(nèi)容while DevTools is open,只有要調(diào)試工具開(kāi)啟下才有效。
403 Forbidden 錯(cuò)誤,大多是被服務(wù)器屏蔽了,拒絕提供返回內(nèi)容
一般可以通過(guò)更換服務(wù)器ip、設(shè)置代理服務(wù)器,去爬取
最好的辦法,是通過(guò)模擬瀏覽器人工采集爬取
selenium + xvfb + firefox + proxy ip
下面是我的解決方案,僅供參考,相互學(xué)習(xí)
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.proxy import *
from pyvirtualdisplay import Display
# from xvfbwrapper import Xvfb
import bs4, os
from base64 import b64encode
import sys
reload(sys)
sys.setdefaultencoding('utf8')
## webdriver + firefox (不使用代理,爬取網(wǎng)頁(yè))
def spider_url_firefox(url):
browser = None
display = None
try:
display = Display(visible=0, size=(800, 600))
display.start()
browser = webdriver.Firefox() # 打開(kāi) FireFox 瀏覽器
browser.get(url)
content = browser.page_source
print("content: " + str(content))
finally:
if browser: browser.quit()
if display: display.stop()
## webdriver + firefox + proxy + whiteip (無(wú)密碼,或白名單ip授權(quán))
## 米撲代理:https://proxy.mimvp.com
def spider_url_firefox_by_whiteip(url):
browser = None
display = None
## 白名單ip,請(qǐng)見(jiàn)米撲代理會(huì)員中心: https://proxy.mimvp.com/usercenter/userinfo.php?p=whiteip
mimvp_proxy = {
'ip' : '140.143.62.84', # ip
'port_https' : 19480, # http, https
'port_socks' : 19481, # socks5
'username' : 'mimvp-user',
'password' : 'mimvp-pass'
}
try:
display = Display(visible=0, size=(800, 600))
display.start()
profile = webdriver.FirefoxProfile()
# add proxy
profile.set_preference('network.proxy.type', 1) # ProxyType.MANUAL = 1
if url.startswith("http://"):
profile.set_preference('network.proxy.http', mimvp_proxy['ip'])
profile.set_preference('network.proxy.http_port', mimvp_proxy['port_https']) # 訪問(wèn)http網(wǎng)站
elif url.startswith("https://"):
profile.set_preference('network.proxy.ssl', mimvp_proxy['ip'])
profile.set_preference('network.proxy.ssl_port', mimvp_proxy['port_https']) # 訪問(wèn)https網(wǎng)站
else:
profile.set_preference('network.proxy.socks', mimvp_proxy['ip'])
profile.set_preference('network.proxy.socks_port', mimvp_proxy['port_socks'])
profile.set_preference('network.proxy.ftp', mimvp_proxy['ip'])
profile.set_preference('network.proxy.ftp_port', mimvp_proxy['port_https'])
profile.set_preference('network.proxy.no_proxies_on', 'localhost,127.0.0.1')
## 不存在此用法,不能這么設(shè)置用戶名密碼 (舍棄)
# profile.set_preference("network.proxy.username", 'mimvp-user')
# profile.set_preference("network.proxy.password", 'mimvp-pass')
profile.update_preferences()
browser = webdriver.Firefox(profile) # 打開(kāi) FireFox 瀏覽器
browser.get(url)
content = browser.page_source
print("content: " + str(content))
finally:
if browser: browser.quit()
if display: display.stop()
在測(cè)試類(lèi)中使用多線程,測(cè)試程序運(yùn)行完,線程就會(huì)隨之關(guān)閉.所以會(huì)出現(xiàn)這樣的問(wèn)題.
解決辦法是保持測(cè)試程序的持續(xù)運(yùn)行,比如sleep一段時(shí)間,讓線程先運(yùn)行完畢,或者在程序最后加上 System.in.read() 一直讀等待.
場(chǎng)景不要添加object, 而是添加它的每一個(gè)child。
loader.load( 'model.obj', function ( object ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
scene.add( child );
}
} );
} );我直接上偽代碼.
$file_handle = fopen('文件地址+文件名','r');
if(feof($file_handle)){
return '這里的文件是空的';
}
$header = fgets($file_handle); // 讀取頭部的信息.
// 這里要清空對(duì)應(yīng)的空格.
$header = preg_replace('/\s+/',' ',$header);
$header = explode(' ',$header); // 得到header數(shù)組.
$data = []; // 最終的數(shù)據(jù)
// 這里要看自己的情況,是否對(duì)應(yīng)
while(!feof($file_handle)){
$content = fgets($file_handler); // 讀取一行內(nèi)容.
// 這里要處理一下,然后在搞,跟header是一樣的.不說(shuō)了.
// 然后一一對(duì)應(yīng)下就可以了
$row = array_combine($header,$content); // 組合一下
array_push($row);
}
print_r($data);exit;==================================我的答案====================================
這個(gè)是分布式的事務(wù),用synchronized是不行的,得用分布式的鎖。主要有數(shù)據(jù)庫(kù)級(jí)別的,redis的和zookeeper的鎖。本次我用了redis來(lái)實(shí)現(xiàn)。
北大青鳥(niǎo)APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專(zhuān)業(yè)的國(guó)家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
北大課工場(chǎng)是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國(guó)家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國(guó)制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級(jí)產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國(guó)職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開(kāi)發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_(kāi)發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開(kāi)發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開(kāi)發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開(kāi)發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問(wèn),美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。