Rob Pike's 5 Rules of Programming
Rule 1: You can't tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.
自己做一下benchmark
func NamedFunc() string {
return getCurrentTime()
}
func AnonymousFunc() string {
var f = func() string {
return time.Now().Format("2006-01-06 15:04:05")
}
return f()
}
func getCurrentTime() string {
return time.Now().Format("2006-01-06 15:04:05")
}
var str = ""
func BenchmarkNamedFunc(b *testing.B) {
for i := 0; i < b.N; i++ {
str = NamedFunc()
}
}
func BenchmarkAnonymousdFunc(b *testing.B) {
for i := 0; i < b.N; i++ {
str = AnonymousFunc()
}
}
我做的結(jié)果:
goos: linux
goarch: amd64
BenchmarkNamedFunc-8 5000000 248 ns/op
BenchmarkAnonymousdFunc-8 5000000 248 ns/op
PASS
ok _/home/singlethread/test/src/definedfunc 3.020s
推測是版本過高引起的,確認(rèn)下以下的問題:
vue-slide是不是vue1寫的?
你現(xiàn)在用的vue是什么版本?
webpack之類又是什么版本?
把
border: 2px solid #fff;
換成
padding: 2px;
background-color: #fff;
試試?
我看了下,ionic cordova run android沒有-ls這個可選項,具體見:http://ionicframework.com/doc...
有個第三方的庫changelog可以查看一個package的change log.
首先全局安裝changelog,
npm install changelog -g
然后使用changelog 來查看某一個package的change log
changelog [packageName] [options]
packageName對應(yīng)你想要查找的包的名稱,options里面有很多選項:比如 all, latest, number等等, 具體的信息可以通過changelog --help查看
比如我輸入命令changelog hapi all
就可以查看hapi所有的release記錄了。
固定的列轉(zhuǎn)換比較簡單,在原有的查詢語句上包一層就行了,如:
with t_result as
select b.loc_id,a.finish_time, COUNT(1) as loc_count
from tpss.tpss_l_order_item_flag PARTITION(p201802) a,tpss.tb_loc_latn_info b
WHERE a.finish_time >=trunc(SYSDATE-2,'dd') --前天
AND a.finish_time <trunc(SYSDATE,'dd') --昨天
and a.lan_id=b.lan_id
GROUP BY a.lan_id,to_char(a.finish_time,'yyyymmdd'),b.loc_id
ORDER BY b.loc_id,to_char(a.finish_time,'yyyymmdd')
select loc_id, max(finish_time_2), max(loc_count_1), max(finish_time_1), max(loc_count_1)
from (
select loc_id,
decode(trunc(finish_time), trunc(sysdate-2), finish_time, null) as finish_time_2,
decode(trunc(finish_time), trunc(sysdate-2), loc_count, null) as loc_count_2,
decode(trunc(finish_time), trunc(sysdate-1), finish_time, null) as finish_time_1,
decode(trunc(finish_time), trunc(sysdate-1), loc_count, null) as loc_count_1,
from t_result
) group by loc_id題主可以逆向思考這個秒殺問題,由于Redis的list數(shù)據(jù)結(jié)構(gòu)是不可能到達(dá)“負(fù)”長度的,所以可以把需要被秒殺的商品信息和一個唯一編號預(yù)先放到指定商品類型的唯一隊列中,用戶請求時直接lpop出結(jié)果,不可能出現(xiàn)超量的問題,很多東西都免了。
if int(mstr) == mint:
print 'same'
你自己已經(jīng)寫出來了啊, mstr不知道類型是什么,如果不能轉(zhuǎn)換成int,會報ValueError,如果不想報異常
try:
if int(mstr) == mint:
print 'same'
except ValueError:
print mstr
還是你的意思是想先判斷類型?
if type(mstr) == type(mint):
if mstr == mint:
print 'same'
else:
print 'value not same'
else:
print 'type not same'
還是你既不想先判斷類型,還想報錯,函數(shù)重載?
class myint(int):
def __eq__(self, other):
if isinstance(other, int):
return int(self) == other
else:
print 'type not same'
return False
mint = myint(1)
1 == mint
mstr == mintIMAGE表示是不是寫了mode="" 還有圖片是不是尺寸是不是1:1
分別渲染7條線段是否可以解決這個問題呢?
connect函數(shù)的API是這樣的
connect([mapStateToProps], [mapDispatchToProps], [mergeProps], [options])(WrappedComponent)
因為省略了第一個調(diào)用中的所有參數(shù),所以“不監(jiān)聽store”,mapStateToProps參數(shù)就是用來將Store/State的切片給映射到包裝后的Component的props中,也就是用來“監(jiān)聽store”的
你設(shè)置了auto_increment,操作失敗后,它分配的自增是緩存在內(nèi)存字典里的,要么你就更新auto_increment緩存,或者直接修改表數(shù)據(jù)的 auto_increment的最大數(shù)。
如果不使用自增長,就每次查詢這張表id最大的值,然后手動+1再插入
如果用匿名代理的話,你肯定拿不到攻擊者真實IP的,我覺得用匿名代理應(yīng)該是黑客的基本素質(zhì)吧。
因為你的這段代碼執(zhí)行之前,
ItemModel.find((err, items) => {
last_id = 'BBBB'
console.log(`LOG_1: ${last_id}`) // [結(jié)果正確]: BBB
})
你的這段代碼執(zhí)行了
function foo() {
var last_id = 'AAAA'
console.log(`LOG_2: ${last_id}`) // [結(jié)果不是想要的]: AAA
}
所以呢,你需要等第一步的代碼執(zhí)行完之后再執(zhí)行最后的console.log()
改成這樣
function foo() {
var last_id = 'AAAA'
// mongodb Model
let data = new Promise((resolve,reject)=>{
ItemModel.find((err, items) => {
last_id = 'BBBB'
console.log(`LOG_1: ${last_id}`)
})
})
data.then(()=>{
console.log(`LOG_2: ${last_id}`)
})
}剛嘗試了下,直接拖拽圖片,只會產(chǎn)生地址,無法彈出圖片上傳對話框。所以理論上不能夠上傳圖片。
但是,
回答問題時點擊上傳按鈕,markdown語法會顯示上傳在segmentfault服務(wù)器上的具體地址。
[1]: /img/bVZTOq
將markdown下顯示的地址貼到筆記里面就能夠成功顯示,效果如下。
當(dāng)然,這本質(zhì)上還是外鏈,只是生成的放圖片的位置在segmentfault內(nèi)部。
開啟allow url fopen
請問樓主這個業(yè)務(wù)實現(xiàn)了嗎?還是不可行?我現(xiàn)在也有個這樣的業(yè)務(wù)
可以把整個項目方到github嗎?
你說的是用微信開發(fā)者工具開發(fā)小程序?
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。