小编Mik*_*min的帖子

Golang google sheet API V4 - 写/更新示例?

尝试[][]string用Go 编写一个简单的三列表(),但不能.该快速入门指南是非常好的,我现在可以读取表,但如何将数据写入到纸张没有任何例子,也许是微不足道的,但对我来说,似乎.我的大脑的Golang图书馆太复杂了,无法弄清楚.而且没有一个例子我可以google ...

这个C#示例非常接近,但我不确定我是否清楚地了解C#

go google-sheets

6
推荐指数
2
解决办法
4352
查看次数

Perl LWP :: UserAgent,https到特定https网站的代理,未知协议错误

阅读我能找到的关于主题的所有内容......无法确定如何使其成功.

我使用新更新的(2015年1月9日)Active State Perl和标准方法

my $ua=LWP::UserAgent->new();  
$ua->agent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/33.0');
$ua->timeout(120);
$ua->cookie_jar( {} );
$ua->proxy(['https'],'https://199.200.120.140:8089') #taken from http://proxylist.hidemyass.com/search-1308872#listable
my $response = $ua->get('https://www.comparis.ch');   #this web site I struggle with, I can connect to https://github.com for example... But I also can connect to comparis.ch through same proxy using urllib3 on Python3.4... 
Run Code Online (Sandbox Code Playgroud)

如果有人能解释如何从网站获得200?输出来自

响应返回Timeout(如果我使用http代理,或者

LWP::Protocol::https::Socket: SSL connect attempt failed error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol at E:/Perl64/lib/LWP/Protocol/http.pm line 49." 
Run Code Online (Sandbox Code Playgroud)

如果我试试

LWP::UserAgent->new(ssl_opts => { verify_hostname => 0, SSL_version => 'SSLv3' });
Run Code Online (Sandbox Code Playgroud)

然后我得到了

LWP::Protocol::https::Socket: …
Run Code Online (Sandbox Code Playgroud)

perl proxy

3
推荐指数
1
解决办法
3784
查看次数

Abs初学者Haskell模式匹配

我只是设法以ubuntu下的所有工作方式安装Haskell和EclipseFP!:)我花了很长时间才完成所有工作 - 没有--force :)我开始探索learnyouahaskell并且那个模式看起来真的很有趣......但我有疑问,例如我想计算这样的等式:

equation :: [(Integer, Integer)]
equation = [ (x,y) | x <- [1..100],y<-[1..100], y == 2*x-4, x == 2*y-4]
Run Code Online (Sandbox Code Playgroud)

我必须对x和y范围设置限制,但是可以使用x < - [1 ..]和y < - [1 ..]并在找到第一对x和y之后使函数停止吗?

haskell

3
推荐指数
1
解决办法
165
查看次数

Parallel-ForkManager,DBI.比之前分叉更快,但仍然太慢

我有一个非常简单的任务来更新数据库.

my $pm = new Parallel::ForkManager(15);
for my $line (@lines){
    my $pid = $pm->start and next;
    my $dbh2 = $dbh->clone();
    my $sth2 = $dbh2->prepare("update db1 set field1=? where field2 =?");           
    my ($field1, $field2) = very_slow_subroutine();
    $sth2->execute($field1,$field2);
    $pm->finish;        
} 
 $pm->wait_all_children;    
Run Code Online (Sandbox Code Playgroud)

我可以使用$ dbh2-> do,但我怀疑这是一个缓慢的原因.

有趣的是,它看起来很快就开始了这15个过程(或者我指定的任何过程),但是在那之后急剧减速,仍然明显快于没有分叉,但我希望更多......

编辑:

very_slow_subroutine是sub,它从Web服务获得答案.该服务可以在几秒到几秒的时间内回答.我要问十万次......我想做一个叉子的原因.

如果这很重要 - 我在Linux上.

perl performance fork dbi

1
推荐指数
1
解决办法
492
查看次数

带有http.client的“无效内存地址...”的图源

我正在学习并在这个恐慌错误中挣扎......它工作了一段时间,但很快就出现了这样的异常 panic: runtime error: invalid memory address or nil pointer dereference

该函数简单地遍历代理映射,直到它成功获得“地址”的内容。一定不是很惯用,尤其是用map代替slice和last return,但我希望这不是panic Crush的原因......如果我遗漏了一些可能重要的东西,请告诉我,我会更新帖子,我只是不想用不必要的信息淹没它。proxies 是一个带有 map 字段的结构体,具有并发安全读取/删除的方法。

func getContent(address string) string {
localProxies := proxies.Get()
for proxy := range localProxies {
    proxyUrl, _ := url.Parse("http://" + proxy)

    transport := http.Transport{
        Dial:  dialTimeout,
        Proxy: http.ProxyURL(proxyUrl),
    }
    httpClient := http.Client{Transport: &transport, Timeout: timeout}
    req, err := http.NewRequest("GET", address, nil)
    if err != nil {
        fmt.Println("Request error: ", err.Error())
    }
    req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0")
    res, err := httpClient.Do(req) …
Run Code Online (Sandbox Code Playgroud)

go http.client

0
推荐指数
1
解决办法
820
查看次数

标签 统计

go ×2

perl ×2

dbi ×1

fork ×1

google-sheets ×1

haskell ×1

http.client ×1

performance ×1

proxy ×1