<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: hirohata</title>
    <description>The latest articles on DEV Community by hirohata (@hirohata).</description>
    <link>https://dev.to/hirohata</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1150107%2Fd4731c03-f4f2-43f2-b9ca-a982784d4da5.jpeg</url>
      <title>DEV Community: hirohata</title>
      <link>https://dev.to/hirohata</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hirohata"/>
    <language>en</language>
    <item>
      <title>Created My Portfolio</title>
      <dc:creator>hirohata</dc:creator>
      <pubDate>Wed, 03 Jul 2024 18:36:38 +0000</pubDate>
      <link>https://dev.to/hirohata/created-my-portfolio-1hnf</link>
      <guid>https://dev.to/hirohata/created-my-portfolio-1hnf</guid>
      <description>&lt;h1&gt;
  
  
  Created My Portfolio
&lt;/h1&gt;

&lt;p&gt;I recently built a system to automate the process of updating my portfolio and resume. This approach eliminates the need for frequent manual updates, ensuring that my online presence always reflects my latest accomplishments and skills.&lt;/p&gt;

&lt;h2&gt;
  
  
  Portfolio
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://portfolio-9ym.pages.dev/" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://rest-api.honwakapappa-honwakapappa.workers.dev/docs" rel="noopener noreferrer"&gt;REST API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://graphql.honwakapappa-honwakapappa.workers.dev/graphql" rel="noopener noreferrer"&gt;GraphQL&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Initially, I set out to create a traditional portfolio website.  However,  during the planning stage, I realized that the core information for both a portfolio and a resume is essentially the same: showcasing my skills and experience.  With this realization, I decided to explore a more integrated approach.  This resulted in a system that automatically updates both my portfolio and resume whenever I update my resume content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure
&lt;/h2&gt;

&lt;p&gt;The diagram of this system's overview is the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6pgh5ktbax8z6slweylc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6pgh5ktbax8z6slweylc.png" alt="Image description" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My portfolio system leverages &lt;a href="https://docs.astro.build/en/guides/server-side-rendering/" rel="noopener noreferrer"&gt;server-side rendering (SSR) within the Astro framework&lt;/a&gt; to ensure users always access the latest information. Here's how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User Accesses Portfolio: When a user visits my portfolio website, the server hosting the portfolio initiates a call to my information API (details explained later).&lt;/li&gt;
&lt;li&gt;API Data Extraction: The information API returns my most recent data.&lt;/li&gt;
&lt;li&gt;Server-Side Rendering: Astro utilizes SSR to render the portfolio on the server, incorporating the fetched data from the API.&lt;/li&gt;
&lt;li&gt;Fresh Content Delivered: The server then delivers the fully rendered HTML content, including the latest information, to the user's browser.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Modular System Design
&lt;/h2&gt;

&lt;p&gt;My portfolio system is comprised of two well-defined modules, each housed in its own dedicated GitHub repository with integrated deployment via GitHub Actions to &lt;a href="https://pages.cloudflare.com/" rel="noopener noreferrer"&gt;Cloudflare Pages&lt;/a&gt; or &lt;a href="https://developers.cloudflare.com/workers/" rel="noopener noreferrer"&gt;Cloudflare Workers&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Modules
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Portfolio Frontend
&lt;/h4&gt;

&lt;p&gt;This Astro-based module is solely responsible for the visual presentation of the portfolio. It retrieves and displays information from the information management module but doesn't store any user data itself.&lt;/p&gt;

&lt;h4&gt;
  
  
  Information Management Module
&lt;/h4&gt;

&lt;p&gt;This comprehensive module manages all user information and related functionalities. It consists of four distinct components:&lt;/p&gt;

&lt;h5&gt;
  
  
  Information Storage
&lt;/h5&gt;

&lt;p&gt;This component leverages TypeScript to define the structure and types for user data in JSON format. This file acts as a schema, ensuring data consistency and enabling type safety within the system. The user information itself is stored directly within this TypeScript file, utilizing the defined JSON structure.&lt;/p&gt;

&lt;h5&gt;
  
  
  Resume Generation
&lt;/h5&gt;

&lt;p&gt;This component leverages &lt;a href="https://astro.build/" rel="noopener noreferrer"&gt;Astro&lt;/a&gt; to dynamically generate a resume in HTML format based on the user's information. A subsequent automated process within GitHub Actions converts the HTML to PDF and ensures its deployment to both GitHub artifacts and Cloudflare.&lt;/p&gt;

&lt;h5&gt;
  
  
  REST API
&lt;/h5&gt;

&lt;p&gt;This component, built with &lt;a href="https://hono.dev/?kawaii=true" rel="noopener noreferrer"&gt;Hono&lt;/a&gt; and &lt;a href="https://hono.dev/examples/swagger-ui" rel="noopener noreferrer"&gt;Swagger UI middleware&lt;/a&gt;, provides a RESTful interface for accessing and potentially manipulating user information.&lt;/p&gt;

&lt;h5&gt;
  
  
  GraphQL API
&lt;/h5&gt;

&lt;p&gt;This component, built with &lt;a href="https://the-guild.dev/graphql/yoga-server" rel="noopener noreferrer"&gt;GraphQL Yoga&lt;/a&gt;, offers a GraphQL interface for interacting with user data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;By providing my latest information as API, it allows users to create my portfolio as they like. So you can create a cool portfolio for me. I cannot wait to see my nice and cool portfolio site that will be created by YOU!😜&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>portfolio</category>
    </item>
    <item>
      <title>Created Result Type in TypeScript</title>
      <dc:creator>hirohata</dc:creator>
      <pubDate>Wed, 15 Nov 2023 05:23:23 +0000</pubDate>
      <link>https://dev.to/hirohata/created-result-type-in-typescript-128m</link>
      <guid>https://dev.to/hirohata/created-result-type-in-typescript-128m</guid>
      <description>&lt;p&gt;I created my result type. &lt;a href="https://github.com/hitohata/result-ts-type" rel="noopener noreferrer"&gt;Repository&lt;/a&gt; / &lt;a href="https://www.npmjs.com/package/result-ts-type" rel="noopener noreferrer"&gt;NPM&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;Handling errors is a crucial aspect of creating reliable and readable code. While TypeScript (JavaScript) offers a try-catch syntax, it can be challenging to clearly recognize whether a function returns an error or not.&lt;br&gt;
By using the Result type, we can explicitly express that a function has the potential to return an error.&lt;/p&gt;

&lt;p&gt;In a recent personal project I joined, we opted for TypeScript. Consequently, we chose to implement and utilize the following Result type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;V&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="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Ok&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;V&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works well in the code. We can explicitly express that a function may return an error state, allowing us to handle errors without using try-catch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;someFunction&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// this result is inferred to the OK.&lt;/span&gt;
    &lt;span class="c1"&gt;// do something&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// this result is error.&lt;/span&gt;
    &lt;span class="c1"&gt;// do error handling.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, this result type resulted in pain in testing.&lt;br&gt;&lt;br&gt;
When writing tests, there are instances where we need to create dummy objects convincing an 'OK' type. In such cases, we found ourselves needing to check if the result is 'OK' or 'Err' using an if-condition. If we attempt to access the value without checking the 'ok' field in the result type, the IDE raises a warning. This can be quite bothersome and affects code readability.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;okValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;someFunction&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;okValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// this is used in tests, so we don't need error handling.&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;error message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Created Result Type
&lt;/h2&gt;

&lt;p&gt;To address this situation, I created my result type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;IOk&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;IErr&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IOk&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;unwrap&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;unwrapOrElse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;defaultValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;unwrapError&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;never&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IErr&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;unwrap&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;never&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;unwrapOrElse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;DefaultValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;unwrapError&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This key feature of this result type is an implementation of the &lt;code&gt;unwrap&lt;/code&gt; method, inspired by &lt;a href="https://doc.rust-lang.org/std/result/enum.Result.html#method.unwrap" rel="noopener noreferrer"&gt;Rust's approach&lt;/a&gt;. With this method, there is no longer a need to explicitly check the 'ok' field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;okValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;someFunction&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;unwrap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This result type significantly streamlines our development process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The use of result type in TypeScript is a subject of much debate, and various packages have been created. In our specific use case, the result type I created meets our requirements satisfactorily at least.&lt;/p&gt;

&lt;p&gt;I want to use Rust. 🦀🦀🦀&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>npm</category>
    </item>
    <item>
      <title>Creating an App for my wedding party</title>
      <dc:creator>hirohata</dc:creator>
      <pubDate>Fri, 03 Nov 2023 08:45:48 +0000</pubDate>
      <link>https://dev.to/hirohata/learning-journal-creating-an-app-for-my-wedding-party-5a3f</link>
      <guid>https://dev.to/hirohata/learning-journal-creating-an-app-for-my-wedding-party-5a3f</guid>
      <description>&lt;p&gt;I created an application for my wedding party.&lt;br&gt;
&lt;a href="https://github.com/hitohata/welcomeBoard.git" rel="noopener noreferrer"&gt;The repository&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Objective
&lt;/h2&gt;

&lt;p&gt;To host a wedding party, it's necessary to communicate with the guests regarding details such as the date, venue address, and more.&lt;br&gt;
While we've created invitations on paper, it's not very convenient for checking and sharing updated information.&lt;/p&gt;

&lt;p&gt;In Japan, there's a tradition of writing messages to guests on the back of place cards.&lt;br&gt;
However, it can be challenging for me because physical cards lack an "undo" button.&lt;/p&gt;

&lt;p&gt;To address these issues, I've developed an application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Considerations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Interface
&lt;/h3&gt;

&lt;p&gt;The top priority of the interface is to ensure that it doesn't inconvenience our guests. Therefore, I opted for &lt;a href="https://line.me/en/" rel="noopener noreferrer"&gt;Line&lt;/a&gt;, a chat application. This application is widely used and installed on everyone's phone.  &lt;/p&gt;

&lt;p&gt;The Line has &lt;a href="https://developers.line.biz/en/services/messaging-api/" rel="noopener noreferrer"&gt;a webhook&lt;/a&gt; feature, and I've implemented communication using it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Message delivery
&lt;/h3&gt;

&lt;p&gt;Messages to guests must be delivered to the specific guests only. To achieve this, I opted to employ a combination of the user's ID and unique keyword for verifying guest inputs. These IDs are generated on Line and are transmitted via webhook, which I utilized. &lt;br&gt;
The keyword essentially functions as a "password" shared with my wife or me and the respective guest, similar to a security question used when resetting a password.&lt;br&gt;
We've written a question or an abstract image on the back of each place card to convey these secrets.&lt;br&gt;
For instance, I've used the notation →↓↘+P, and the answer is "Shoryuken". This is intended for my guest who is a fan of Street Fighter.&lt;/p&gt;

&lt;p&gt;This approach ensures that messages are delivered exclusively to the intended recipients.&lt;/p&gt;

&lt;h3&gt;
  
  
  Application hosting
&lt;/h3&gt;

&lt;p&gt;I've set up the backend infrastructure on AWS, and the application's data is encrypted and stored in the database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Input messages
&lt;/h3&gt;

&lt;p&gt;We needed to compose messages for the guests.&lt;br&gt;
While it was feasible to write them using the AWS-managed console, it wasn't very convenient for my wife.&lt;br&gt;
Consequently, I developed a web page for crafting messages.&lt;br&gt;
I designed a simple and cost-effective user interface (UI) solely for our use.&lt;br&gt;
To safeguard the database, I made it mandatory to log in before accessing it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10pjnsmw7yhsb85xpixi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10pjnsmw7yhsb85xpixi.png" alt="cheap UI" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Static Information
&lt;/h3&gt;

&lt;p&gt;The Line application provides &lt;a href="https://developers.line.biz/en/docs/messaging-api/using-rich-menus/" rel="noopener noreferrer"&gt;"rich menus"&lt;/a&gt;.&lt;br&gt;
It is like a keyboard that can be assigned to arbitrary commands.&lt;br&gt;
I created a "rich menus" with frequently asked questions assigned.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fheqt0zulpenwgisroo84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fheqt0zulpenwgisroo84.png" alt="Image description" width="800" height="802"&gt;&lt;/a&gt;&lt;br&gt;
from top left: date time, venue, menu, groom profile, bride profile, seat&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvlykuh9h5zyw0m7ldo12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvlykuh9h5zyw0m7ldo12.png" alt="Image description" width="800" height="802"&gt;&lt;/a&gt;&lt;br&gt;
pushed: date time, venue&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Message from Guests
&lt;/h3&gt;

&lt;p&gt;When guests send a message, it's forwarded to the host's account.&lt;br&gt;
In the host's account, the message format appears as follows: "{username} &amp;gt; {input message}".&lt;br&gt;
This format allows us to easily identify who wrote what, facilitating the handling of any issues or inquiries that may arise.&lt;/p&gt;

&lt;p&gt;Fortunately, we didn't encounter big trouble.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj673svgvr0bq0e2rmyt9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj673svgvr0bq0e2rmyt9.png" alt="host-image" width="371" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the wedding day, this function served as the means of delivering messages to the guests.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Message from Hosts
&lt;/h3&gt;

&lt;p&gt;When hosts send a message to the host's account, it is also broadcast to all guests.&lt;br&gt;
This feature enables us to effortlessly inform all guests about any updates or important information.&lt;/p&gt;

&lt;h2&gt;
  
  
  For Entertain
&lt;/h2&gt;

&lt;p&gt;All of the requirements have been met by the features.&lt;br&gt;
Additionally, I've incorporated some extra features designed to entertain the guests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Easter Egg Messages
&lt;/h3&gt;

&lt;p&gt;This feature is quite similar to the messaging feature, but it's intended for sending messages to multiple guests.&lt;br&gt;
The messages sent here are very informal and casual in nature.&lt;br&gt;
For instance: IF guests send "Frozen", they get the answer "The season of the film is summer".&lt;/p&gt;

&lt;h3&gt;
  
  
  Images and Videos
&lt;/h3&gt;

&lt;p&gt;This application supports images and videos.&lt;br&gt;
When guests send images or videos to the application, the data is stored in AWS S3 storage.&lt;br&gt;
Additionally, as a fun feature, guests sending data have a one-tenth chance of receiving an image that someone else uploaded&lt;br&gt;
This feature was added for entertainment purposes and encouraged guests to share more images in the hopes of receiving images from others.&lt;/p&gt;

&lt;p&gt;Thanks to this functionality, we were able to easily download all the images and videos the day after the wedding party, making it a convenient way to collect and share memories.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Due to the nature of this application, I couldn't receive feedback beforehand, which made me skeptical about whether it would meet the guests' expectations.&lt;br&gt;
However, after the party, I'm convinced that this application greatly assisted both the guests and my wife.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Leet Code No.62</title>
      <dc:creator>hirohata</dc:creator>
      <pubDate>Wed, 04 Oct 2023 20:50:48 +0000</pubDate>
      <link>https://dev.to/hirohata/leet-code-no62-2lp7</link>
      <guid>https://dev.to/hirohata/leet-code-no62-2lp7</guid>
      <description>&lt;h1&gt;
  
  
  Leet Code No.62
&lt;/h1&gt;

&lt;p&gt;I'm not good at dynamic programming. So, I searched for it and wrote about it in this article.&lt;/p&gt;

&lt;p&gt;Dynamic programming, short for DP, is the way that decompose big problems into small problems to solve. This is not a concrete algorithm like binary search or Gauss' addition and so on, it's like a method of solving problems.&lt;br&gt;&lt;br&gt;
To understand DP, solve some problems.&lt;/p&gt;
&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;

&lt;p&gt;I chose &lt;a href="https://leetcode.com/problems/unique-paths/" rel="noopener noreferrer"&gt;this problem&lt;/a&gt; from the leet code.&lt;/p&gt;
&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;The answer will be the total combination of m-1 and n-1. To understand, consider the target grid is 4 x 3.&lt;/p&gt;

&lt;p&gt;Let's represent the movement as an arrow.&lt;br&gt;
The robot can move right or down, so the possible moving will be the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8zcn0q9qkbl2jdhzg0ge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8zcn0q9qkbl2jdhzg0ge.png" alt="Image description" width="361" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The robot cannot go back, we just count the sum of the possible paths. To calculate the possible paths, I try to write the number in the grid the possibility. The top row will be 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxe20xqc0j6p182x1ely4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxe20xqc0j6p182x1ely4.png" alt="Image description" width="341" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second and subsequent rows are different, there are multiple paths that exist. The number of possible paths will be the sum of the left grid and the above grid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmiva6sb38vxb8nl8lcsw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmiva6sb38vxb8nl8lcsw.png" alt="Image description" width="721" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To continue this way, we can get the answer. In this case, the answer will be 10.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdoq7qe36fossf3r06op3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdoq7qe36fossf3r06op3.png" alt="Image description" width="721" height="261"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Write code
&lt;/h3&gt;

&lt;p&gt;I solved this problem with Rust and TypeScript.&lt;br&gt;
The solution is the following:&lt;/p&gt;

&lt;p&gt;In Rust:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;unique_paths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nd"&gt;vec!&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nd"&gt;vec!&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="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;


    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;grid&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;][(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;uniquePaths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;fill&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="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, create a 2D array filled with 1. The reason for filing with 1 is the top rows and most left columns will be 1 and others are updated during the calculation.&lt;/p&gt;

&lt;p&gt;Rust&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nd"&gt;vec!&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nd"&gt;vec!&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="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;fill&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then calculate the unique paths. The unique paths are calculated using the left and above cells as it was mentioned above. That is calculated by the loop.&lt;/p&gt;

&lt;p&gt;Rust&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;usize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;grid&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this way, the unique paths are calculated and the answer will be the most right and bottom cell.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>leetcode</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Projects in 2015 - 2023</title>
      <dc:creator>hirohata</dc:creator>
      <pubDate>Wed, 06 Sep 2023 00:05:31 +0000</pubDate>
      <link>https://dev.to/hirohata/projects-in-2016-2023-mi9</link>
      <guid>https://dev.to/hirohata/projects-in-2016-2023-mi9</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This article introduces my experience in 2015 - 2023. Now I quit my local country's company and came to Vancouver, Canada. Originally, I wrote this article for my college's task and I think that was a good opportunity to review my experience. However, it got too long to read for that purpose, so I decided to divide and post this independently. Only the parts that have permission to publish by ex-company are described.&lt;/p&gt;

&lt;h2&gt;
  
  
  Projects Index and Overview
&lt;/h2&gt;

&lt;p&gt;I am writing this in 2023, and I have worked for 8 years on software-related works for now. I'll introduce 3 projects in this article that I'm passionate about. Besides these, there are other projects that I have experienced.&lt;br&gt;
In a department that I belonged to, there was only one developer that is me. So, I worked from planning to maintenance and instructed other developers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//#1.1"&gt;1.1. Visual Inspection Machine&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To help workers work and to generalize inspection work, create a visual inspection machine.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//#1.2"&gt;1.2. Core Business System&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project started in 2020 the year of the COVID-19 pandemic. We had to change our work style from Onsite to Remote (Hybrid) without any cost. So, I created this system. I set the priority to speed rather than quality. Then I realized this system was (going to) the technical debit. Therefore, I had to redesign and refactor this system after this system was released.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//#1.3"&gt;1.3. IoT System&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data aggregation system. This system aggregates data on equipment or the environment of the factory, then visualizes and analyze it to prevent equipment defect. Finally, This system was merged into a company-wide system.&lt;/p&gt;

&lt;h2&gt;
  
  
  1.1. Visual Inspection Machine &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Problem&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the factory where I worked, there are visual inspection process, and workers used a loupe to check parts and write down in parts detail on paper. This process seems difficult in addition this process is a critical process. But there were only two workers, a total worker of this team is five people, who could do this process at that time. Therefore this process sometimes could become a bottleneck.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I created a visual inspection machine. It is a fundamentally XY table that holds a web camera. I created it by modifying &lt;a href="https://www.amazon.ca/Genmitsu-3018-PRO-Control-Engraving-300x180x45mm/dp/B07P6K9BL3/ref=asc_df_B07P6K9BL3/?tag=googleshopc0c-20&amp;amp;linkCode=df0&amp;amp;hvadid=336061965591&amp;amp;hvpos=&amp;amp;hvnetw=g&amp;amp;hvrand=15715971337028209919&amp;amp;hvpone=&amp;amp;hvptwo=&amp;amp;hvqmt=&amp;amp;hvdev=c&amp;amp;hvdvcmdl=&amp;amp;hvlocint=&amp;amp;hvlocphy=9001547&amp;amp;hvtargid=pla-660048360626&amp;amp;psc=1" rel="noopener noreferrer"&gt;this kind of product&lt;/a&gt;. I chose &lt;a href="https://www.raspberrypi.com/" rel="noopener noreferrer"&gt;the Raspberry Pi&lt;/a&gt; as the PC that controls the table because I need a digital I/O pin to communicate with the driver board of the table. We can know the coordination of parts and it can easily convert to a .csv file, so I created a GUI and a table control program using Python. Users (workers) just need to set a work and click a button. Then, the camera moves to target parts and the display of the PC (RPi) shows the parts with expanding&lt;/p&gt;

&lt;p&gt;Using this machine, every member of the team can now do this work. And working time also reduced.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skills&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python&lt;/p&gt;

&lt;h2&gt;
  
  
  1.2. Core Business System &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Problem&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In 2020, the COVID-19 pandemic covered the world, and we had to change the work style from Onsite to Remote (Hybrid). However, the department's system was created by MS Excel and MS Access. So, to share the data, a person who went to work had to upload that data to cloud storage and, persons who work from home downloaded it from a cloud. Some of those data sizes were over 1 GB, so downloading took sometimes 1 hour. At the same time, spending was curtailed so we couldn't prepare enough budget.&lt;br&gt;
Creating a product needs several processes. maintenance master data, process-designing, publishing designed processes to workers, keeping a record of work (who and when did), and so on. These days, these are managed by some strongly bounded independent systems. To publish data to workers, papers were used which means someone has to print, write to it, scan, and upload data to some server(s).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We had to change this situation as soon as possible. It could handle this situation by hand but it was very time-consuming. To handle this situation, I reviewed the business process and created a new core business system using AWS.&lt;br&gt;
The system is a serverless web system. In the first phase, it was quite simple, the backend was the web three-layer application and just handled CRUD using Python, and the frontend was React with Typescript. The interface between frontend and backend is GraphQL, but since this system is also used by legacy systems or tools, this system exposes read-only REST API. After I created this system, it seemed to work very well. The spending time related to is reduced 1000 hours/year and 1 person who works &lt;strong&gt;for&lt;/strong&gt; ex-system.&lt;br&gt;
And I noticed this system was very hard to maintain.&lt;br&gt;&lt;br&gt;
You already know the process of work is not stable. Some problems will come out, the restriction will change, and external environments force to change process. This application had just rolled out so there are many feedback from users. In addition, new requests came for new features that integrate with other systems.&lt;br&gt;
As I mentioned above, I had to create a new system as soon as possible so my priority was speed rather than quality. But I realized that this was the wrong decision. It was hard to understand the overall picture, it was had poor models, and it hard to check influence when trying to make changes because I used Python as a backend language which has weak typing. Therefore I had asked permission to redesign and started creating version 2.&lt;br&gt;
I adapted TypeScript as a backend language because it has a strong typing system and is already used to frontend and IaC (&lt;a href="https://docs.aws.amazon.com/cdk/" rel="noopener noreferrer"&gt;CDK&lt;/a&gt;). And I decided to adopt &lt;a href="https://en.wikipedia.org/wiki/Domain-driven_design" rel="noopener noreferrer"&gt;Domain Driven Development&lt;/a&gt;. Fortunately, I was familiar with the domain of my department's work, we could easily reach an agreement about definitions of each word (ubiquitous language). In addition, there was a plan that scale this system that developing a production planning system asking for outsourcing. Thus, I divided this system, into a microservice, and adapted an event-driven architecture to publish events to other systems.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skills&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Version 1: Python, React.js, TypeScript, AWS(Lambda, CDK, AppSync, API Gateway, Aurora Serverless)&lt;br&gt;
Version 2: TypeScript, React.js, AWS(Lambda, CDK, AppSync, API Gateway, DynamoDB, Aurora Serverless, Event Bridge)&lt;/p&gt;

&lt;h2&gt;
  
  
  1.3. IoT System &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Problem&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For factory productivity, it is important to prevent machine defects or to gather data to determine the cause of some production defective. Actually, this project started as an experimental project. There was a few problems like some data was written down to papers and hard to access to it. But in most cases, there were few chances to need that kind of thing. Although 2018 this project started, it was also a fact that some factories get profit by preventing machine defects or detecting some problems not only with machines but also with products by correcting and analyzing data from equipment.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bni5yddprfj8yb5pqhu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3bni5yddprfj8yb5pqhu.png" alt="PreviousSystem" width="800" height="335"&gt;&lt;/a&gt;&lt;br&gt;
I created some small systems that were designed for a single kind of equipment and sensor. I think it worked well especially, with a checking mechanism we could know some bad conditions before it gets to the defect. Using this, we could reduce the cost and time spent on recovering defects.&lt;br&gt;
Some years later after deploying those systems, similar needs emerged in other equipment. However, those systems were designed for each equipment thus I need to design a new system that will be more general.&lt;br&gt;
Before explaining a new system, I would like to explain the &lt;strong&gt;data&lt;/strong&gt; in this context. Generally, the equipment in the machine industry is controlled using &lt;a href="https://en.wikipedia.org/wiki/Programmable_logic_controller" rel="noopener noreferrer"&gt;PLC&lt;/a&gt; or the same kinds of devices. The equipment data is mainly generated by sensors and the PLC aggregates those data for controlling equipment. For example, if there was an equipment having a furnace. It may have temperature sensors and heaters and PLC gets temperature data and controls heaters if exceeds the temperature limit, heaters turn off. It means the PLC has numerical data.&lt;br&gt;
The previous one was deployed on a server that I managed, but it was hard to manage it. The previous one has access to the PLC to extract data. To reduce management costs, the new system uses AWS and changes the data-extracting strategy. I created a server program that receives data from equipment and converts it to HTTP then send data with credential to &lt;a href="https://aws.amazon.com/jp/iot-core/" rel="noopener noreferrer"&gt;AWS IoT Core&lt;/a&gt;. This program accepts UDP requests from equipment and extracts data from its datagram. Generally, the PLC cannot create HTTP requests or even if it can, the using it are very restricted and cannot modify but it has an L-4 connection TCP or UDP. Therefore I created a server program that accepts UDP requests from equipment. The frequency of requests from equipment is predicted to be less than 10 msec in the worst case, and this program will run on the shared PC in my department. What's more, the number of equipment was not predictable. Hence I had to create a light wait and avoid using a gavage collection so I used Rust for this server program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq2b4hog3x9xclgbjtgfu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq2b4hog3x9xclgbjtgfu.png" alt="NewSystem" width="800" height="824"&gt;&lt;/a&gt;&lt;br&gt;
The previous one accessed the PLC or sensor. This means when the change occurs (like when new equipment is installed, the new sensor is attached to equipment), the system must be changed. But there is a lot of equipment there and each equipment is assigned person in charge. So the target of the element (i.e. temperature, air pressure, and so on) must be decided by those people. Because those people have deep knowledge about equipment or problems with equipment but they don't have software knowledge. So, to change occur, the person in charge must ask me to update the program. It robs us of productivity and speed. So new one takes a strategy that just accepts data from equipment. Of course, it needs to change the settings of the program. But it is outsourced, so the person in charge can change settings themselves then the settings are reflected in the program.&lt;/p&gt;

&lt;p&gt;This system works well and the same needs exist in other factories in the ex-company, as a result, this system is integrated into a company-wide system.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skills&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Previous one: Python, Django, TypeScript, React.js, MariaDB&lt;br&gt;
New one: Rust, TypeScript, AWS(IoT Core, Kinesis Firehose, S3, CDK, API Gateway, DynamoDB, Aurora Serverless, Event Bridge)&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This was a good opportunity to review what I did. I learned many things from these experiences. When I start a new project, I will remember these experiences to reduce unnecessary nightmare maintenance.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
