精华内容
下载资源
问答
  • try可以做名词,也可以做动词。作动词时有试图,想要,设法审理等含义;作名词时有尝试,持球触地得分等含义。...第三人称单数:tries 现在分词:trying 过去式:tried 过去分词:triedtry的用法一.及物动词 vt.1....

    try可以做名词,也可以做动词。作动词时有试图,想要,设法审理等含义;作名词时有尝试,持球触地得分等含义。

    try的释义

    v.试图; 想要; 设法; 努力; 试; 试用; 试做; 试验; 审理; 审讯; 审判;

    n.尝试; 试图; 努力; 在对方球门线后带球触地; 持球触地得分;

    第三人称单数:tries 现在分词:trying 过去式:tried 过去分词:tried

    try的用法

    一.及物动词 vt.

    1.试图;努力[+to-v]

    We'll try to improve our teaching methods.

    我们要设法改进教学方法.

    2.尝试,试行[+v-ing]

    Let's try knocking at the back door.

    咱们敲后边的门试试.

    3.试验,试用[(+out)][+v-ing]

    Try this key.

    试试这把钥匙.

    The method seems good but it needs to be tried out.

    这个方法似乎不错,但需要试验一下.

    4.试着推(或开)(门、窗等)

    We tried the door,but it was locked.

    我们试着开门,可门锁上了.

    5.审理,审判[(+for)]

    Their case will be tried next month.

    他们的案子将在下个月开审.

    6.考验,磨炼;折磨,使苦恼

    Asthma tries him a great deal.

    哮喘折磨得他够受.

    This will try your courage.

    这对你的勇气将是一个考验.

    二.不及物动词 vi.

    1.试图;努力;试验;尝试

    Try and eat a little.

    试着吃一点吧!

    三.作名词 n.

    1.尝试;努力

    Who'd like to have a try at it?

    谁想试试?

    2.【橄】持球触地得分

    try /traI/v.to make an effort to do or get something试图;努力。

    例如可以这样造句 I'll try to learn French.我要努力学习法语.除此之外try还有一些要点:

    try常用搭配的短语:

    try one's best尽某人最大努力

    try one's fortune碰运气

    try on试穿

    have a try试试看;尝试一下

    展开全文
  • curl命令的用法

    千次阅读 2018-10-30 15:08:37
    点击个人博客,查看更多文章https://elonjelinek.github.io/ 在shell终端中进行测试 显示通信过程:加-v 示例:curl -v baidu.com kdpjlnk:~ kdpjlnk$ curl -v baidu....* Trying 220.181.57.216... * TCP_NODELAY s...

    点击个人博客,查看更多文章https://elonjelinek.github.io/

    在shell终端中进行测试

    显示通信过程:加-v

    示例:curl -v www.baidu.com/

    sszxr:~ sszxr$ curl -v www.baidu.com/
     1.   Trying 14.215.177.38...
     2. TCP_NODELAY set
     3. Connected to www.baidu.com (14.215.177.38) port 80 (#0)
    > GET / HTTP/1.1
    > Host: www.baidu.com
    > User-Agent: curl/7.54.0
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    < Accept-Ranges: bytes
    < Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
    < Connection: Keep-Alive
    < Content-Length: 2381
    < Content-Type: text/html
    < Date: Fri, 11 Jan 2019 10:14:10 GMT
    < Etag: "588604dc-94d"
    < Last-Modified: Mon, 23 Jan 2017 13:27:56 GMT
    < Pragma: no-cache
    < Server: bfe/1.0.8.18
    < Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
    < 
    <!DOCTYPE html>
    <!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn"></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>新闻</a> <a href=http://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>地图</a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>视频</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>贴吧</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>登录</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登录</a>');</script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">更多产品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=http://home.baidu.com>关于百度</a> <a href=http://ir.baidu.com>About Baidu</a> </p> <p id=cp>&copy;2017&nbsp;Baidu&nbsp;<a href=http://www.baidu.com/duty/>使用百度前必读</a>&nbsp; <a href=http://jianyi.baidu.com/ class=cp-feedback>意见反馈</a>&nbsp;京ICP证030173号&nbsp; <img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html>
     4. Connection #0 to host www.baidu.com left intact
    sszxr:~ sszxr$ 
    

    这里的输出结果包含四部分内容:

    第一部分:通信过程

    显示了网站的真实IP地址,端口号

    1.   Trying 14.215.177.38...
    2. TCP_NODELAY set
    3. Connected to www.baidu.com (14.215.177.38) port 80 (#0)
    

    第二部分:request请求头信息

    请求的方法,HTTP协议版本,域名,用户代理

    > GET / HTTP/1.1
    > Host: www.baidu.com
    > User-Agent: curl/7.54.0
    > Accept: */*
    

    第三部分:response响应头信息

    < HTTP/1.1 200 OK
    < Accept-Ranges: bytes
    < Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
    < Connection: Keep-Alive
    < Content-Length: 2381
    < Content-Type: text/html
    < Date: Fri, 11 Jan 2019 10:14:10 GMT
    < Etag: "588604dc-94d"
    < Last-Modified: Mon, 23 Jan 2017 13:27:56 GMT
    < Pragma: no-cache
    < Server: bfe/1.0.8.18
    < Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
    

    第四部分:网页代码

    <!DOCTYPE html>
    <!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道…………略略略……………
    

    如果请求的是https开头的完整网址,还会显示网站的安全证书信息

    示例:curl -v https://www.baidu.com/

    kdpjlnk:~ kdpjlnk$ curl -v https://www.baidu.com/
    *   Trying 14.215.177.38...
    * TCP_NODELAY set
    * Connected to www.baidu.com (14.215.177.38) port 443 (#0)
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
    * successfully set certificate verify locations:
    *   CAfile: /etc/ssl/cert.pem
      CApath: none
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    * TLSv1.2 (IN), TLS change cipher, Client hello (1):
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
    * ALPN, server accepted to use http/1.1
    * Server certificate:
    *  subject: C=CN; ST=beijing; L=beijing; OU=service operation department; O=Beijing Baidu Netcom Science Technology Co., Ltd; CN=baidu.com
    *  start date: Apr  3 03:26:03 2017 GMT
    *  expire date: May 26 05:31:02 2019 GMT
    *  subjectAltName: host "www.baidu.com" matched cert's "*.baidu.com"
    *  issuer: C=BE; O=GlobalSign nv-sa; CN=GlobalSign Organization Validation CA - SHA256 - G2
    *  SSL certificate verify ok.
    > GET / HTTP/1.1
    > Host: www.baidu.com
    > User-Agent: curl/7.54.0
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    < Accept-Ranges: bytes
    < Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
    < Connection: Keep-Alive
    < Content-Length: 2443
    < Content-Type: text/html
    < Date: Tue, 23 Oct 2017 04:32:00 GMT
    < Etag: "58860401-98b"
    < Last-Modified: Mon, 23 Jan 2017 13:24:17 GMT
    < Pragma: no-cache
    < Server: bfe/1.0.8.18
    < Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
    < 
    <!DOCTYPE html>
    <!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus=autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn" autofocus></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>新闻</a> <a href=https://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>地图</a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>视频</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>贴吧</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>登录</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登录</a>');
                    </script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">更多产品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=http://home.baidu.com>关于百度</a> <a href=http://ir.baidu.com>About Baidu</a> </p> <p id=cp>&copy;2017&nbsp;Baidu&nbsp;<a href=http://www.baidu.com/duty/>使用百度前必读</a>&nbsp; <a href=http://jianyi.baidu.com/ class=cp-feedback>意见反馈</a>&nbsp;京ICP证030173号&nbsp; <img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html>
    * Connection #0 to host www.baidu.com left intact
    kdpjlnk:~ kdpjlnk$ 
    

    这一次的输出结果包含五部分信息,分别是:
    通信过程,安全证书信息,请求头,响应头,网站代码。

    只显示响应头和网站代码:-i

    示例 curl -i https://www.mi.com

    sszxr:~ sszxr$ curl -i https://www.mi.com
    HTTP/1.1 200 OK
    Expires: Fri, 11 Jan 2019 11:08:55 GMT
    Date: Fri, 11 Jan 2019 11:06:55 GMT
    Content-Type: text/html; charset=utf-8
    Content-Length: 324749
    Last-Modified: Fri, 11 Jan 2019 11:05:01 GMT
    ETag: "5c38785d-4f48d"
    Accept-Ranges: bytes
    Cache-Control: max-age=120
    X-Cacheable: MI-WWW-Cacheable
    Server: MIFE/3.0
    X-Frame-Options: SAMEORIGIN
    Cache_state: 2
    Cache_state: 0
    Cache_state: 2
    X-Via: 1.1 PSjsczBGP2ay152:5 (Cdn Cache Server V2.0), 1.1 qzhdx44:8 (Cdn Cache Server V2.0), 1.1 gzhdx14:2 (Cdn Cache Server V2.0)
    Connection: keep-alive
    
    <!doctype html>
    <html lang="zh-CN" xml:lang="zh-CN">
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta charset="UTF-8" />
    ………………………………略略略…………………………………
    

    只显示网站代码:-l

    示例:curl -l https://www.mi.com

    sszxr:~ sszxr$ curl -l https://www.mi.com
    <!doctype html>
    <html lang="zh-CN" xml:lang="zh-CN">
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta charset="UTF-8" />
    <title>小米商城 - 小米MIX 3、红米Note 7、小米8、小米电视官方网站</title>
    <meta name="description" content="小米商城直营小米公司旗下所有产品,囊括小米手机系列小米MIX 3、小米8、小米Note 3,红米手机系列红米Note 7、红米6 Pro,智能硬件,配件及小米生活周边,同时提供小米客户服务及售后支持。" />
    <meta name="keywords" content="小米,小米8,小米Note3,红米Note7,小米MIX3,小米商城" />
    <meta name="viewport" content="width=1226" />
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <link rel="dns-prefetch" href="//s01.mifile.cn" />
    <link rel="dns-prefetch" href="//c1.mifile.cn" />
    <link rel="dns-prefetch" href="//i3.mifile.cn" />
    <link rel="dns-prefetch" href="//i2.mifile.cn" />
    <link rel="dns-prefetch" href="//i1.mifile.cn" />
    <link rel="dns-prefetch" href="//i8.mifile.cn" />
    <link rel="dns-prefetch" href="//v.mifile.cn" />
    <link rel="dns-prefetch" href="//a.huodong.mi.cn" />
    
    <link rel="shortcut icon" href="//s01.mifile.cn/favicon.ico" type="image/x-icon" />
    …………………………………………略略略……………………………………………
    

    保存网页:-o

    示例:curl -o ~/Desktop/baidu.html https://www.baidu.com

    kdpjlnk:~ kdpjlnk$ curl -o ~/Desktop/baidu.html https://www.baidu.com
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2443  100  2443    0     0   9466      0 --:--:-- --:--:-- --:--:--  9432
    kdpjlnk:~ kdpjlnk$ 
    

    这样,桌面生成了一个名为:baidu.html的文件,打开可以看见是百度的首页。

    自动跳转 : -L

    示例:curl -L www.sina.com

    curl -L www.sina.com
    

    这样会自动跳转到https://www.sina.com.cn/

    显示详细通信过程:--trace

    示例:

    curl --trace ~/Desktop/baidu.txt www.baidu.com
    或者curl --trace-ascii ~/Desktop/baidu.txt www.baidu.com

    打开桌面文件baidu.txt会发现里面的信息非常多。

    只显示或不显示网站代码

    curl命令的输出结果被shell终端分成了两部分:

    标准错误
    运行结果

    【网站代码】部分相当于curl命令的运行结果,而【其余部分】相当于标准错误
    如果想要查看详细的通信过程,却不想要网站代码(实在太长了),可以将网站代码部分输出到一个文件,或者直接舍弃,不让它输出
    示例:curl -v https://www.mi.com > /dev/null
    > /dev/null 表示将命令的运行结果丢弃,
    >是重定向
    /dev/null是Linux文件系统的一个空文件,输入到该文件的所有内容会被丢弃。

    sszxr:~ sszxr$ curl -v https://www.mi.com > /dev/null
    * Rebuilt URL to: https://www.mi.com/
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 113.96.172.80...
    * TCP_NODELAY set
    * Connected to www.mi.com (113.96.172.80) port 443 (#0)
    * ALPN, offering h2
    * ALPN, offering http/1.1
    * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
    * successfully set certificate verify locations:
    *   CAfile: /etc/ssl/cert.pem
      CApath: none
    * TLSv1.2 (OUT), TLS handshake, Client hello (1):
    } [512 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server hello (2):
    { [115 bytes data]
    * NPN, negotiated HTTP1.1
    * TLSv1.2 (IN), TLS handshake, Certificate (11):
    { [5118 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
    { [333 bytes data]
    * TLSv1.2 (IN), TLS handshake, Server finished (14):
    { [4 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
    } [70 bytes data]
    * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
    } [1 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Unknown (67):
    } [36 bytes data]
    * TLSv1.2 (OUT), TLS handshake, Finished (20):
    } [16 bytes data]
    * TLSv1.2 (IN), TLS change cipher, Client hello (1):
    { [1 bytes data]
    * TLSv1.2 (IN), TLS handshake, Finished (20):
    { [16 bytes data]
    * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
    * ALPN, server did not agree to a protocol
    * Server certificate:
    *  subject: OU=Domain Control Validated; CN=www.mi.com
    *  start date: Dec  7 07:03:32 2018 GMT
    *  expire date: Dec  6 02:44:28 2019 GMT
    *  subjectAltName: host "www.mi.com" matched cert's "www.mi.com"
    *  issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
    *  SSL certificate verify ok.
    > GET / HTTP/1.1
    > Host: www.mi.com
    > User-Agent: curl/7.54.0
    > Accept: */*
    > 
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< HTTP/1.1 200 OK
    < Expires: Fri, 11 Jan 2019 11:25:42 GMT
    < Date: Fri, 11 Jan 2019 11:23:42 GMT
    < Content-Type: text/html; charset=utf-8
    < Content-Length: 324749
    < Last-Modified: Fri, 11 Jan 2019 11:23:01 GMT
    < ETag: "5c387c95-4f48d"
    < Accept-Ranges: bytes
    < Cache-Control: max-age=120
    < X-Cacheable: MI-WWW-Cacheable
    < Server: MIFE/3.0
    < X-Frame-Options: SAMEORIGIN
    < Cache_state: 2
    < Cache_state: 2
    < X-Via: 1.1 qzhdx44:8 (Cdn Cache Server V2.0), 1.1 PSgdmmdx4cj23:7 (Cdn Cache Server V2.0)
    < Connection: keep-alive
    < 
    { [4096 bytes data]
    100  317k  100  317k    0     0   279k      0  0:00:01  0:00:01 --:--:--  279k
    * Connection #0 to host www.mi.com left intact
    sszxr:~ sszxr$ 
    

    这样就只显示了通信过程,证书信息,请求头信息,响应头信息,而网站代码被丢弃了。

    类似的curl -v https://www.mi.com 2> /dev/null相当于将标准错误丢弃,而只输出运行结果,
    所以
    curl -v https://www.mi.com 2> /dev/null
    curl -l https://www.mi.com
    这两个命令的输出结果是一样的,都只输出了网站代码。

    下面再看看
    curl -i https://www.mi.com > /dev/null
    没有任何结果

    sszxr:~ sszxr$ curl -i https://www.mi.com > /dev/null
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  317k  100  317k    0     0   379k      0 --:--:-- --:--:-- --:--:--  379k
    sszxr:~ sszxr$ 
    

    curl -i https://www.mi.com 2> /dev/null

    sszxr:~ sszxr$ curl -i https://www.mi.com 2> /dev/null
    HTTP/1.1 200 OK
    Expires: Fri, 11 Jan 2019 11:38:59 GMT
    Date: Fri, 11 Jan 2019 11:36:59 GMT
    Content-Type: text/html; charset=utf-8
    Content-Length: 324749
    Last-Modified: Fri, 11 Jan 2019 11:35:01 GMT
    ETag: "5c387f65-4f48d"
    Accept-Ranges: bytes
    Cache-Control: max-age=120
    X-Cacheable: MI-WWW-Cacheable
    Server: MIFE/3.0
    X-Frame-Options: SAMEORIGIN
    Cache_state: 0
    Cache_state: 2
    X-Via: 1.1 qzhdx44:8 (Cdn Cache Server V2.0), 1.1 gzhdx14:3 (Cdn Cache Server V2.0)
    Connection: keep-alive
    
    <!doctype html>
    <html lang="zh-CN" xml:lang="zh-CN">
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta charset="UTF-8" />
    <title>小米商城 - 小米MIX 3、红米Note 7、小米8、小米电视官方网站</title>
    <meta name="description" content="小米商城直营小米公司旗下所有产品,囊括小米手机系列小米MIX 3、小米8、小米Note 3,红米手机系列红米Note 7、红米6 Pro,智能硬件,配件及小米生活周边,同时提供小米客户服务及售后支持。" />
    <meta name="keywords" content="小米,小米8,小米Note3,红米Note7,小米MIX3,小米商城" />
    <meta name="viewport" content="width=1226" />
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <link rel="dns-prefetch" href="//s01.mifile.cn" />
    <link rel="dns-prefetch" href="//c1.mifile.cn" />
    <link rel="dns-prefetch" href="//i3.mifile.cn" />
    <link rel="dns-prefetch" href="//i2.mifile.cn" />
    <link rel="dns-prefetch" href="//i1.mifile.cn" />
    <link rel="dns-prefetch" href="//i8.mifile.cn" />
    <link rel="dns-prefetch" href="//v.mifile.cn" />
    <link rel="dns-prefetch" href="//a.huodong.mi.cn" />
    …………………………………………略略略略…………………………………………
    

    命令
    curl -i https://www.mi.com 2> /dev/null
    curl -i https://www.mi.com
    的输出结果一模一样,说明【响应头】和【网站代码】都被当成了运行结果,而其他部分相当于标准错误。

    指定输出特定内容:

    sszxr:~ sszxr$ curl -o /dev/null -s -w "%{http_code}\n" "http://www.baidu.com"
    200
    ElonJelinek:~ ElonJelinek$ curl -o /dev/null -s -w "time_total: %{time_total}\n" "http://www.baidu.com"
    time_total: 0.390102
    sszxr:~ sszxr$ 
    

    参考文章:

    Linux curl命令详解
    点击个人博客,查看更多文章https://elonjelinek.github.io/

    展开全文
  • 查询FlagSet的用法

    2018-09-12 02:00:31
    <p>I am trying to build a CLI where I expect a group of three arguments to appear together. <pre><code>command --alpha "value-a" --bravo "value-b" --charlie "value-c" </code></pre> <p>This is how I ...
  • 选择并获取sqlx的用法

    2018-08-25 15:30:17
    <p>I'm using go 1.10.3 and I'm trying to use the sqlx package to get one row and enter it to a struct with <code>Get(), or get several rows and enter them to a slice with <code>Select()</code>. ...
  • The method I am trying to use is the:drawImage(image, int, int, int, int, ImageObserver) methodso that i can scale my image, on all the examples i've seen the ImageObserver should be this, but this do...

    The method I am trying to use is the:

    drawImage(image, int, int, int, int, ImageObserver) method

    so that i can scale my image, on all the examples i've seen the ImageObserver should be this, but this doesn't seem to work(i.e. the only methods i have seen is:

    drawImage(image, int, int, ImageObserver), don't know if this makes a difference).

    Here is my main class that is the applet:

    import java.applet.*;

    import java.awt.*;

    public class Main extends Applet implements Runnable{

    private Thread th;

    private Hitter hitter;

    //double buffering

    private Graphics dbg;

    private Image dbImage;

    public void init(){

    hitter = new Hitter(getImage(getCodeBase(), "Chitter.png"));

    }

    public void start(){

    th = new Thread(this);

    th.start();

    }

    public void stop(){

    th.stop();

    }

    public void update(Graphics g){

    if(dbImage == null){

    dbImage = createImage(this.getSize().width, this.getSize().width);

    dbg = dbImage.getGraphics();

    }

    dbg.setColor(getBackground());

    dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);

    dbg.setColor(getForeground());

    paint(dbg);

    g.drawImage(dbImage, 0, 0, this);

    }

    public void paint(Graphics g){

    hitter.drawHitter(g);

    }

    public void run() {

    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);

    while(true){

    repaint();

    try{

    Thread.sleep(15);

    }catch(InterruptedException ex){}

    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);

    }

    }

    public boolean mouseMove(Event e, int x, int y){

    hitter.move(x);

    return true;

    }

    }

    Here is the Hitter class:

    import java.awt.*;

    import java.awt.image.ImageObserver;

    public class Hitter{

    private int x, y;

    private Image hitter;

    private int hitterWidth = 50, hitterHeight = 10;

    private int appletsizeX = 500, appletsizeY = 500;

    Hitter(Image i){

    hitter = i;

    start();

    }

    public void drawHitter(Graphics g){

    g.drawImage(hitter, x, y, hitterWidth, hitterHeight, this);

    }

    public void move(int a){

    x = a;

    }

    public void start(){

    x = appletsizeX/2 - hitterWidth/2;

    y = 0;

    }

    }

    解决方案

    Unless the class in which you are calling Graphics.drawImage(Image, int, int, int, int, ImageObserver) is an ImageObserver, using this as the argument for the ImageObserver will not work:

    class MyClass {

    public void resizeImage() {

    Graphics g = getGraphicsObjectFromSomewhere();

    // The following line will not compile, as `MyClass`

    // does not implement `ImageObserver`.

    g.drawImage(img, 0, 0, 50, 50, this);

    }

    }

    If you're resizing an image which does not require an ImageObserver (such as a BufferedImage that already contains the image you want to resize), then you can just hand over a null:

    // The image we want to resize

    BufferedImage img = ImageIO.read("some-image.jpg");

    // The Graphics object of the destination

    // -- this will probably just be obtained from the destination image.

    Graphics g = getGraphicsObjectFromSomewhere();

    // Perform the resizing. Hand a `null` for the ImageObserver,

    // as we don't need one.

    g.drawImage(img, 0, 0, 50, 50, null);

    That said, I'm going to throw in a little plug for my image resizing library Thumbnailator.

    If all that is required is to resize an image, it can be accomplished as simple as the following code:

    Thumbnails.of("path/to/image")

    .size(100, 100)

    .toFile("path/to/thumbnail");

    Thumbnailator is flexible enough to accept BufferedImages, Files, and InputStreams as input.

    Seeing your edit, I would suggest to change the Hitter class, so that it will perform the resizing of the image in the constructor.

    Since you are calling the drawHitter method on each call from the Applet.drawImage, the resize operation using Graphics.drawImage is being called many times, even when the hitterWidth and hitterHeight are, for all intents and purposes, constants.

    Resizing the Image ahead of time, and drawing that pre-resized image in the drawHitter method will be more efficient.

    展开全文
  • 英语四级是每个大学生都必须越过难关,而阅读题长难句又是最让大家感到头疼部分。...Researchers in Canada just published a study in the journal Psychological Science that says trying to ...

    英语四级是每个大学生都必须越过的难关,而阅读题的长难句又是最让大家感到头疼的部分。究竟怎样才能攻克这个难题!?其实长难句并没有你想象中的那么难,今天就让艾伦英语部落带你掌握轻轻松松过四级的诀窍吧!

    Researchers in Canada just published a study in the journal Psychological Science that says trying to get people to think more positively can actually have the opposite effect: it can simply highlight how unhappy they are.

    今天的这篇文章告诉了我们一项研究成果:对于有消极心理的人来说,过度肯定会使他们更加消极,就像你告诉一个比较笨的朋友,他有成为第二个爱因斯坦的潜力,对方只会觉得你在讽刺他。强迫他们肯定自己只会给他们带去更低落的情绪。

    我们首先来一起学习句中的重点考试词汇:

    9a7262fd56dc9abfff199d1128923233.png

    第一个单词researcher一般用于表示“研究人员;调查者”,这个名词不难背,research就是“研究”的意思,在后面加上一个构成“…人”的后缀er,是不是很好记呢?第二个单词psychological是形容词,意思是“心理学的”,它的名词形式是psychology(心理学)。positively意思是“肯定地”,是一个副词。最后一个单词opposite,作为形容词使用时,是“相反的”的意思,也可以当副词使用,作为名词使用时,译为“对立面;反义词”。

    讲完了单词,接下来就要进入我们的正题——分析长难句啦~

    看到这个句子的第一眼,你可能会觉得分析起来很麻烦,是典型的又长从句又多的句子。但实际上它并没有那么让人崩溃,它是最为典型的主句中有从句从句中又套从句的类型,将它们一个个剥离开就比较简单啦~

    b38c5cd53e93476c212b630d6686db30.png

    首先我们提取出主句部分“Researchers …Science”,这是一个主谓宾结构的主句,主语是researcher,谓语是published,宾语是study。剩余的“in Canada”和“in the journal Psychological Science”都是介词短语,使句子更为丰富的。just在这里是副词,修饰谓语published。

    紧跟着主句的后面是一个有that引导的定语从句“that…are”,这个定语从句主要是修饰宾语study,作者想告诉大家,这是一个什么研究。says是这个定语从句里的谓语,后面又是一个宾语从句(作定语从句中的宾语成份)“trying…are”。

    这个宾语从句有点长,总的句子结构是主谓宾,主语部分是“trying to … positively”,谓语是“can have”,宾语是“effect”。冒号后面的句子“it … are”是作补充使用的。这样一分析是不是简单很多了呢?

    讲完了句子结构,今天我还想和大家拓展一下英语中冒号的用法,一般分为六种用法,其中三种我们不多加赘述,一种是表示时间比如“10:30”,这是国际通用的;另外一种是用于标题,将主标题和副标题隔开;最后就是用于写信的时候啦~

    剩下的三种用法都非常重要,一起来钻研学习吧!

    b1acf54d81cccfaee4b0028540c9ab13.png

    第四种用法就是今天我们这个长难句的用法啦:对前面的内容进行补充说明,冒号前面的内容是对冒号后面的内容的概括。我们来看下面这个例句:

    19d69a0b0e27e0933b03be0272e6dc40.png

    冒号的第五种用法和第六种方法我们放在一起讲,英语中竖排名单的话,冒号前的句子可以不是一个完整的句子;而横排名单则要求冒号前是一个完整的句子,比如:I have 4 friends: two girls and two boys. (我有四个朋友,两个女孩和两个男孩)。你看冒号前是一个完整的主谓宾结构的句子。是不是很好理解呢?

    通过今天的学习,我们一起解析了一个长难句,还拓展了英语中冒号的六种用法,是不是觉得收获颇多呢?希望大家能给我们一个,喜欢我们的内容的话,可以点击关注艾伦英语部落哦!

    展开全文
  • I am trying to implement HOG Descriptor with OpenCV to detect Pedestrians in a video. I am currently using the pre-made dataset by OpenCV hogcascade_pedestrians.xml. Unfortuntley the documentation on ...
  • <p>I am trying to figure out how to store the date-time in the database. I want to aim at a good balance between the space the saved time in the database will occupy, but also the query-capabilties ...
  • <p>In order to enter the reservation into the system, I am trying to centralize the Add Reservation logic into one method. To do this, I am trying to create a class called Reservation using the ...
  • <p>I am trying to create session for which I need to send the values in header. I have try the following code with post data and header as well but failed. did not get any output. <pre><code>$request...
  • <p>I'm trying to grasp the concept of continuations and I found several small teaching examples like this one from the <a href="http://en.wikipedia.org/wiki/Continuation" rel="noreferrer">Wikipedia ...
  • <p>The problem I'm trying to solve is using io.Reader and io.Writer in a net application without using bufio and strings as per the examples I've been able to find online. For efficiency I'm trying to...
  • I have been trying to hook to CWnd::Create method. I tried to hook using SetWindowsHookEx api. But this is not working consistently. So, I have followed the following blog ...
  • I am trying to replace escaped double quotes to single quotes in a key value pairimport reimport jsonjs = r'{"result":"{\"key\":\"How are you? \"Great!\" he said. \"Coffee ?\"\"},{\"key\":\" 2. \"Why ...
  • <p>I am making use of the ... The interface is implemented by a lot of classes so I am trying not to break dependencies; will you advice downgrading my php version on the life server? </p> </div>
  • <p>I am new to golang and trying to get a better understanding of context. <p>In the below snippet, it appears to me that I've instantiated my <code>computeService</code> with a context. why do I ...
  • read about用法

    2019-10-05 09:01:23
    And I read about these women trying to have it all, and I thank God 'Our Little Harmonica' doesn't seem to have that problem. ---《老友记》 第一季 第二集 我还知道,这些女人想拥有一切,幸好我们家小...
  • I'm working with tkinter in python and I have an annoying bug that I can't seem to fix, although the answer is probably obvious.I am trying to call a dictionary with a string, but for some reason I ge...
  • I'm trying to create a Scrabble game with Python. I'd like to display the points that the word worth when the user is typing the word.I already asked this question as I didn't know what method to use....
  • as? for casts that are allowed to ... This would happen if the object is nil or doesn’t have a type that is compatible with the one you’re trying to cast to. It will try to cast to the new type an
  • 一般情况下不用e799bee5baa6e997aee7ad94e4b893e5b19...除非是这种情况:They are seeking compensation/damages [=they are trying to get money] for their loss. 在这句中for their loss是一个短语,不是什么seek...
  • Specifically, how do I replicate the following batch command using python subprocess ...:myprogram myoutput.outIf you don't know, I am trying to run myprogram using the contents of myinput.in as t...
  • I have a vector of functions and I am trying to obtain subsets from it. I transform the functions in the vector into a cell array so that I can index into it. Here is the scriptcoeff1 = 1;coeff2 = 2;c...
  • but nobody ever says WHY they would use it over just typing out <code>12345</code> so like I said, why use them and what is their benefit over just typing the number out you're trying to get?...
  • <p>I'm trying to port an algorithm from Python to Go. The central part of it is a tree built using dicts, which should stay this way since each node can have an arbitrary number of children. All ...
  • <p>I'm trying to represent a simplified chromosome, which consists of N bases, each of which can only be one of <code>{A, C, T, G}</code>. <p>I'd like to formalize the constraints with an enum, but I...

空空如也

空空如也

1 2 3 4
收藏数 63
精华内容 25
关键字:

trying的用法