<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>2024 on 番茄🍅杂货铺</title>
    <link>https://blog.tomatostore.top/tags/2024/</link>
    <description>Recent content in 2024 on 番茄🍅杂货铺</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-cn</language>
    <lastBuildDate>Sun, 15 Dec 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.tomatostore.top/tags/2024/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>修复 RevenueCat 国内访问，App Store Connect 审核加速</title>
      <link>https://blog.tomatostore.top/posts/2024/12/revenuecat-connection-fix-with-proxy/</link>
      <pubDate>Sun, 15 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/12/revenuecat-connection-fix-with-proxy/</guid>
      <description>Fix connection to RevenueCat from China and expedite App Store Connect review</description>
      <content:encoded><![CDATA[<p>2024年12月突发，国内无法访问 RevenueCat 导致很多 App 无法进行正常 IAP。</p>
<blockquote>
<p>In December 2024, RevenueCat became inaccessible in China, affecting IAP functionality in many apps.</p></blockquote>
<p>官方给出了紧急修复方案：https://www.revenuecat.com/docs/getting-started/configuring-sdk#configuration-for-users-in-mainland-china</p>
<blockquote>
<p>Official emergency fix: <a href="https://www.revenuecat.com/docs/getting-started/configuring-sdk#configuration-for-users-in-mainland-china">https://www.revenuecat.com/docs/getting-started/configuring-sdk#configuration-for-users-in-mainland-china</a></p></blockquote>
<p><img loading="lazy" src="/images/revenuecat-proxy.png" alt="Configuration for users in Mainland China"  /></p>
<p>你说巧不巧，就在一周前，我的一个 iOS app 刚通过审核发布成功，就正好使用了 RevenueCat。🤣
没办法，现改实现方案移除 RC 肯定不是一时半会能搞定的，再说这个状态还不确定是不是常态。所以紧急按照官方方案提交了修改。（虽然实际上我的 app 也没啥用户，也没有收到任何消息抱怨说无法购买）。</p>
<blockquote>
<p>Coincidentally, my iOS app using RevenueCat was just approved a week ago. 🤣 Instead of removing RC, I quickly applied the official fix, though my app has few users and no complaints yet.</p></blockquote>
<p>修改后测试效果是可以去到产品信息了（我没有 RC 的 paywall，只是定义了产品），然后按照之前学习过的 App Store Connect 加急审核的步骤走了一遍，没想到的是，加急申请之后，仅仅3分钟就审核通过了🫨。这里给水果审核点个赞，然后再分享加速审核流程。</p>
<blockquote>
<p>After the fix, product info was accessible again. I requested an expedited review, and surprisingly, it was approved in just 3 minutes! 🫨 Here&rsquo;s how to request expedited review:</p></blockquote>
<ol>
<li>登录 <a href="https://developer.apple.com/">https://developer.apple.com/</a> 后，找到页面下方的 Contact Us。</li>
</ol>
<blockquote>
<p>Go to <a href="https://developer.apple.com/">https://developer.apple.com/</a> and find &ldquo;Contact Us&rdquo; at the bottom.</p></blockquote>
<p><img loading="lazy" src="/images/apple-contact-us.png" alt="contact us"  /></p>
<ol start="2">
<li>选择 <strong>App 审核</strong> -&gt; <strong>App 审核加快请求</strong></li>
</ol>
<blockquote>
<p>Choose <strong>App Review</strong> -&gt; <strong>Request Expedited Review</strong></p></blockquote>
<p><img loading="lazy" src="/images/apple-app-review.png" alt="App review"  /></p>
<ol start="3">
<li>点击 <strong>联系 App Review</strong>，在 <strong>App Information</strong>中选择对应的 App 即可。</li>
</ol>
<blockquote>
<p>Click <strong>Contact App Review</strong> and select your app.</p></blockquote>
<p><img loading="lazy" src="/images/apple-app-info.png" alt="app info"  /></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>HowTo: make links between Apple notes</title>
      <link>https://blog.tomatostore.top/posts/2024/11/hyperlink-between-apple-notes/</link>
      <pubDate>Sun, 24 Nov 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/11/hyperlink-between-apple-notes/</guid>
      <description>如何在苹果🍎的备忘录间链接跳转</description>
      <content:encoded><![CDATA[<h2 id="how-to-add-a-link-to-other-note">How to add a link to other note</h2>
<h3 id="1-typing-">1. Typing &ldquo;&raquo;&rdquo;</h3>
<p>Type &ldquo;&raquo;&rdquo; in the body of your note, enter the title of the note that you want to link to, and select it from the list. It works both on iOS and macOS.
<img loading="lazy" src="/images/typeing-add-link-in-notes.png" alt="typing &raquo;"  /></p>
<h3 id="2-menu">2. Menu</h3>
<p>On iOS, long press to open the options menu. Swipe left the menu to find <code>Add Link</code>.

  <img loading="lazy" src="https://cdsassets.apple.com/live/7WUAS350/images/ios/ios-18-iphone-16-pro-notes-formatting-add-link-callout.png" alt="Add link on iOS"  /></p>
<p>On macOS, right click in a note and choose <code>Add link</code> in the options menu.
<img loading="lazy" src="/images/notes-option-menu-macos.png" alt="options menu on macOS"  /></p>
<h2 id="how-to-navigate-back-to-previous-note">How to navigate back to previous note</h2>
<p>Now we have a link to another note, it will jump to the linked note when clicking the link.
Then, how can we go back to the previous note?</p>
<p>On iOS, click <code>...</code> to open menu, select <code>Recent Notes</code>.
<img loading="lazy" src="/images/navigation-back-in-notes-ios.jpeg" alt="recent notes on iOS"  /></p>
<p>On macOS, open <code>View</code> menu to select <code>Previous Note</code>.
<img loading="lazy" src="/images/navigate-back-in-notes-macos.png" alt="navigate between notes on macOS"  /></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Ask ChatGPT/Cursor: Preprocessor Macro Doesn&#39;t Work in Swift</title>
      <link>https://blog.tomatostore.top/posts/2024/10/preprocessor-macro-in-swift/</link>
      <pubDate>Tue, 08 Oct 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/10/preprocessor-macro-in-swift/</guid>
      <description>Xcode 中如何定义 Swift 适用的预处理宏</description>
      <content:encoded><![CDATA[<h2 id="the-problem">The Problem</h2>
<p>I defined the preprocessor macro <code>USING_REVENUE_CAT=1</code> in my project target&rsquo;s Build Settings under <strong>Preprocessor Macros</strong>.</p>
<p>However, when I tried to use it in my <code>Swift</code> file with the following code, I received an error indicating that the module <code>SwiftyStoreKit</code> could not be found. This was puzzling because I expected the macro to work similarly to how it does in <code>Objective-C</code>.</p>
<p><img loading="lazy" src="/images/Preprocessor-Macros.png" alt="Preprocessor-Macros in Xcode"  /></p>
<h2 id="the-solution">The Solution</h2>
<p>Asked both <code>ChatGPT</code> and <code>Cursor</code> for help, and they gave me similar answers as following:</p>
<p><code>Swift</code> does not recognize preprocessor macros defined in the Build Settings the same way <code>Objective-C</code> does. Instead, you need to define custom flags specifically for <code>Swift</code>.</p>
<h3 id="steps-to-define-a-preprocessor-macro-for-swift">Steps to Define a Preprocessor Macro for Swift</h3>
<ol>
<li>
<p><strong>Navigate to Build Settings:</strong>
Open your project in Xcode and select your target. Then, go to the <strong>Build Settings</strong> tab.</p>
</li>
<li>
<p><strong>Find Swift Compiler - Custom Flags:</strong>
Scroll down to the <strong>Swift Compiler - Custom Flags</strong> section.</p>
</li>
<li>
<p><strong>Add the Custom Flag:</strong>
In the <strong>Other Swift Flags</strong> field, add the following:</p>
<pre tabindex="0"><code>USING_REVENUE_CAT
</code></pre></li>
</ol>
<p>This tells the <code>Swift</code> compiler to define the <code>USING_REVENUE_CAT</code> flag, allowing you to use it in your <code>Swift</code> code.</p>
<h3 id="updated-swift-code">Updated Swift Code</h3>
<p>After adding the custom flag, your <code>Swift</code> code should work as intended:</p>
<p><img loading="lazy" src="/images/Swift-Compiler_Customer-Flags.png" alt="Swift-Compiler_Customer-Flags"  /></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>解决 Xcode 15.4 在 macOS 14.5 上开发 Adobe Illustrator Plugin 时 Python 命令未找到问题</title>
      <link>https://blog.tomatostore.top/posts/2024/09/python/</link>
      <pubDate>Sun, 01 Sep 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/09/python/</guid>
      <description>Solving the Python Command Not Found Issue When Developing Adobe Illustrator Plugin with Xcode 15.4 on macOS 14.5</description>
      <content:encoded><![CDATA[<h2 id="一问题描述">一、问题描述</h2>
<p>在使用 Xcode 15.4 在 macOS 14.5 上尝试开发 Adobe Illustrator Plugin 时，在编译 Adobe Illustrator 2023 SDK 的 sample 过程中出现错误：</p>
<pre tabindex="0"><code>/Users/aidy/Workspace/Adobe Illustrator 2023 SDK/samplecode/StrokeFilter/build/StrokeFilter.build/Default/StrokeFilter.build/Script-FDD9160721AC093D0018B958.sh: line 2: python: command not found
Command PhaseScriptExecution failed with a nonzero exit code
</code></pre><p>查看 <code>Script-FDD9160721AC093D0018B958.sh</code> 文件内容为：</p>
<pre tabindex="0"><code>#!/bin/sh
python ../../tools/pipl/create_pipl.py -input &#39;[{&#34;name&#34;:&#34;StrokeFilter&#34;,&#34;entry_point&#34; : &#34;PluginMain&#34;}]&#39;
</code></pre><h2 id="二尝试过程">二、尝试过程</h2>
<p>首先怀疑是没有安装 <code>xcode command line tool</code>，但确认已经安装过了。
接着考虑可能是没有安装 <code>Python</code>。通过 <code>brew install python</code> 安装了 <code>Python3</code>，但 <code>Xcode</code> 中仍然提示<code>python: command not found</code>。
从 <code>Adobe Community</code> 搜索得知这里需要 <code>Python2</code>，于是使用 <code>pyenv</code> 安装了 <code>Python2</code>，并设置 <code>pyenv global 2.7.18</code>。在 <code>Terminal</code> 中执行 <code>python -V</code> 输出是 <code>Python 2.7.18</code>，然而 <code>Xcode build</code> 依旧报错。
尝试了 <code>sudo ln /Users/&lt;user&gt;/.pyenv/shims/python /Library/Developer/CommandLineTools/usr/bin/python</code>，但没有作用。</p>
<h2 id="三最终解决办法">三、最终解决办法</h2>
<p>通过 <code>sudo ln /Users/&lt;user&gt;/.pyenv/shims/python /usr/local/bin/python</code> 设置 <code>/usr/local/bin</code> 的 <code>link</code>，解决了问题。</p>
]]></content:encoded>
    </item>
    
    <item>
      <title>[Linux] Share environment variables with root user</title>
      <link>https://blog.tomatostore.top/posts/2024/07/share-env-when-running-cmd-with-sudo/</link>
      <pubDate>Thu, 25 Jul 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/07/share-env-when-running-cmd-with-sudo/</guid>
      <description>Keep current user&amp;#39;s env variables when running sudo command</description>
      <content:encoded><![CDATA[<h2 id="linux-share-environment-variables-with-root-user">[Linux] Share environment variables with root user</h2>
<h4 id="problem">Problem</h4>
<p>There are some environment variabels (e.g. <code>http_proxy</code>) set for current user on Ubuntu 20.4, but when running some commands with <code>sudo</code> (like <code>sudo apt update</code>), those environment variables are not available anymore.</p>
<h4 id="solution">Solution</h4>
<ol>
<li><code>sudo -E</code></li>
</ol>
<p>If you are running commands manually, it&rsquo;s possible to preserve evn setting by adding <code>-E</code> option.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo -E apt update
</span></span></code></pre></td></tr></table>
</div>
</div><ol start="2">
<li><code>sudo visudo</code></li>
</ol>
<p>Using option <code>-E</code> may not work in the cases that the commands with <code>sudo</code> are run in script.
To make the specific environment settings shared with <code>sudo</code>, it can be configured with <code>visudo</code>.</p>
<p>Using following command:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo visudo
</span></span></code></pre></td></tr></table>
</div>
</div><p>In opened nano editor, find the line begins with <code>Defaults        env_keep</code>, modify it as following to make <code>http_proxy</code> and <code>https_proxy</code> settings be keeped when running commands using <code>sudo</code>:</p>
<pre tabindex="0"><code>Defaults        env_keep += &#34;https_proxy http_proxy&#34;
</code></pre><p>Then, when running <code>sudo apt update</code>, those proxy env variables will kept.</p>
]]></content:encoded>
    </item>
    
    <item>
      <title>How to enable AddressSanitizer(ASan) for C&#43;&#43; Project</title>
      <link>https://blog.tomatostore.top/posts/2024/05/how-to-enable-asan-in-cpp-project/</link>
      <pubDate>Fri, 24 May 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/05/how-to-enable-asan-in-cpp-project/</guid>
      <description>The tool to detect runtime memory leak</description>
      <content:encoded><![CDATA[<p>To integrate AddressSanitizer(ASan) to an existing project, just add the compile option <code>-fsanitize=address</code> and generate debug infor with <code>-g</code> in <code>CMakeLists.txt</code>.</p>
<pre tabindex="0"><code>option(ENABLE_ASAN &#34;enable AddressSanitizer&#34; OFF)

if(ENABLE_ASAN)
    set(CMAKE_CXX_FLAGS &#34;${CMAKE_CXX_FLAGS} -fsanitize=address&#34;)
    set(CMAKE_CXX_FLAGS &#34;-O -g&#34;)
    set(CMAKE_C_FLAGS &#34;-O -g&#34;)
endif()
</code></pre><p>Compile the project:</p>
<pre tabindex="0"><code>mkdir build
cd build
cmake -DENABLE_ASAN=ON ..
cmake --build .
</code></pre><p>After the build, using following command to start the program:</p>
<pre tabindex="0"><code>ASAN_OPTIONS=detect_leaks=1 ./a.out
</code></pre><p>It will print detail info when memory leak occurs.</p>
<pre tabindex="0"><code>=================================================================
==12345==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f3d8b4fbb90 in __interceptor_new (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde90)
    #1 0x4006d6 in createLeak /path/to/your/project/main.cpp:4
    #2 0x4006f8 in main /path/to/your/project/main.cpp:9
    #3 0x7f3d8b0d283f in __libc_start_main (/lib64/libc.so.6+0x2383f)

SUMMARY: AddressSanitizer: 40 byte(s) leaked in 1 allocation(s).
</code></pre>]]></content:encoded>
    </item>
    
    <item>
      <title>Install docker in Ubuntu 20 and config network proxy</title>
      <link>https://blog.tomatostore.top/posts/2024/05/install-docker-on-ubuntu-20/</link>
      <pubDate>Tue, 21 May 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/05/install-docker-on-ubuntu-20/</guid>
      <description>在Ubuntu 20中安装 Docker、配置网络代理</description>
      <content:encoded><![CDATA[<h2 id="steps-to-install-docker-on-ubuntu-20">steps to install docker on Ubuntu 20</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo apt-get update
</span></span><span class="line"><span class="cl">sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
</span></span><span class="line"><span class="cl">curl -fsSL https://download.docker.com/linux/ubuntu/gpg <span class="p">|</span> sudo apt-key add -
</span></span><span class="line"><span class="cl">sudo add-apt-repository <span class="s2">&#34;deb [arch=amd64] https://download.docker.com/linux/ubuntu </span><span class="k">$(</span>lsb_release -cs<span class="k">)</span><span class="s2"> stable&#34;</span>
</span></span><span class="line"><span class="cl">sudo apt-get update
</span></span><span class="line"><span class="cl">sudo apt-get install docker-ce
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="verify-the-installation">verify the installation</h2>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo systemctl status docker
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="add-current-user-to-docker-group">add current user to docker group</h2>
<ul>
<li>in order to avoid adding <code>sudo</code> when running docker command</li>
</ul>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo usermod -aG docker <span class="si">${</span><span class="nv">USER</span><span class="si">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="network-proxy-settings">Network proxy settings</h2>
<h3 id="dockerd-proxy">Dockerd Proxy</h3>
<p>To configure the proxy for <code>dockerd</code>, which is managed by <code>systemd</code>, create and edit a configuration file:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo mkdir -p /etc/systemd/system/docker.service.d
</span></span><span class="line"><span class="cl">sudo touch /etc/systemd/system/docker.service.d/proxy.conf
</span></span></code></pre></td></tr></table>
</div>
</div><p>Add the following to <code>proxy.conf</code>:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-ini" data-lang="ini"><span class="line"><span class="cl"><span class="k">[Service]</span>
</span></span><span class="line"><span class="cl"><span class="na">Environment</span><span class="o">=</span><span class="s">&#34;HTTP_PROXY=http://proxy.example.com:8080/&#34;</span>
</span></span><span class="line"><span class="cl"><span class="na">Environment</span><span class="o">=</span><span class="s">&#34;HTTPS_PROXY=http://proxy.example.com:8080/&#34;</span>
</span></span><span class="line"><span class="cl"><span class="na">Environment</span><span class="o">=</span><span class="s">&#34;NO_PROXY=localhost,127.0.0.1,.example.com&#34;</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>Replace <code>proxy.example.com:8080</code> with your proxy address.</p>
<h3 id="container-proxy">Container Proxy</h3>
<p>To configure proxy settings for containers, edit <code>~/.docker/config.json</code>:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span><span class="lnt">8
</span><span class="lnt">9
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;proxies&#34;</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">   <span class="nt">&#34;default&#34;</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">     <span class="nt">&#34;httpProxy&#34;</span><span class="p">:</span> <span class="s2">&#34;http://proxy.example.com:8080&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">     <span class="nt">&#34;httpsProxy&#34;</span><span class="p">:</span> <span class="s2">&#34;http://proxy.example.com:8080&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">     <span class="nt">&#34;noProxy&#34;</span><span class="p">:</span> <span class="s2">&#34;localhost,127.0.0.1,.example.com&#34;</span>
</span></span><span class="line"><span class="cl">   <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>For container runtime proxies, use the <code>-e</code> option to set environment variables.</p>
<h3 id="docker-build-proxy">Docker Build Proxy</h3>
<p>For <code>docker build</code>, inject proxy settings using <code>--build-arg</code>:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">docker build . <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>    --build-arg <span class="s2">&#34;HTTP_PROXY=http://proxy.example.com:8080/&#34;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>    --build-arg <span class="s2">&#34;HTTPS_PROXY=http://proxy.example.com:8080/&#34;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>    --build-arg <span class="s2">&#34;NO_PROXY=localhost,127.0.0.1,.example.com&#34;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>    -t your/image:tag
</span></span></code></pre></td></tr></table>
</div>
</div><h3 id="applying-changes">Applying Changes</h3>
<p>To apply the changes:</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl daemon-reload
</span></span><span class="line"><span class="cl">sudo systemctl restart docker
</span></span></code></pre></td></tr></table>
</div>
</div><h2 id="trouble-shooting">Trouble shooting</h2>
<h3 id="when-running-command-sudo-apt-update-it-has-following-error">when running command <code>sudo apt update</code>, it has following error</h3>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span><span class="lnt">8
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">Err:5 https://download.docker.com/linux/ubuntu focal Release                                            
</span></span><span class="line"><span class="cl">  Could not handshake: The TLS connection was non-properly terminated. <span class="o">[</span>IP: &lt;xx.xxx.xx.xxx&gt; 3128<span class="o">]</span>
</span></span><span class="line"><span class="cl">Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease                                        
</span></span><span class="line"><span class="cl">Hit:7 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
</span></span><span class="line"><span class="cl">Reading package lists... Done
</span></span><span class="line"><span class="cl">E: The repository <span class="s1">&#39;https://download.docker.com/linux/ubuntu focal Release&#39;</span> does not have a Release file.
</span></span><span class="line"><span class="cl">N: Updating from such a repository can<span class="err">&#39;</span>t be <span class="k">done</span> securely, and is therefore disabled by default.
</span></span><span class="line"><span class="cl">N: See apt-secure<span class="o">(</span>8<span class="o">)</span> manpage <span class="k">for</span> repository creation and user configuration details.
</span></span></code></pre></td></tr></table>
</div>
</div><h4 id="solution">Solution</h4>
<p>According to <a href="https://askubuntu.com/a/1289675/1578724">this answer</a>, modify <code>/etc/apt/apt.config</code> to make sure the proxy settings are correct, especially the <code>https</code> settings.</p>
<ul>
<li><strong>Wrong config:</strong></li>
</ul>
<pre tabindex="0"><code>Acquire::http::proxy &#34;http://proxy.mydom.it:8080&#34;;
Acquire::https::proxy &#34;https://proxy.mydom.it:8080&#34;;
</code></pre><ul>
<li><strong>Good config:</strong></li>
</ul>
<pre tabindex="0"><code>Acquire::http::proxy &#34;http://proxy.mydom.it:8080&#34;;
Acquire::https::proxy &#34;http://proxy.mydom.it:8080&#34;;
</code></pre>]]></content:encoded>
    </item>
    
    <item>
      <title>VSCode: 正则搜索匹配多行多个关键字</title>
      <link>https://blog.tomatostore.top/posts/2024/05/vscode-regexp-match-multiple-words-in-diff-lines/</link>
      <pubDate>Tue, 07 May 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/05/vscode-regexp-match-multiple-words-in-diff-lines/</guid>
      <description>Match two words in diff lines in VSCode</description>
      <content:encoded><![CDATA[<p>场景：<code>QML</code> 项目中搜索 <code>Button</code> 控件并使用了 <code>background</code> 属性的代码。</p>
<p>正则表达式写法： <code>Button.*(?:\n.*(?:\n.*)){0,10}.*background</code></p>
<p>匹配效果：</p>
<p><img loading="lazy" src="/images/vscode-regexp-match-multiple-words-in-diff-lines.png" alt="vscode-regexp-match-multiple-words-in-diff-lines"  /></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>DP接口无法连接显示器的解决办法</title>
      <link>https://blog.tomatostore.top/posts/2024/03/cannot-connect-display-via-dp-channel/</link>
      <pubDate>Fri, 08 Mar 2024 00:00:00 +0000</pubDate>
      
      <guid>https://blog.tomatostore.top/posts/2024/03/cannot-connect-display-via-dp-channel/</guid>
      <description>Cannot connect to display via DP channel</description>
      <content:encoded><![CDATA[<p>AOC的显示器之前一直可以用miniDP转DP的线连接MacBookPro，突然有一天就连不上了。
尝试了重现插拔、重启电脑、关闭/打开显示器，都不行。所以怀疑是线的问题，买了一根新的线，结果还是不行。尝试了HDMI线连接是没问题的。</p>
<p>在准备联系显示器维修之前发现了这个网页 <a href="https://zhuanlan.zhihu.com/p/466826180">https://zhuanlan.zhihu.com/p/466826180</a>，没想到的是在<strong>拔掉显示器电源线再插回去</strong>之后，竟然就好了。。。</p>
<p>My AOC monitor, which used to connect to my MacBook Pro with a miniDP-to-DP cable, suddenly stopped working one day.</p>
<p>I tried re-plugging the cable, restarting my computer, and turning the monitor off and on, but nothing worked. So I suspected it might be the cable&rsquo;s fault and bought a new one, but it still didn&rsquo;t work. I tried connecting with an HDMI cable and it worked fine.</p>
<p>Before I was about to contact the monitor repair service, I found this webpage: <a href="https://zhuanlan.zhihu.com/p/466826180">https://zhuanlan.zhihu.com/p/466826180</a>. Surprisingly, after <strong>unplugging the monitor&rsquo;s power cord and plugging it back in</strong>, it worked again&hellip;</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
