<?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>DizzyLand</title><link>https://ka1hung.github.io/blog/</link><description>Recent content on DizzyLand</description><generator>Hugo -- 0.137.1</generator><language>en-us</language><lastBuildDate>Thu, 09 Jan 2025 09:09:39 +0800</lastBuildDate><atom:link href="https://ka1hung.github.io/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>Understanding Locks and Synchronization Mechanisms in Golang's sync Package</title><link>https://ka1hung.github.io/blog/posts/go-concurrency-locks/</link><pubDate>Thu, 09 Jan 2025 09:09:39 +0800</pubDate><guid>https://ka1hung.github.io/blog/posts/go-concurrency-locks/</guid><description>&lt;p>In Golang&amp;rsquo;s standard library &lt;code>sync&lt;/code>, &lt;code>sync.Mutex&lt;/code> is a basic mutual exclusion lock used to protect shared resources and prevent multiple goroutines from simultaneously accessing or modifying data. The &lt;code>sync&lt;/code> package provides several types of locks and synchronization mechanisms. Here&amp;rsquo;s a comprehensive overview of the main lock types and their differences:&lt;/p>
&lt;h2 id="1-syncmutex-mutual-exclusion-lock">1. sync.Mutex (Mutual Exclusion Lock)&lt;/h2>
&lt;p>&lt;code>sync.Mutex&lt;/code> is the most basic lock type used to protect critical sections, ensuring only one goroutine can enter the locked area.&lt;/p></description></item><item><title>Kagi: The Search Engine That Actually Respects Your Brain (and Privacy!)</title><link>https://ka1hung.github.io/blog/posts/kagi/</link><pubDate>Wed, 08 Jan 2025 13:40:24 +0800</pubDate><guid>https://ka1hung.github.io/blog/posts/kagi/</guid><description>&lt;h2 id="beyond-the-basic-search-why-kagi-is-your-new-best-friend">Beyond the Basic Search: Why Kagi is Your New Best Friend&lt;/h2>
&lt;p>Hey there, internet explorers! Tired of drowning in ads and sponsored content every time you search for something? Let me introduce you to Kagi - the search engine that treats you like a human, not a walking wallet.&lt;/p>
&lt;h3 id="-what-makes-kagi-special">🎯 What Makes Kagi Special?&lt;/h3>
&lt;h4 id="no-more-ad-maze">No More Ad Maze&lt;/h4>
&lt;p>Remember the last time you searched for a recipe and had to scroll past three screens of ads? Yeah, Kagi doesn&amp;rsquo;t do that. Zero ads. Nada. Just pure, delicious search results.&lt;/p></description></item><item><title>Ultimate Guide to Chocolatey</title><link>https://ka1hung.github.io/blog/posts/ultimate-guide-to-chocolatey/</link><pubDate>Tue, 07 Jan 2025 10:52:24 +0800</pubDate><guid>https://ka1hung.github.io/blog/posts/ultimate-guide-to-chocolatey/</guid><description>&lt;h1 id="the-ultimate-guide-to-installing-chocolatey-package-manager-for-windows">The Ultimate Guide to Installing Chocolatey Package Manager for Windows&lt;/h1>
&lt;h2 id="what-is-chocolatey">What is Chocolatey?&lt;/h2>
&lt;p>Chocolatey (choco) is a powerful package manager for Windows that automates software installation, upgrading, and uninstallation. Think of it as the Windows equivalent of &lt;code>apt-get&lt;/code> for Linux or &lt;code>brew&lt;/code> for macOS.&lt;/p>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;ul>
&lt;li>Windows operating system&lt;/li>
&lt;li>Administrator privileges&lt;/li>
&lt;li>Internet connection&lt;/li>
&lt;/ul>
&lt;h2 id="installation-steps">Installation Steps&lt;/h2>
&lt;h3 id="step-1-open-powershell-as-administrator">Step 1: Open PowerShell as Administrator&lt;/h3>
&lt;ol>
&lt;li>Right-click on the Start menu&lt;/li>
&lt;li>Select &amp;ldquo;Windows PowerShell (Admin)&amp;rdquo; or &amp;ldquo;Windows Terminal (Admin)&amp;rdquo;&lt;/li>
&lt;li>Confirm the UAC prompt if it appears&lt;/li>
&lt;/ol>
&lt;h3 id="step-2-check-execution-policy">Step 2: Check Execution Policy&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-powershell" data-lang="powershell">&lt;span style="display:flex;">&lt;span>Get-ExecutionPolicy
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>If the policy isn&amp;rsquo;t set to &lt;code>RemoteSigned&lt;/code> or &lt;code>Unrestricted&lt;/code>, run:&lt;/p></description></item><item><title>Golang-sort</title><link>https://ka1hung.github.io/blog/posts/golang-sort/</link><pubDate>Mon, 06 Jan 2025 21:52:24 +0800</pubDate><guid>https://ka1hung.github.io/blog/posts/golang-sort/</guid><description>&lt;p>Looking for efficient ways to sort data in Go? This guide covers everything from basic sorting to advanced techniques!&lt;/p>
&lt;h2 id="-basic-sorting">🚀 Basic Sorting&lt;/h2>
&lt;p>The &lt;code>sort&lt;/code> package provides fundamental sorting capabilities.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-golang" data-lang="golang">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">package&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">import&lt;/span> (
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;fmt&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;sort&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">func&lt;/span> &lt;span style="color:#a6e22e">main&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//sort int
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">s1&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> []&lt;span style="color:#66d9ef">int&lt;/span>{&lt;span style="color:#ae81ff">8&lt;/span>, &lt;span style="color:#ae81ff">2&lt;/span>, &lt;span style="color:#ae81ff">6&lt;/span>, &lt;span style="color:#ae81ff">3&lt;/span>, &lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">4&lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Ints&lt;/span>(&lt;span style="color:#a6e22e">s1&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#a6e22e">s1&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//sort int reverse
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Sort&lt;/span>(&lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Reverse&lt;/span>(&lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">IntSlice&lt;/span>(&lt;span style="color:#a6e22e">s1&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#a6e22e">s1&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//sort string
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">s2&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> []&lt;span style="color:#66d9ef">string&lt;/span>{&lt;span style="color:#e6db74">&amp;#34;aaa&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;bbb&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;6&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;3&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;1&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;4&amp;#34;&lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Strings&lt;/span>(&lt;span style="color:#a6e22e">s2&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#a6e22e">s2&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//sort string reverse
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Sort&lt;/span>(&lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Reverse&lt;/span>(&lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">StringSlice&lt;/span>(&lt;span style="color:#a6e22e">s2&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#a6e22e">s2&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//sort float64
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">s3&lt;/span> &lt;span style="color:#f92672">:=&lt;/span> []&lt;span style="color:#66d9ef">float64&lt;/span>{&lt;span style="color:#ae81ff">1&lt;/span>, &lt;span style="color:#ae81ff">1.2&lt;/span>, &lt;span style="color:#ae81ff">0&lt;/span>, &lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">1.9&lt;/span>, &lt;span style="color:#f92672">-&lt;/span>&lt;span style="color:#ae81ff">82.333&lt;/span>, &lt;span style="color:#ae81ff">99.11&lt;/span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Float64s&lt;/span>(&lt;span style="color:#a6e22e">s3&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#a6e22e">s3&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">//sort float64 reverse
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Sort&lt;/span>(&lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Reverse&lt;/span>(&lt;span style="color:#a6e22e">sort&lt;/span>.&lt;span style="color:#a6e22e">Float64Slice&lt;/span>(&lt;span style="color:#a6e22e">s3&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">fmt&lt;/span>.&lt;span style="color:#a6e22e">Println&lt;/span>(&lt;span style="color:#a6e22e">s3&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="-object-sorting">🎯 Object Sorting&lt;/h2>
&lt;p>How to sort a list of objects by specific fields:&lt;/p></description></item><item><title>Sokit - A Powerful TCP/UDP Testing Tool You Should Know</title><link>https://ka1hung.github.io/blog/posts/sokit/</link><pubDate>Thu, 21 Mar 2024 11:09:39 +0800</pubDate><guid>https://ka1hung.github.io/blog/posts/sokit/</guid><description>&lt;p>Looking for an easy-to-use TCP/UDP testing tool? Sokit is a lightweight but powerful solution that helps you test network communications with ease.&lt;/p>
&lt;h2 id="-key-features">✨ Key Features&lt;/h2>
&lt;ul>
&lt;li>TCP/UDP Server simulation (supports both string and hex formats)&lt;/li>
&lt;li>TCP/UDP Client simulation (supports both string and hex formats)&lt;/li>
&lt;li>Data forwarding/proxy capabilities&lt;/li>
&lt;li>Cross-platform support (Windows &amp;amp; Linux)&lt;/li>
&lt;li>Clean and intuitive UI&lt;/li>
&lt;/ul>
&lt;h2 id="-quick-links">🔗 Quick Links&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://github.com/sinpolib/sokit">GitHub Repository&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://mega.nz/file/1l9AzS4Q#Q-D9Slf4O52bOtmkjYawedvQR4GxyfRi0hj7svkUHR4">Download Link&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="-quick-start-guide">📖 Quick Start Guide&lt;/h2>
&lt;h3 id="basic-server-client-communication">Basic Server-Client Communication&lt;/h3>
&lt;ol>
&lt;li>Launch two instances of Sokit - one as TCP Server (left) and one as TCP Client (right)&lt;/li>
&lt;li>Configure IP addresses and ports for both instances&lt;/li>
&lt;li>Establish the connection between them&lt;/li>
&lt;/ol>
&lt;p>&lt;img alt="Server-Client Setup" loading="lazy" src="https://ka1hung.github.io/blog/blog/posts/sokit/1.png">&lt;/p></description></item><item><title>How to hide the Console window when running a Golang compiled file</title><link>https://ka1hung.github.io/blog/posts/how-to-hide-the-console-window-when-running-a-golang-compiled-file./</link><pubDate>Wed, 20 Mar 2024 10:37:55 +0800</pubDate><guid>https://ka1hung.github.io/blog/posts/how-to-hide-the-console-window-when-running-a-golang-compiled-file./</guid><description>&lt;h2 id="-ninja-ways-to-hide-console-window-in-go">🎯 Ninja Ways to Hide Console Window in Go&lt;/h2>
&lt;p>Ever wanted to make your Go applications look more professional by hiding that pesky console window? You&amp;rsquo;re in the right place! Let&amp;rsquo;s explore some ninja techniques to achieve this. 🥷&lt;/p>
&lt;h2 id="-method-1-the-quick-strike--ldflags">🚀 Method 1: The Quick Strike (-ldflags)&lt;/h2>
&lt;p>The simplest way to hide the console window is using build flags. Think of it as a stealth mode for your app!&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>go build -ldflags -H&lt;span style="color:#f92672">=&lt;/span>windowsgui main.go
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Pros:&lt;/p></description></item></channel></rss>