https代理在建立代理隧道之后只需要轉發(fā)原始報文就好了,這樣做代理服務器并不能拿到https明文,而中間人攻擊是能拿到明文的
可以看看https://segmentfault.com/a/11...
把<p>里面的內容整個提取出string來后用re提取。
r'\<br\>([\w\/]+)$'
漏了theme(),犯了個2b錯誤。。。
找到問題了,網頁用Angular動態(tài)加載的,爬蟲爬取的時候都是空的,就報錯咯~~
找到原因了,還需要重寫GetContextMenuHandler
接口。
virtual CefRefPtr<CefContextMenuHandler> SimpleHandler::GetContextMenuHandler()
OVERRIDE {
return this;
}
沒想到SF有Haskell問題:)
其實你看Profiling的結果,in_range
的inherited %time
和inherited %alloc
都比larger_than
大,占了整個程序執(zhí)行的100%和93.3%。所以第一種方法快。
寫個rewrite rule也許可以對elem
和enumFromTo
進行優(yōu)化。
試了寫rewrite rule,發(fā)現(xiàn)enumFromTo有inline,導致rewrite rule沒有生效,所以先自己實現(xiàn)一個myEnumFromTo
看看效果:
module Main where
{-# RULES
"elem/myEnumFromTo" forall (x::Integer) (n::Integer) (m::Integer) . elem x (myEnumFromTo n m) = x >= n && x <= m
#-}
{-# NOINLINE myEnumFromTo #-}
myEnumFromTo n m
| n == m = [n]
| otherwise = [n] ++ myEnumFromTo (n + 1) m
main = do
print $ {-# SCC larger_than #-} lth 100000000
print $ {-# scc in_range #-} inr 100000000
lth :: Integer -> Bool
lth x = (x >= 1 && x <= 65535000000000)
inr :: Integer -> Bool
inr x = let m = 65535000000000::Integer in
x `elem` (myEnumFromTo 1 m)
Profile結果是這樣的:
main Main app/Main.hs:(12,1)-(14,48) 0.0 15.8
individual inherited
COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc
MAIN MAIN <built-in> 144 0 0.0 29.6 0.0 100.0
CAF GHC.Conc.Signal <entire-module> 252 0 0.0 0.9 0.0 0.9
CAF GHC.IO.Encoding <entire-module> 241 0 0.0 3.8 0.0 3.8
CAF GHC.IO.Encoding.Iconv <entire-module> 239 0 0.0 0.3 0.0 0.3
CAF GHC.IO.Handle.FD <entire-module> 231 0 0.0 47.3 0.0 47.3
CAF GHC.IO.Handle.Text <entire-module> 229 0 0.0 0.1 0.0 0.1
CAF GHC.Show <entire-module> 214 0 0.0 0.4 0.0 0.4
CAF GHC.Event.Thread <entire-module> 193 0 0.0 1.7 0.0 1.7
CAF GHC.Event.Poll <entire-module> 160 0 0.0 0.1 0.0 0.1
CAF:main1 Main <no location info> 286 0 0.0 0.0 0.0 0.0
main Main app/Main.hs:(12,1)-(14,48) 288 1 0.0 0.0 0.0 0.0
CAF:main2 Main <no location info> 284 0 0.0 0.0 0.0 0.0
main Main app/Main.hs:(12,1)-(14,48) 293 0 0.0 0.0 0.0 0.0
in_range Main app/Main.hs:14:32-48 294 1 0.0 0.0 0.0 0.0
inr Main app/Main.hs:(20,1)-(21,29) 295 1 0.0 0.0 0.0 0.0
inr.m Main app/Main.hs:20:13-39 296 1 0.0 0.0 0.0 0.0
CAF:main4 Main <no location info> 285 0 0.0 0.0 0.0 0.0
main Main app/Main.hs:(12,1)-(14,48) 290 0 0.0 0.0 0.0 0.0
larger_than Main app/Main.hs:13:36-48 291 1 0.0 0.0 0.0 0.0
lth Main app/Main.hs:17:1-39 292 1 0.0 0.0 0.0 0.0
main Main app/Main.hs:(12,1)-(14,48) 289 0 0.0 15.8 0.0 15.8
還不知道怎讓才能對enumFromTo
生效:(
geojson 可以轉化成平面多邊形數據,然后你平均分布的點可以依次跟這個多邊形對比。
nextDelivery.rows.map(row => console.log(row.id))
并不是每個代理IP都有效,你要先確認代理是否有效再去使用
import requests
from pyquery import PyQuery as Q
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'}
proxies = {
"http": "http://103.235.245.35:8080"
}
r = requests.get('http://hz.xiaozhu.com/', headers=headers, proxies=proxies)
for _ in Q(r.text)('#page_list li'):
title = Q(_).find('.result_title').text()
price = Q(_).find('.result_price').text()
print title, price
plt是別的變量吧,試試在出錯一行上面加上
import matplotlib.pyplot as plt
$arr = array(
array('id'=>'1','name'=>'a'),
array('id'=>'1','name'=>'b'),
array('id'=>'1','name'=>'c'),
array('id'=>'2','name'=>'d'),
array('id'=>'2','name'=>'e'),
);
$result = array();
foreach ($arr as $value) {
$result[$value['id']]['id'] = $value['id'];
$result[$value['id']]['name'][] = $value['name'];
}
$result = array_values($result);
print_r($result);
函數自己封裝吧
下載的SDK文件中的config配置參數沒有改,改成自己的微信參數就OK了
MySQL8在這里和低版本不兼容,你可以重新安裝MySQL(或者用Reconfigure選項),把認證的選項設置為“Use Legacy Authentication Method”, 或者你如果不是必須要用MySQL 8,可以降級到低版本。
參考官方文檔
public static ExecutorService newFixedThreadPool(int nThreads)
創(chuàng)建一個線程池, 在重用共享無界隊列中運行的固定線程數。在任何時候, nThreads 個線程都將是活動的處理任務。如果在所有線程都處于活動狀態(tài)時提交了其他任務, 則它們將在隊列中等待, 直到線程可用為止。如果由于在關閉前執(zhí)行過程中出現(xiàn)故障而終止了任何線程, 則如果需要執(zhí)行后續(xù)任務, 則新項將取代它。池中的線程將存在, 直到顯式關閉為止。
可以用下面的程序測試
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
public class ThreadPoolTest1 {
static class MyTask implements Runnable {
private String name;
public MyTask(String name){
this.name = name;
}
@Override
public void run() {
for (int i = 0; i < 2; i++) {
// 做點事情
try {
Thread.sleep(100);
if(System.currentTimeMillis() % 3 == 0 ){
System.out.println("stop!");
throw new RuntimeException("break!"); //(1)注釋掉這一行將只有兩個Thread!
}
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(name + " said:" + i+" Thread="+Thread.currentThread().getName());
}
}
}
public static void main(String[] args) {
// 創(chuàng)建線程池
// ExecutorService threadPool = Executors.newSingleThreadExecutor();
ExecutorService threadPool = Executors.newFixedThreadPool(2);
// ExecutorService threadPool = Executors.newCachedThreadPool();
// 向線程池里面扔任務
for (int i = 0; i < 10; i++) {
threadPool.execute(new MyTask("Task" + i));
}
// 關閉線程池
threadPool.shutdown();
}
}
注釋掉(1)處的異常會得到正常結果
Task0 said:0 Thread=pool-1-thread-1
Task1 said:0 Thread=pool-1-thread-2
Task0 said:1 Thread=pool-1-thread-1
Task1 said:1 Thread=pool-1-thread-2
Task2 said:0 Thread=pool-1-thread-1
Task3 said:0 Thread=pool-1-thread-2
Task2 said:1 Thread=pool-1-thread-1
Task3 said:1 Thread=pool-1-thread-2
......
任務將在thread 1和2之間切換
拋出異常RuntimeException
會看到如下的情況:
.......
java.lang.RuntimeException: break!
at ThreadPoolTest1$MyTask.run(ThreadPoolTest1.java:22)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Task4 said:0 Thread=pool-1-thread-5
Task5 said:0 Thread=pool-1-thread-6
......
能看到線程池在不斷創(chuàng)建新的線程.
emmm...哪里出現(xiàn)了2^n??...
r.encoding = 'gbk'
soup = BeautifulSoup(r.text, 'lxml')
你覺得你表達清楚了嗎?
sea.distplot(x,hist_kws=dict(edgecolor='k'))
北大青鳥APTECH成立于1999年。依托北京大學優(yōu)質雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數據專業(yè)的國家
北大青鳥中博軟件學院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網學院和江蘇省首批服務外包人才培訓基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團創(chuàng)建于1999年,經過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術與教育服務機構,發(fā)展為教育服務業(yè)的綜合性企業(yè)集團,成為集合面授教學培訓、網
達內教育集團成立于2002年,是一家由留學海歸創(chuàng)辦的高端職業(yè)教育培訓機構,是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔任項目經理從事移動互聯(lián)網管理及研發(fā)工作,曾創(chuàng)辦藍懿科技有限責任公司從事總經理職務負責iOS教學及管理工作。
浪潮集團項目經理。精通Java與.NET 技術, 熟練的跨平臺面向對象開發(fā)經驗,技術功底深厚。 授課風格 授課風格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網頁制作和網頁游戲開發(fā)。
具有10 年的Java 企業(yè)應用開發(fā)經驗。曾經歷任德國Software AG 技術顧問,美國Dachieve 系統(tǒng)架構師,美國AngelEngineers Inc. 系統(tǒng)架構師。