<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Semonan Book</title><link>https://semonan.com/en/</link><description>Recent content on Semonan Book</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Wed, 06 May 2026 00:00:00 +0900</lastBuildDate><atom:link href="https://semonan.com/en/rss.xml" rel="self" type="application/rss+xml"/><item><title>History of LED</title><link>https://semonan.com/en/book/technology-history/elec/led/</link><pubDate>Sun, 04 Jan 2026 00:00:00 +0900</pubDate><guid>https://semonan.com/en/book/technology-history/elec/led/</guid><description>&lt;h1 id="history-of-led-light-emitting-diode"&gt;History of LED (Light Emitting Diode)&lt;a class="anchor" href="#history-of-led-light-emitting-diode"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;LEDs are used everywhere in the world today — for lighting, displays, and signaling.&lt;br&gt;
Let&amp;rsquo;s take a look at how the LED was born, refined, and developed.&lt;br&gt;
&lt;img src="https://semonan.com/images/book/technology-history/elec/led/img1.png" alt="" height="200"&gt;&lt;/p&gt;
&lt;h2 id="1907--wait-it-just-glowed-what-was-that"&gt;1907 — &amp;ldquo;Wait&amp;hellip; it just glowed. What was that?&amp;rdquo;&lt;a class="anchor" href="#1907--wait-it-just-glowed-what-was-that"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;1907, in a laboratory in England.&lt;br&gt;
Henry Joseph Round, a radio communication engineer, noticed a strange phenomenon when he passed an electric current through a silicon carbide (SiC) crystal.&lt;br&gt;
&amp;ldquo;Whoa! It&amp;rsquo;s giving off light at the contact point!&amp;rdquo;&lt;br&gt;
Round reported the phenomenon in the journal &lt;em&gt;Electrical World&lt;/em&gt;.&lt;br&gt;
But at the time, no one imagined that this faint glow would one day replace the lighting of the world.&lt;br&gt;
The light was simply too weak to seem useful.&lt;br&gt;
And so the seed of the LED was quietly buried.&lt;br&gt;
&lt;img src="https://semonan.com/images/book/technology-history/elec/led/img2.jpg" alt="" height="250"&gt;&lt;/p&gt;</description></item><item><title>Born With Effort</title><link>https://semonan.com/en/book/thoughts/quotes/born-with-effort/</link><pubDate>Thu, 03 Jul 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/thoughts/quotes/born-with-effort/</guid><description>&lt;h1 id="not-talent--you-have-to-be-born-with-effort"&gt;&amp;ldquo;Not Talent — You Have to Be Born With Effort&amp;rdquo;&lt;a class="anchor" href="#not-talent--you-have-to-be-born-with-effort"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;People who put in the effort might be a little behind right now, but in the end they succeed.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s one thing I can take pride in.&lt;/p&gt;
&lt;p&gt;Whatever sport I had done, I would have been number one.&lt;/p&gt;
&lt;p&gt;Because what I was born with is effort.&lt;/p&gt;
&lt;p&gt;How many times do you think I lost while doing judo?&lt;/p&gt;
&lt;p&gt;I lost more times than I can count.&lt;/p&gt;</description></item><item><title>SAMYANG AF 35mm F1.4 FE</title><link>https://semonan.com/en/book/product-reviews/electronics/samyang-af-35mm-f1.4/</link><pubDate>Thu, 03 Jul 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/product-reviews/electronics/samyang-af-35mm-f1.4/</guid><description>&lt;h1 id="samyang-af-35mm-f14-fe-prime-lens-review"&gt;SAMYANG AF 35mm F1.4 FE Prime Lens Review&lt;a class="anchor" href="#samyang-af-35mm-f14-fe-prime-lens-review"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;(This is a usage review for video shooting; the camera body is a Sony A7C.)&lt;/p&gt;
&lt;img src="https://semonan.com/images/book/product-reviews/electronics/samyang-af-35mm-f1.4/samyang35mm_1.webp" alt="SAMYANG AF 35mm F1.4 FE lens" width="500"&gt;
&lt;h2 id="what-am-i-shooting"&gt;What Am I Shooting?&lt;a class="anchor" href="#what-am-i-shooting"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I needed to film close-up shots of assembling and soldering small electronic components.
The camera is fixed on a tripod while I work with my hands in front of it.
In other words, the distance between camera and subject stays almost constant.&lt;/p&gt;</description></item><item><title>Light control</title><link>https://semonan.com/en/book/embedded/smart-home/light-control/</link><pubDate>Tue, 06 May 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/embedded/smart-home/light-control/</guid><description>&lt;h1 id="smart-home-development---light-control"&gt;Smart Home Development - Light Control&lt;a class="anchor" href="#smart-home-development---light-control"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;I have decided to create my own smart home system that lets you turn lights on and off with your phone.&lt;br&gt;
This system would offer a variety of convenient features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Turning lights on and off from bed with your phone&lt;/li&gt;
&lt;li&gt;Turning off lights remotely when you forget and leave them on while going out&lt;/li&gt;
&lt;li&gt;Automatically turning off all lights at midnight&lt;/li&gt;
&lt;li&gt;Automatically turning on lights at 7am&lt;/li&gt;
&lt;li&gt;Automatically turning on lights when you enter the house after being out&lt;/li&gt;
&lt;li&gt;Automatically turning off lights when the house is empty&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Just imagining it sounds incredibly convenient.&lt;/p&gt;</description></item><item><title>My first Manual Espresso Maker</title><link>https://semonan.com/en/book/food/coffee/manual-espresso-maker/</link><pubDate>Tue, 06 May 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/food/coffee/manual-espresso-maker/</guid><description>&lt;h2 id="the-background-of-purchasing-a-manual-espresso-maker"&gt;The Background of Purchasing a Manual Espresso Maker&lt;a class="anchor" href="#the-background-of-purchasing-a-manual-espresso-maker"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;(Written on May 6, 2025)&lt;/p&gt;
&lt;p&gt;I own a capsule coffee machine that I bought around three years ago.&lt;br&gt;
I remember it cost about $100 at the time, which seemed quite reasonable,&lt;br&gt;
so I&amp;rsquo;ve been quite satisfied with its value for money.&lt;/p&gt;
&lt;p&gt;However, at some point, the capsule coffee machine started acting up.&lt;br&gt;
When I try to make coffee, it works for about three seconds and then stops.&lt;br&gt;
It seems to be broken.&lt;br&gt;
I guess it&amp;rsquo;s time since I&amp;rsquo;ve probably used it to make over 500 capsules.&lt;/p&gt;</description></item><item><title>Vacuum cleaner static prevention</title><link>https://semonan.com/en/book/life-engineering/appliance/vacuum-cleaner-static-prevention/</link><pubDate>Mon, 03 Mar 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/life-engineering/appliance/vacuum-cleaner-static-prevention/</guid><description>&lt;h1 id="how-to-prevent-static-electricity-when-using-a-vacuum-cleaner-in-dry-winter"&gt;How to Prevent Static Electricity When Using a Vacuum Cleaner in Dry Winter&lt;a class="anchor" href="#how-to-prevent-static-electricity-when-using-a-vacuum-cleaner-in-dry-winter"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This explains how to prevent static electricity when using a vacuum cleaner in dry winter conditions.&lt;/p&gt;
&lt;h2 id="problem-im-afraid-to-use-the-vacuum-cleaner-in-winter-because-of-static-electricity"&gt;Problem: I&amp;rsquo;m Afraid to Use the Vacuum Cleaner in Winter Because of Static Electricity&lt;a class="anchor" href="#problem-im-afraid-to-use-the-vacuum-cleaner-in-winter-because-of-static-electricity"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It&amp;rsquo;s currently a dry and cold February winter in Korea.
My previous vacuum cleaner broke, so I bought a new cordless one.
At some point while using this vacuum cleaner, I started to feel a sudden, sharp electric tingling at the handle.
Even wearing thick gloves while cleaning, the tingling sensation from the electricity continued.
As this kept happening, it got to the point where I became afraid to use the vacuum cleaner.&lt;/p&gt;</description></item><item><title>Numbers and Characters in 0s and 1s</title><link>https://semonan.com/en/book/life-engineering/computer/binary-storage-of-numbers-characters/</link><pubDate>Sun, 02 Feb 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/life-engineering/computer/binary-storage-of-numbers-characters/</guid><description>&lt;h1 id="how-a-computer-stores-numberscharacters-using-0-and-1"&gt;How a Computer Stores Numbers/Characters Using 0 and 1&lt;a class="anchor" href="#how-a-computer-stores-numberscharacters-using-0-and-1"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;You may have heard the phrase &amp;ldquo;computers operate on 0s and 1s.&amp;rdquo;
We can use computers to store characters and numbers, and even music, photos, and videos.
When storing these things, only 0s and 1s are truly used.
Let&amp;rsquo;s explore how data can be stored using only 0s and 1s.&lt;/p&gt;
&lt;img src="https://semonan.com/images/book/life-engineering/computer/binary-storage-of-numbers-characters/computerby01.png" alt="" width="400"&gt;
&lt;h2 id="what-are-0-and-1"&gt;What are 0 and 1?&lt;a class="anchor" href="#what-are-0-and-1"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A computer is a device that operates on electricity.
Therefore, voltage is used to represent 0 and 1.
0 means a relatively low voltage, typically 0 Volts.
1 means a relatively high voltage, typically 1 to 5 Volts.&lt;/p&gt;</description></item><item><title>Face Analysis based on Deep Learning</title><link>https://semonan.com/en/book/ai/face-processing/face-analysis-deep-learning/</link><pubDate>Wed, 16 Oct 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/ai/face-processing/face-analysis-deep-learning/</guid><description>&lt;h1 id="face-analysis-based-on-deep-learning"&gt;Face Analysis based on Deep Learning&lt;a class="anchor" href="#face-analysis-based-on-deep-learning"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;With the advancement of deep learning technology, the performance of face analysis has also improved.&lt;br&gt;
I will introduce a high-performing open-source face analysis library and explain how to use it.&lt;/p&gt;
&lt;h2 id="insightface-2d-and-3d-face-analysis-project"&gt;InsightFace: 2D and 3D Face Analysis Project&lt;a class="anchor" href="#insightface-2d-and-3d-face-analysis-project"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/deepinsight/insightface" rel="noopener noreferrer" target="_blank"&gt;&lt;code&gt;https://github.com/deepinsight/insightface&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;※ License : Please refer to the above site !&lt;/p&gt;
&lt;p&gt;Here, we share various models, and I would like to introduce the &lt;code&gt;buffalo_l&lt;/code&gt; model pack.&lt;br&gt;
&lt;code&gt;buffalo_l&lt;/code&gt; provides blob box, key points, detection score, landmark 2D/3D, gender, age, embedding, and pose information.&lt;br&gt;
 &lt;br&gt;
I will demonstrate the process of face analysis using Python.&lt;/p&gt;</description></item><item><title>Install and Hello world</title><link>https://semonan.com/en/book/programming/rust/install-hello-world/</link><pubDate>Sun, 29 Sep 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/rust/install-hello-world/</guid><description>&lt;h1 id="install-rust-and-print-hello-world"&gt;Install Rust and Print Hello world&lt;a class="anchor" href="#install-rust-and-print-hello-world"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="install-rust"&gt;Install Rust&lt;a class="anchor" href="#install-rust"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Download and run the installation program from the official Rust website.&lt;br&gt;
The installation process is simple.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rust download : &lt;a href="https://www.rust-lang.org/tools/install" rel="noopener noreferrer" target="_blank"&gt;&lt;code&gt;https://www.rust-lang.org/tools/install&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="hello-world"&gt;Hello world&lt;a class="anchor" href="#hello-world"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s create a program that prints a simple message.&lt;br&gt;
I create a file named &lt;code&gt;code1.rs&lt;/code&gt; in the path &lt;code&gt;D:\works\rust\practice1&lt;/code&gt;, and write the following code.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Hello, semonan.com&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Rust starts with &lt;code&gt;main()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Functions are created using the &lt;code&gt;fn&lt;/code&gt; keyword.&lt;/li&gt;
&lt;li&gt;Messages can be printed using &lt;code&gt;println!(&amp;quot;~~~&amp;quot;);&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;!&lt;/code&gt; in &lt;code&gt;println!()&lt;/code&gt; indicates that a Rust Macro is being invoked.&lt;/li&gt;
&lt;li&gt;Rust uses 4 spaces instead of a tab, so there are 4 spaces before &lt;code&gt;println!()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A line of code like &lt;code&gt;println!(&amp;quot;~~~&amp;quot;);&lt;/code&gt; ends with &lt;code&gt;;&lt;/code&gt;. (There are cases where it does not end with &lt;code&gt;;&lt;/code&gt; syntactically, so use it appropriately depending on the situation.)&lt;br&gt;
 &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s compile the source code. &lt;br&gt;
The compiler for Rust is &lt;code&gt;rustc&lt;/code&gt;.&lt;br&gt;
To compile, type the command &lt;code&gt;rustc code1.rs&lt;/code&gt; in the directory where the source code file is located.&lt;br&gt;
&lt;img src="https://semonan.com/images/book/programming/rust/install-hello-world/compile.png" alt="" width="450"&gt;&lt;/p&gt;</description></item><item><title>Let's Encrypt renewal</title><link>https://semonan.com/en/book/network/security/letsencrypt-renewal/</link><pubDate>Sat, 14 Sep 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/network/security/letsencrypt-renewal/</guid><description>&lt;h1 id="how-to-renew-lets-encrypt"&gt;How to Renew Let&amp;rsquo;s Encrypt&lt;a class="anchor" href="#how-to-renew-lets-encrypt"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Let&amp;rsquo;s Encrypt often provides free HTTPS certificates.&lt;br&gt;
The validity of a Let&amp;rsquo;s Encrypt certificate is 90 days, and it can be extended by another 90 days if renewed before expiry.&lt;br&gt;
The renewal of the certificate can be done an unlimited number of times.&lt;/p&gt;
&lt;h2 id="how-to-renew-with-certbot"&gt;How to renew with Certbot&lt;a class="anchor" href="#how-to-renew-with-certbot"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Certbot is a tool for managing Let&amp;rsquo;s Encrypt certificates.&lt;br&gt;
Many people use Certbot to install, renew, and manage certificates.&lt;br&gt;
You can renew them through the following process.&lt;/p&gt;</description></item><item><title>Fast string to integer</title><link>https://semonan.com/en/book/programming/cpp/fast-string-to-integer/</link><pubDate>Thu, 29 Aug 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/cpp/fast-string-to-integer/</guid><description>&lt;h1 id="fast-string-to-integer"&gt;Fast string to integer&lt;a class="anchor" href="#fast-string-to-integer"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="problem"&gt;Problem&lt;a class="anchor" href="#problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In typical cases, strtoul( ) is used to convert strings in decimal or hexadecimal to integers.&lt;br&gt;
However, if strtoul( ) is used repeatedly many times, the processing speed becomes slow.&lt;br&gt;
The following code was repeated 300,000,000 times with strtoul( ), and it took &lt;code&gt;about 5 seconds&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-c++" data-lang="c++"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;chrono&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;hexString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;19AF&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 0x19AF = 6575
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="k"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;chrono&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;high_resolution_clock&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;300000000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;		&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;strtoul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hexString&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="k"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;chrono&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;high_resolution_clock&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;chrono&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;duration&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;milli&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;elapsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;time: &amp;#34;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;elapsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#34; ms&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="improvement"&gt;Improvement&lt;a class="anchor" href="#improvement"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Using a LookUp Table (LUT) can process faster than strtoul( ).&lt;br&gt;
The characters included in decimal and hexadecimal strings are as follows.&lt;/p&gt;</description></item><item><title>Network Basic</title><link>https://semonan.com/en/book/network/basic/network-basics/</link><pubDate>Tue, 20 Aug 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/network/basic/network-basics/</guid><description>&lt;h1 id="communication"&gt;Communication&lt;a class="anchor" href="#communication"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Communication, in simple terms, is about transmitting information.&lt;br&gt;
The concept can be broad and somewhat abstract.&lt;br&gt;
Let’s look at some examples to intuitively understand what communication is all about.&lt;/p&gt;
&lt;h2 id="what-is-communication"&gt;What is communication?&lt;a class="anchor" href="#what-is-communication"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="case-1-human-communication"&gt;Case 1: Human Communication&lt;a class="anchor" href="#case-1-human-communication"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Humans communicate by making sounds with their mouths and listening with their ears;&lt;br&gt;
this is a form of transmitting information and can be described as communication.&lt;br&gt;
Additionally, humans convey information visually through gestures, body language, and facial expressions.&lt;br&gt;
Most of the various ways in which humans communicate can be characterized as forms of communication.&lt;/p&gt;</description></item><item><title>User/Kernel mode</title><link>https://semonan.com/en/book/os/windows/user-kernel-mode/</link><pubDate>Sat, 20 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/os/windows/user-kernel-mode/</guid><description>&lt;h1 id="memory-access-permissions-in-windows-user-mode-and-kernel-mode"&gt;Memory Access Permissions in Windows User mode and Kernel mode&lt;a class="anchor" href="#memory-access-permissions-in-windows-user-mode-and-kernel-mode"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="background"&gt;Background&lt;a class="anchor" href="#background"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On July 19, 2024, many computers worldwide using Windows experienced a blue screen issue.&lt;br&gt;
A blue screen on Windows indicates a critical error that requires a computer reboot.&lt;br&gt;
This led to a paralysis of crucial systems including businesses, public organizations, and airports as they went down.&lt;br&gt;
The cause is said to be a flaw in a widely used security software.&lt;br&gt;
Typically, common software rarely triggers a blue screen problem.&lt;br&gt;
What was different about this security software that caused the blue screen issue?&lt;br&gt;
Let’s explore and find out.&lt;/p&gt;</description></item><item><title>Pay-as-you-go ChatGPT</title><link>https://semonan.com/en/book/ai/usage-tips/chatgpt-pay-as-you-go/</link><pubDate>Sun, 14 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/ai/usage-tips/chatgpt-pay-as-you-go/</guid><description>&lt;h1 id="using-the-paid-version-of-chatgpt-affordably-via-api"&gt;Using the Paid Version of ChatGPT Affordably via API&lt;a class="anchor" href="#using-the-paid-version-of-chatgpt-affordably-via-api"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="backgroundproblem"&gt;Background/Problem&lt;a class="anchor" href="#backgroundproblem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To use the paid version of Chat GPT offered by OpenAI, a monthly subscription fee of $20 is required.&lt;br&gt;
(As of June 2024, this amounts to approximately 30,000 KRW when applying the exchange rate for South Korea.)&lt;br&gt;
Paying $20 every month can feel expensive for those with low usage.&lt;/p&gt;
&lt;h2 id="improvement"&gt;Improvement&lt;a class="anchor" href="#improvement"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To address this issue, I will explain a simple coding method that allows for pay-as-you-go usage.&lt;br&gt;
OpenAI provides an API for the Chat Bot, which operates on a pay-as-you-go basis.&lt;br&gt;
Therefore, if your monthly usage is low, using the API can be more cost-effective than subscribing.&lt;/p&gt;</description></item><item><title>Macos vi editor color scheme</title><link>https://semonan.com/en/book/os/macos/vi-editor-color-scheme/</link><pubDate>Thu, 11 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/os/macos/vi-editor-color-scheme/</guid><description>&lt;h1 id="applying-colors-to-the-vi-editor-on-mac-os"&gt;Applying Colors to the VI Editor on Mac OS&lt;a class="anchor" href="#applying-colors-to-the-vi-editor-on-mac-os"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="problem"&gt;Problem&lt;a class="anchor" href="#problem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On Mac OS, the default color scheme for vim is not configured, so readability is poor as shown below.&lt;/p&gt;
&lt;img src="https://semonan.com/images/book/os/macos/vi-editor-color-scheme/vimcolor1.png" alt="" width="350"&gt;
&lt;p&gt;Let&amp;rsquo;s configure a vim color scheme to improve readability as shown below.&lt;/p&gt;
&lt;img src="https://semonan.com/images/book/os/macos/vi-editor-color-scheme/vimcolor2.png" alt="" width="350"&gt;
&lt;h2 id="how-to-configure"&gt;How to Configure&lt;a class="anchor" href="#how-to-configure"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Create a &lt;code&gt;.vimrc&lt;/code&gt; file as follows.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-shellscript" data-lang="shellscript"&gt;% cd ~/
% mkdir .vim
% cd .vim
% git clone https://github.com/rafi/awesome-vim-colorschemes
% cd awesome-vim-colorschemes
% mv colors ../
% cd ~/
% vim .vimrc&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add the following content to the &lt;code&gt;.vimrc&lt;/code&gt; file.&lt;/p&gt;</description></item><item><title>LoRA</title><link>https://semonan.com/en/book/ai/fine-tuning/lora/</link><pubDate>Sun, 07 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/ai/fine-tuning/lora/</guid><description>&lt;link rel="stylesheet" href="https://semonan.com/katex/katex.min.css" /&gt;&lt;script defer src="https://semonan.com/katex/katex.min.js"&gt;&lt;/script&gt;&lt;script defer src="https://semonan.com/katex/auto-render.min.js" onload="renderMathInElement(document.body, {&amp;#34;delimiters&amp;#34;:[{&amp;#34;left&amp;#34;:&amp;#34;$$&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;$$&amp;#34;,&amp;#34;display&amp;#34;:true},{&amp;#34;left&amp;#34;:&amp;#34;$&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;$&amp;#34;,&amp;#34;display&amp;#34;:false},{&amp;#34;left&amp;#34;:&amp;#34;\\[&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;\\]&amp;#34;,&amp;#34;display&amp;#34;:true},{&amp;#34;left&amp;#34;:&amp;#34;\\(&amp;#34;,&amp;#34;right&amp;#34;:&amp;#34;\\)&amp;#34;,&amp;#34;display&amp;#34;:false}]});"&gt;&lt;/script&gt;
&lt;h1 id="lora-low-rank-adaptation"&gt;LoRA (Low-Rank Adaptation)&lt;a class="anchor" href="#lora-low-rank-adaptation"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;LoRA is one of the PEFT (Parameter-Efficient Fine-Tuning) techniques.&lt;br&gt;
This technique efficiently fine-tunes large pre-trained models for specific tasks.&lt;/p&gt;
&lt;p&gt;(The following content is referenced from the paper &amp;ldquo;LoRA: Low-Rank Adaptation of Large Language Models.&amp;rdquo;)&lt;/p&gt;
&lt;h2 id="backgroundproblem"&gt;Background/Problem&lt;a class="anchor" href="#backgroundproblem"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Models like LLM (Large Language Models) have an extremely large number of parameters.&lt;br&gt;
For example, the llama3 model, released in April 2024, has about 70 billion parameters and a file size of over 40GB, with many models being even larger.&lt;br&gt;
Full fine-tuning of such large models requires high-performance GPUs and considerable training time.&lt;br&gt;
Additionally, fully fine-tuning the base model may potentially degrade the fundamental performance learned during pretraining.&lt;/p&gt;</description></item><item><title>Feature</title><link>https://semonan.com/en/book/programming/python/feature/</link><pubDate>Fri, 05 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/python/feature/</guid><description>&lt;h1 id="basic-characteristics-of-python"&gt;Basic Characteristics of Python&lt;a class="anchor" href="#basic-characteristics-of-python"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Python is a multipurpose programming language and its characteristics are as follows.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Readable Syntax&lt;br&gt;
Python&amp;rsquo;s syntax is intuitive and clear, which enhances the readability of the code. This improves maintainability and productivity.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Dynamic Typing&lt;br&gt;
Python supports dynamic typing, which allows you to use variables without explicitly declaring their types. The type of a variable is determined at runtime.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Interpreter Language&lt;br&gt;
Python is an interpreted language, executing code line by line. This enhances debugging and development speed, but may result in slower execution speeds compared to compiled languages.&lt;/p&gt;</description></item><item><title>How LED Brightness Is Controlled</title><link>https://semonan.com/en/book/life-engineering/appliance/led-dimming-principle/</link><pubDate>Sun, 21 Dec 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/life-engineering/appliance/led-dimming-principle/</guid><description>&lt;h2 id="how-does-an-led-control-its-brightness"&gt;How Does an LED Control Its Brightness?&lt;a class="anchor" href="#how-does-an-led-control-its-brightness"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Take a close look at Christmas tree lights.
The lights don&amp;rsquo;t just turn on and off — they gradually get brighter and then gradually dimmer.
In other words, the brightness is being controlled.&lt;/p&gt;
&lt;img src="https://semonan.com/images/book/life-engineering/appliance/led-dimming-principle/img1.webp" alt="" width="350"&gt;
&lt;p&gt;Is the LED&amp;rsquo;s brightness really being controlled?
No!
In fact, it&amp;rsquo;s tricking our eyes into thinking the LED&amp;rsquo;s brightness is being adjusted.
Let me explain the principle.&lt;/p&gt;
&lt;h2 id="a-simple-led-circuit"&gt;A Simple LED Circuit&lt;a class="anchor" href="#a-simple-led-circuit"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;img src="https://semonan.com/images/book/life-engineering/appliance/led-dimming-principle/img2.webp" alt="" width="600"&gt;
&lt;p&gt;I&amp;rsquo;ve prepared a battery, an LED, and a switch.
By connecting them in series, I built a simple electrical circuit.
As shown in the figure on the right, when the switch is closed, current flows and the LED turns on.
Conversely, as shown on the left, when the switch is opened and the current is cut off, the LED turns off.&lt;/p&gt;</description></item><item><title>Surging DRAM Demand</title><link>https://semonan.com/en/book/life-engineering/computer/surging-dram-demand/</link><pubDate>Wed, 03 Dec 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/life-engineering/computer/surging-dram-demand/</guid><description>&lt;h1 id="memory-manufacturers-are-raking-in-money"&gt;Memory Manufacturers Are Raking In Money&lt;a class="anchor" href="#memory-manufacturers-are-raking-in-money"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Samsung Electronics, SK Hynix, and Micron are the world&amp;rsquo;s three largest memory manufacturers.
They generate huge operating profits by producing and selling DRAM.
As of December 2025, DRAM demand has surged so much that they reportedly cannot keep up with supply.
In other words, DRAM makers are raking in money, and this trend is expected to continue for the foreseeable future.
What exactly is DRAM, and why has its demand suddenly skyrocketed?
Let me explain why.&lt;/p&gt;</description></item><item><title>Image editing</title><link>https://semonan.com/en/book/ai/usage-tips/image-editing/</link><pubDate>Sun, 23 Nov 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/ai/usage-tips/image-editing/</guid><description>&lt;h1 id="letting-ai-edit-images"&gt;Letting AI Edit Images&lt;a class="anchor" href="#letting-ai-edit-images"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="is-ai-good-at-editing-images"&gt;Is AI good at editing images?&lt;a class="anchor" href="#is-ai-good-at-editing-images"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Editing images, such as removing specific objects or changing their colors, has become an area where AI excels.&lt;br&gt;
Let&amp;rsquo;s take a look at how well it performs.&lt;br&gt;
The image on the left is the original, and the one on the right has been modified by AI.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sample 1&lt;br&gt;
Prompt : &amp;ldquo;Please remove the apple from the picture.&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The AI smoothly erased the apple as follows.&lt;br&gt;
&lt;img src="https://semonan.com/images/book/ai/usage-tips/image-editing/sample1.webp" alt="AI image editing sample 1 - removing an apple" width="370"&gt;&lt;/p&gt;</description></item><item><title>Enjoyment Over Will or Persistence</title><link>https://semonan.com/en/book/thoughts/quotes/enjoyment-is-more-important/</link><pubDate>Sat, 12 Jul 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/thoughts/quotes/enjoyment-is-more-important/</guid><description>&lt;h1 id="more-than-will-is-persistence-and-more-than-persistence-is-enjoyment"&gt;&amp;ldquo;More Than Will Is Persistence, and More Than Persistence Is Enjoyment&amp;rdquo;&lt;a class="anchor" href="#more-than-will-is-persistence-and-more-than-persistence-is-enjoyment"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;When you read a book by force, you can&amp;rsquo;t even last 10 minutes; but when you read it with enjoyment, 30 minutes pass in a flash.&lt;/p&gt;
&lt;p&gt;To achieve something, you need will — but to sustain that will, you have to enjoy it.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s why persistence beats will, and enjoyment beats persistence.&lt;/p&gt;
&lt;p&gt;― Lee Ha-young, author of &amp;ldquo;I Respect My Twenties the Most&amp;rdquo;&lt;/p&gt;</description></item><item><title>iPhone 16 Pro</title><link>https://semonan.com/en/book/product-reviews/electronics/iphone16pro/</link><pubDate>Wed, 09 Jul 2025 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/product-reviews/electronics/iphone16pro/</guid><description>&lt;h2 id="why-i-sold-my-iphone-16-pro"&gt;Why I Sold My iPhone 16 Pro&lt;a class="anchor" href="#why-i-sold-my-iphone-16-pro"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I pre-ordered an iPhone 16 Pro in September 2024 and used it for about four months until January 2025.
At the time of purchase, the price was a whopping 1.7 million KRW, which felt very expensive.
It was my first iPhone, and my expectations were as high as the price.&lt;/p&gt;
&lt;img src="https://semonan.com/images/book/product-reviews/electronics/iphone16pro/iphone16pro_2.webp" alt="iPhone 16 Pro" width="500"&gt;
&lt;p&gt;Coming from Galaxy, I had no real trouble adapting to the iPhone, but I ended up selling it for one single reason.
That reason is Samsung Pay.
The iPhone doesn&amp;rsquo;t support Samsung Pay, so I had to carry physical payment cards separately.
I use a local currency card, a debit card, a credit card, and a fuel card.
With Galaxy, thanks to Samsung Pay, I didn&amp;rsquo;t need to carry physical cards.
But with the iPhone, I always had to carry a card wallet.
There were several awkward situations where I forgot the wallet and couldn&amp;rsquo;t pay.
For public transit too, Galaxy lets you pay with the phone, but the iPhone doesn&amp;rsquo;t.&lt;/p&gt;</description></item><item><title>Variability of variables</title><link>https://semonan.com/en/book/programming/rust/variability-of-variables/</link><pubDate>Tue, 08 Oct 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/rust/variability-of-variables/</guid><description>&lt;h1 id="variability-of-variables"&gt;Variability of variables&lt;a class="anchor" href="#variability-of-variables"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="let"&gt;let&lt;a class="anchor" href="#let"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Rust, you declare variables using the &lt;code&gt;let&lt;/code&gt; keyword as follows.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;apple&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, since &lt;code&gt;let&lt;/code&gt; is fundamentally immutable, trying to change the value of &lt;code&gt;apple&lt;/code&gt; as shown below will result in an error.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;apple&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;apple&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;E0384&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;: &lt;span class="nc"&gt;cannot&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;assign&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;twice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;immutable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;variable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="n"&gt;apple&lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="let-mut"&gt;let mut&lt;a class="anchor" href="#let-mut"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To modify a value, you need to use the &lt;code&gt;let mut&lt;/code&gt; keyword as follows.&lt;br&gt;
Here, &lt;code&gt;mut&lt;/code&gt; stands for mutable.&lt;/p&gt;</description></item><item><title>Data type</title><link>https://semonan.com/en/book/programming/python/data-type/</link><pubDate>Mon, 08 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/python/data-type/</guid><description>&lt;h1 id="python-data-types"&gt;Python Data Types&lt;a class="anchor" href="#python-data-types"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Python has various data types, each with its own unique characteristics and purposes.&lt;br&gt;
I will explain the main data types.&lt;/p&gt;
&lt;h2 id="1-numeric-types"&gt;1. Numeric Types&lt;a class="anchor" href="#1-numeric-types"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Integer (&lt;code&gt;int&lt;/code&gt;): An integer data type. It includes both positive and negative numbers and has no size limit.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Floating Point (&lt;code&gt;float&lt;/code&gt;): A floating-point data type that includes decimal points.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Complex Numbers (&lt;code&gt;complex&lt;/code&gt;): A complex number data type with a real part and an imaginary part.&lt;br&gt;
The imaginary part is represented using j.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="2-sequence-types"&gt;2. Sequence Types&lt;a class="anchor" href="#2-sequence-types"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;String (&lt;code&gt;str&lt;/code&gt;): A collection of characters enclosed in single quotes (&amp;rsquo;) or double quotes (&amp;quot;).&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Hello, World!&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;List (&lt;code&gt;list&lt;/code&gt;): A mutable sequence type that stores multiple values in order.&lt;br&gt;
It is defined using square brackets ([ ]) and can include different data types.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Tuple (&lt;code&gt;tuple&lt;/code&gt;): Similar to a list but immutable.&lt;br&gt;
It is defined using parentheses (( )).&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;c&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="3-set-types"&gt;3. Set Types&lt;a class="anchor" href="#3-set-types"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Set (&lt;code&gt;set&lt;/code&gt;): A collection of unique elements.&lt;br&gt;
It is unordered and defined using curly braces ({ }).&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;frozenset: An immutable set.&lt;br&gt;
It is created using the frozenset() function.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;frozenset&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="4-mapping-types"&gt;4. Mapping Types&lt;a class="anchor" href="#4-mapping-types"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Dictionary (&lt;code&gt;dict&lt;/code&gt;): A collection of key-value pairs.&lt;br&gt;
It is defined using curly braces ({ }) and the keys must be unique.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Alice&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;age&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="5-other-types"&gt;5. Other Types&lt;a class="anchor" href="#5-other-types"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Boolean (&lt;code&gt;bool&lt;/code&gt;): A type that represents True and False.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;l&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;None&lt;/code&gt;: A type that represents the absence of a value.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>How to Install WSL</title><link>https://semonan.com/en/book/os/windows/wsl-install/</link><pubDate>Sun, 12 May 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/os/windows/wsl-install/</guid><description>&lt;h1 id="how-to-install-wsl-windows-subsystem-for-linux"&gt;How to Install WSL (Windows Subsystem for Linux)&lt;a class="anchor" href="#how-to-install-wsl-windows-subsystem-for-linux"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide explains how to install Linux on Windows.&lt;br&gt;
The WSL (Windows Subsystem for Linux) feature has been built into Windows since Windows 10.&lt;br&gt;
The installation is simple, and you can conveniently use Linux as a virtual environment alongside Windows.&lt;/p&gt;
&lt;p&gt;The instructions are based on Windows 11 Home (24H2).&lt;br&gt;
We will install Ubuntu as the Linux distribution.&lt;/p&gt;
&lt;h2 id="1-open-control-panel---programs---turn-windows-features-on-or-off"&gt;1. Open [Control Panel] -&amp;gt; [Programs] -&amp;gt; [Turn Windows features on or off]&lt;a class="anchor" href="#1-open-control-panel---programs---turn-windows-features-on-or-off"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;img src="https://semonan.com/images/book/os/windows/wsl-install/wsl-1.png" alt="Entering Programs menu from Control Panel" /&gt;
&lt;img src="https://semonan.com/images/book/os/windows/wsl-install/wsl-2.png" alt="Location of Turn Windows features on or off menu" /&gt; 
&lt;h2 id="2-check-windows-subsystem-for-linux-and-virtual-machine-platform---confirm---reboot"&gt;2. Check &amp;ldquo;Windows Subsystem for Linux&amp;rdquo; and &amp;ldquo;Virtual Machine Platform&amp;rdquo; -&amp;gt; Confirm -&amp;gt; Reboot&lt;a class="anchor" href="#2-check-windows-subsystem-for-linux-and-virtual-machine-platform---confirm---reboot"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;img src="https://semonan.com/images/book/os/windows/wsl-install/wsl-3.png" alt="Checking Windows Subsystem for Linux and Virtual Machine Platform" /&gt;
&lt;p&gt;※ Depending on your computer environment, you may also need to check the following items:&lt;br&gt;
   &amp;ldquo;Hyper-V&amp;rdquo;, &amp;ldquo;Windows Subsystem for Linux&amp;rdquo;, &amp;ldquo;Windows Hypervisor Platform&amp;rdquo;&lt;/p&gt;</description></item><item><title>Data type</title><link>https://semonan.com/en/book/programming/rust/data-type/</link><pubDate>Thu, 07 Nov 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/rust/data-type/</guid><description>&lt;h1 id="data-type"&gt;Data Type&lt;a class="anchor" href="#data-type"&gt;#&lt;/a&gt;&lt;/h1&gt;

&lt;p&gt;Every value in Rust has a Data type.&lt;br&gt;
Since Rust is a statically typed language, the Data type must be determined at compile time.&lt;/p&gt;
&lt;h2 id="1-scalar-type"&gt;1. Scalar type&lt;a class="anchor" href="#1-scalar-type"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A Scalar type represents a single value, and there are four kinds of Scalar types.&lt;/p&gt;
&lt;h3 id="11-integer"&gt;1.1 integer&lt;a class="anchor" href="#11-integer"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The integer type is used for whole numbers and cannot include decimal points.&lt;br&gt;
The kinds of integer types are shown in the table below.&lt;/p&gt;</description></item><item><title>Casting</title><link>https://semonan.com/en/book/programming/python/casting/</link><pubDate>Mon, 08 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/python/casting/</guid><description>&lt;h1 id="casting-in-python-type-conversion"&gt;Casting in Python (Type Conversion)&lt;a class="anchor" href="#casting-in-python-type-conversion"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;In Python, &amp;ldquo;casting&amp;rdquo; means converting a data type to another data type.&lt;br&gt;
Since Python is a dynamically typed language, it is sometimes necessary to explicitly convert the data type of a variable.&lt;/p&gt;
&lt;h2 id="1-int---float"&gt;1. int -&amp;gt; float&lt;a class="anchor" href="#1-int---float"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the following code, the variable &lt;code&gt;a&lt;/code&gt; is of int type.&lt;br&gt;
Since &lt;code&gt;a&lt;/code&gt; is cast to float type as &lt;code&gt;b = float(a)&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt; is of float type and its value is the floating-point number 10.0.&lt;/p&gt;</description></item><item><title>Function</title><link>https://semonan.com/en/book/programming/rust/function/</link><pubDate>Mon, 02 Dec 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/rust/function/</guid><description>&lt;h1 id="function"&gt;Function&lt;a class="anchor" href="#function"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="function-definition"&gt;Function Definition&lt;a class="anchor" href="#function-definition"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Functions are created using the &lt;code&gt;fn&lt;/code&gt; keyword as follows.&lt;br&gt;
There is no need to consider the order in which functions are defined, as long as they are defined somewhere within a scope.&lt;br&gt;
Therefore, in the example code below, the &lt;code&gt;hello()&lt;/code&gt; function is located after the &lt;code&gt;main()&lt;/code&gt; function, and it compiles and runs correctly.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;hello&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="parameter"&gt;Parameter&lt;a class="anchor" href="#parameter"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can pass parameters when calling a function, as shown in the following example code.&lt;br&gt;
The &lt;code&gt;add&lt;/code&gt; function can take two parameters, &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;, both of type &lt;code&gt;i64&lt;/code&gt;.&lt;br&gt;
You must declare the type of each parameter, like &lt;code&gt;i64&lt;/code&gt;, when receiving them in a function.&lt;br&gt;
You can pass multiple parameters.&lt;/p&gt;</description></item><item><title>List</title><link>https://semonan.com/en/book/programming/python/list/</link><pubDate>Mon, 08 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/python/list/</guid><description>&lt;h1 id="python-list"&gt;Python List&lt;a class="anchor" href="#python-list"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;In Python, a list is an ordered and mutable collection of data.&lt;br&gt;
A list can contain items of various data types, and the items can be modified, added, or deleted.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s assume we need to handle 10,000 values.&lt;br&gt;
Creating 10,000 variables would be highly inefficient.&lt;br&gt;
Therefore, Python provides lists to efficiently handle multiple values.&lt;/p&gt;
&lt;h2 id="1-creating-a-list"&gt;1. Creating a List&lt;a class="anchor" href="#1-creating-a-list"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A list can be created using &lt;code&gt;[ ]&lt;/code&gt; as follows.&lt;br&gt;
You can place multiple values inside the &lt;code&gt;[ ]&lt;/code&gt; to handle them as a single list.&lt;br&gt;
In the following example, integers, floats, and strings are all included in a single list.&lt;br&gt;
An important feature is that a single list can contain multiple data types.&lt;br&gt;
Each value contained in a list is called an element.&lt;/p&gt;</description></item><item><title>Read/Write a file</title><link>https://semonan.com/en/book/programming/python/file-io/</link><pubDate>Mon, 26 Aug 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/python/file-io/</guid><description>&lt;h1 id="how-to-read-and-write-files-in-python"&gt;How to Read and Write Files in Python&lt;a class="anchor" href="#how-to-read-and-write-files-in-python"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide explains how to read and write files in Python.&lt;br&gt;
It is organized around the most commonly used example codes.&lt;/p&gt;
&lt;h2 id="1-reading-a-text-file---reading-the-entire-file"&gt;1. Reading a Text File - Reading the Entire File&lt;a class="anchor" href="#1-reading-a-text-file---reading-the-entire-file"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can create a file stream using &lt;code&gt;open(&amp;quot;abcd.txt&amp;quot;, &amp;quot;r&amp;quot;)&lt;/code&gt; and read the entire file at once with &lt;code&gt;.read()&lt;/code&gt;.&lt;br&gt;
(Creating a file stream means establishing a link to access the file.)&lt;br&gt;
Here, &lt;code&gt;&amp;quot;abcd.txt&amp;quot;&lt;/code&gt; refers to the full path of the file to be read, and you can use either an absolute path or a relative path.&lt;br&gt;
&lt;code&gt;&amp;quot;r&amp;quot;&lt;/code&gt; stands for read mode.&lt;/p&gt;</description></item><item><title>Slices of collections</title><link>https://semonan.com/en/book/programming/rust/slices-of-collections/</link><pubDate>Thu, 11 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/rust/slices-of-collections/</guid><description>&lt;h1 id="string-slicing"&gt;String Slicing&lt;a class="anchor" href="#string-slicing"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="string-slicing-syntax"&gt;String Slicing Syntax&lt;a class="anchor" href="#string-slicing-syntax"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Rust provides convenient syntax for slicing strings.&lt;br&gt;
Let&amp;rsquo;s explore this through the following code.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;::&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;hello world&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By coding &lt;code&gt;&amp;amp;s[0..5]&lt;/code&gt;, you can slice out &lt;code&gt;&amp;quot;hello&amp;quot;&lt;/code&gt;.&lt;br&gt;
Here, 0 means the start index, and 5 means the end index + 1.&lt;br&gt;
(Note that you use the end index + 1.)&lt;br&gt;
By coding &lt;code&gt;&amp;amp;s[6..11]&lt;/code&gt;, you can slice out &lt;code&gt;&amp;quot;world&amp;quot;&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>struct</title><link>https://semonan.com/en/book/programming/rust/struct/</link><pubDate>Thu, 11 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/rust/struct/</guid><description>&lt;h1 id="struct"&gt;struct&lt;a class="anchor" href="#struct"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="basic-usage-of-struct"&gt;Basic usage of struct&lt;a class="anchor" href="#basic-usage-of-struct"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s learn how to use Structs in Rust.&lt;br&gt;
The &lt;code&gt;struct Person { ~~~ }&lt;/code&gt; part in the following example defines a struct.&lt;br&gt;
The &lt;code&gt;Person&lt;/code&gt; struct has the fields &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;age&lt;/code&gt;, and &lt;code&gt;is_student&lt;/code&gt;, and each field has its type defined.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-rust" data-lang="rust"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;: &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;: &lt;span class="kt"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;is_student&lt;/span&gt;: &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;mut&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;: &lt;span class="nb"&gt;String&lt;/span&gt;::&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;semonan.com&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;: &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;is_student&lt;/span&gt;: &lt;span class="nc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_student&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="fm"&gt;println!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;, &lt;/span&gt;&lt;span class="si"&gt;{}&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_student&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A struct must be instantiated to be used, as shown with &lt;code&gt;let mut person = Person { ~~~ }&lt;/code&gt;.&lt;br&gt;
In the example above, the instance is created as mutable so that the values of each field can be changed.&lt;br&gt;
You can read the values of the struct with code like &lt;code&gt;person.name&lt;/code&gt;, &lt;code&gt;person.age&lt;/code&gt;, &lt;code&gt;person.is_student&lt;/code&gt;.&lt;br&gt;
You can change a value with code like &lt;code&gt;person.age = 13;&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>struct method</title><link>https://semonan.com/en/book/programming/rust/struct-method/</link><pubDate>Thu, 11 Jul 2024 00:00:00 +0000</pubDate><guid>https://semonan.com/en/book/programming/rust/struct-method/</guid><description>&lt;h1 id="struct-method"&gt;struct method&lt;a class="anchor" href="#struct-method"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="what-is-a-method"&gt;What is a method?&lt;a class="anchor" href="#what-is-a-method"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A method is essentially the same as a function, except that it is included within a struct.&lt;br&gt;
Let&amp;rsquo;s learn how to define a method.&lt;br&gt;
In the following example, a &lt;code&gt;Person&lt;/code&gt; struct is defined as &lt;code&gt;struct Person { ~~~ }&lt;/code&gt;.&lt;br&gt;
In &lt;code&gt;impl Person&lt;/code&gt;, &lt;code&gt;impl&lt;/code&gt; stands for implementation.&lt;br&gt;
The functions created inside &lt;code&gt;impl { ~~~ }&lt;/code&gt; are methods.&lt;br&gt;
A method is created with &lt;code&gt;fn speak(self) { ~~~ }&lt;/code&gt;, where &lt;code&gt;self&lt;/code&gt; is taken as the first parameter.&lt;br&gt;
&lt;code&gt;self&lt;/code&gt; refers to the struct itself, &lt;code&gt;struct Person&lt;/code&gt;.&lt;br&gt;
The first parameter of a method must be &lt;code&gt;self&lt;/code&gt;; otherwise, a compile error will occur.&lt;br&gt;
The line &lt;code&gt;println!(&amp;quot;hi, {}&amp;quot;, self.name);&lt;/code&gt; prints &lt;code&gt;self.name&lt;/code&gt;.&lt;br&gt;
Here, &lt;code&gt;self.name&lt;/code&gt; refers to &lt;code&gt;name: String&lt;/code&gt; inside &lt;code&gt;struct Person { name: String, }&lt;/code&gt;.&lt;br&gt;
After creating an instance with &lt;code&gt;let person = Person{ ~~~ };&lt;/code&gt;, you can call the method with &lt;code&gt;person.speak()&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>