<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by zhuo on Medium]]></title>
        <description><![CDATA[Stories by zhuo on Medium]]></description>
        <link>https://medium.com/@lacklock?source=rss-537ba6514bf4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UMjiPmVjm2JVWCdPOo-0Og.jpeg</url>
            <title>Stories by zhuo on Medium</title>
            <link>https://medium.com/@lacklock?source=rss-537ba6514bf4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 14:40:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lacklock/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Swift 5.0 值得关注的特性：更强大的 Raw String]]></title>
            <link>https://medium.com/@lacklock/swift-5-0-%E5%80%BC%E5%BE%97%E5%85%B3%E6%B3%A8%E7%9A%84%E7%89%B9%E6%80%A7-%E6%9B%B4%E5%BC%BA%E5%A4%A7%E7%9A%84-raw-string-55a1351e6b7?source=rss-537ba6514bf4------2</link>
            <guid isPermaLink="false">https://medium.com/p/55a1351e6b7</guid>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[zhuo]]></dc:creator>
            <pubDate>Tue, 02 Apr 2019 11:05:45 GMT</pubDate>
            <atom:updated>2019-04-02T11:05:45.610Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><a href="https://www.hackingwithswift.com/articles/126/whats-new-in-swift-5-0">HackingSwift: What’s new in Swift 5.0</a></blockquote><blockquote><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0200-raw-string-escaping.md">SE200: Enhancing String Literals Delimiters to Support Raw Text</a></blockquote><p>Swift 5.0 对字符串声明增加了一个强有力的新特性，使用 # 包裹字符串。</p><h4>原有方式的不足</h4><p>传统的方式我们使用双引号包裹来声明字符串，如果有参数则只用 \(参数)表示。由此引发的问题是如果字符串中包含 \ ” 则需要进行转义，否则格式识别会有冲突：</p><pre>let qutoedString = &quot;如果句子里面有\&quot;双引号\&quot;就很尴尬&quot;<br>// 输出： 如果句子里面有&quot;双引号&quot;就很尴尬<br><br>let escapeString = &quot;如果句子里面有\\转义符号反斜杆\\也很尴尬&quot;<br>// 输出： 果句子里面有\转义符号反斜杆\也很尴尬</pre><h4>解决方案</h4><p>5.0 中增加的解决方案是引入一个新的字符 # 声明字符串：</p><pre>let newQutoedString = #&quot;如果句子里面有&quot;双引号&quot;就很尴尬&quot;#<br>// 输出： 如果句子里面有&quot;双引号&quot;就很尴尬<br><br>let newEscapeString = #&quot;如果句子里面有\转义符号反斜杆\也很尴尬&quot;#<br>// 输出： 果句子里面有\转义符号反斜杆\也很尴尬</pre><p>如果字符串声明被 # 号包裹，字符串中的 \ ” 不再需要转义了。</p><p>相对的字符串中的参数占位符也要修改为 \#(参数)：</p><pre>let escapeCharacter = #&quot;\&quot;#<br>let newParamString = #&quot;如果句子里面有\#(escapeCharacter)转义符号反斜杆\#(escapeCharacter)也很尴尬&quot;#</pre><h4>多行文本</h4><p>在 4.0 中引入了 &quot;&quot;&quot; 表示多行的文本，新的方法也兼容多行文本。方式和前面类似，在 &quot;&quot;&quot; 前增加 # 即可：</p><pre>let multiLineText = #&quot;&quot;&quot;<br>   &quot;\&quot;<br>一切正常<br>&quot;&quot;&quot;#</pre><h4>新的问题</h4><p>使用井号表示的字符串结尾的字符是 &quot;#，如果句子中出现了 &quot;# 则不可避免引起歧义，所以需要一种新的方式转义。区别于传统的在需要转义的字符前加反斜杆的方式，Swift 中采用的是在将首尾的 # 替换为 ##：</p><pre>let escapeHashCharacter = ##&quot;如果刚好有个字符 &quot;# 呵呵和结束符意义就尴尬了&quot;##</pre><h4>总结</h4><p>如果你刚好需要声明一个正则表达式，使用新的方案会优雅、直观很多：</p><pre>let regex1 = &quot;\\\\[A-Z]+[A-Za-z]+\\.[a-z]+&quot;<br><br>let regex2 = #&quot;\\[A-Z]+[A-Za-z]+\.[a-z]+&quot;#</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55a1351e6b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[程序员的英语学习笔记 2]]></title>
            <link>https://medium.com/@lacklock/%E7%A8%8B%E5%BA%8F%E5%91%98%E7%9A%84%E8%8B%B1%E8%AF%AD%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-2-5b6c277c359a?source=rss-537ba6514bf4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b6c277c359a</guid>
            <dc:creator><![CDATA[zhuo]]></dc:creator>
            <pubDate>Sun, 12 Aug 2018 15:10:05 GMT</pubDate>
            <atom:updated>2018-08-12T15:10:05.571Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<blockquote>Facebook keeps adding new features. Some are useful, but some are annoying or may <strong>diminish</strong> your privacy.</blockquote><p>中文句意：Facebook 不断添加新特性。一些很有用，但是一些则很烦人或者可能减少你的隐私。<br> diminish 有两个意思，一种表示对人的贬低；一种表示减少、变少。</p><blockquote>Facebook “collects all the data, divide it to categories, make it anonymous, and sells it to advertisers in bucket of metadata”</blockquote><p>中文句意：Facebook “收集所有的数据，进行分类，进行匿名处理，然后把这些元数据卖给广告商”。</p><blockquote>Facebook <strong>claims</strong> that it is <strong>committed</strong> to protecting user privacy, but some argue that the company doesn’t care about your privacy.</blockquote><p>中文句意：Facebook 声明他们致力于保护用户的隐私，但是一些人认为公司完全不在意用户隐私。</p><h4>claim 有三个常见意思。</h4><h4>1.声称，断言，主张</h4><p>这里的例句就是声称的意思。<br> 例句：The girls claim to have seen the fairies. <br> 这些女孩声称看到了仙女。</p><h4>2.索要，索赔</h4><p>这个使用的场景比较少，常见的就是要退钱，或者要保险的钱。<br> 例句：You can claim on the insurance if you have an accident while on holiday. <br> 如果度假期间遭遇事故，可向保险公司索赔。</p><h4>3.对..宣示所有权，认领</h4><p>和前面的声称略微不同，这里的对象是物品。<br> 例句：Lost property can be claimed between 10 a.m. and 4 p.m. <br> 请于上午10点至下午4点认领失物。<br> Surely they have a rightful claim on their father’s land? <br> 他们当然有权要求得到父亲的土地吧？</p><h4>committed 也是一个常见的词。</h4><p>committed 有两个意思。一个是形容词，一种则是动词 commit 的过去式。</p><h4>1.adj，坚定的，尽心尽力的。这里的例句里就是这个意思，考虑到语境的关系，所以很多时候翻译成“致力于”。其实就是尽全力做某事的意思。</h4><p>例句：The party has a core of committed supporters.<br> 该党派有一批坚定的支持者。</p><h4>2.作为动词 commit 则有很多含义。</h4><p>A.最常见的就是做（坏事）、犯罪。这个时候经常和 crime 一起出现。<br> 例：Women commit fewer crimes than men. <br> 女性犯罪比男性少。<br> 自杀也专门用 commit 表示：commit suicide。<br> B.另外一个比较常见的意思是交出某些资源。猜测是因为这个释义引申出了代码的提交的时候用 commit 表示，也是提交资源（提交代码给服务器）<br> 例：They called on Western nations to commit more money to the poorest nations. <br> 他们号召西方国家为最贫困国家拨更多的款。<br> C.承诺，表态，致力于（长期的关系）<br> 例：I would advise people to think very carefully about committing themselves to working Sundays. <br> 我会建议人们认真考虑答应周日工作。<br> Don’t commit your promises to paper if you are not certain you keep them. <br> 如果你没有把握兑现你的许诺，你就不要做出书面保证。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b6c277c359a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[程序员的英语学习笔记 1]]></title>
            <link>https://medium.com/@lacklock/%E7%A8%8B%E5%BA%8F%E5%91%98%E7%9A%84%E8%8B%B1%E8%AF%AD%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-1-737fe07fa34f?source=rss-537ba6514bf4------2</link>
            <guid isPermaLink="false">https://medium.com/p/737fe07fa34f</guid>
            <dc:creator><![CDATA[zhuo]]></dc:creator>
            <pubDate>Sun, 05 Aug 2018 14:50:06 GMT</pubDate>
            <atom:updated>2018-08-05T14:50:06.280Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>记录一下我在看《程序员的英语》中觉得值得学习的例句。</p><blockquote>Generally, <strong>adware</strong> is annoying but not really <strong>malware</strong>.</blockquote><p>中文句意：一般来说，广告软件虽然会很烦人，但是不能算是恶意软件。<br> 这里面主要有两个一开始是缩写后来成为习惯后的单词：adware 和 malware。我们都知道软件是叫 software。<br> 广告有两个常见的单词 advertising（advertise 是动词，打广告，做广告） 和 advertisement。advertising 是指广告业，advertisement 则是指具体的广告。adware 是 advertising-supported software 的简写。<br> malware 则是 malicious software 的简写。malicious 意思是恶意的，蓄意的做一些坏事：<em>intended to harm people or their reputation, or cause them embarrassment and upset</em> 。<br> 一个特别的建议：<strong>英语单词的学习的时候可以看一下英英的解释</strong>。道理很简单，中文博大精深，如果单看中文的意思可能会不够准确。比如上文提到广告的两个词，都是广告的意思。如果不看英文的解释你就会分不清两个区别。比如我们说它是一个广告公司，这里的广告应该用 advertising。我们说这 banner 的广告设计的真丑，这里就应该用 advertisement。但是如果你单纯的查单词的中文意思，这两个词都是广告，你可能就会理解偏差。</p><blockquote>Superfish used fake, self-signed root certificate to <strong>hijack</strong> HTTPS traffic and <strong>inject</strong> its own ads onto websites.</blockquote><p>中文句意：Superfish 使用假的、自签名根证书拦截 https 通信，然后将自己的广告植入到网站中。<br> Superfish 是联想的一个耻辱，几年前联想的笔记本上预装了一个自动拦截 https 请求插入广告的软件（现在国内运营商其实也是这么操作的，只是拦截的是 http 明文请求），结果有了一个可以利用的漏洞，等于笔记本上所有的 https 请求都暴露了。这是一个背景。<br> 所以说 Superfish 是一个典型的中间人攻击了，这个术语叫做 man in the middle attack。如果有人不知道什么是中间人攻击可以自己去查一下。<br> hijack 常见的意思是抢劫，劫持。如果说恐怖分子劫机，就可以用 hijack：<em>The airliner was hijacked by a group of terrorists</em>。这里用 hijack 形容劫持了网络也是挺形象的。<br> inject 应该比较熟悉了，常见的意思就是打针的注射💉，也可以理解成注入。</p><blockquote>Superfish is designed to <strong>intercept</strong> all <strong>encrypted</strong> connections, things it shouldn’t be able to see.</blockquote><p>中文句意：Superfish 被设计为可以拦截所有的加密连接，这些本来它不应该可以看到的东西。<br> intercept 就是拦截的意思，比如说警察拦截犯罪分子，就是一个典型的 intercept。<br> encrypt 就是加密的意思，名词是 encryption。与之对应的解密是 decrypt 。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=737fe07fa34f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>