<?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: MasashiKon</title>
    <description>The latest articles on DEV Community by MasashiKon (@masashikon).</description>
    <link>https://dev.to/masashikon</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%2F917502%2F54e46c6e-d90d-47e0-8316-3eeba17d61ef.png</url>
      <title>DEV Community: MasashiKon</title>
      <link>https://dev.to/masashikon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/masashikon"/>
    <language>en</language>
    <item>
      <title>Learning how to type Bopomofo</title>
      <dc:creator>MasashiKon</dc:creator>
      <pubDate>Sat, 13 Jan 2024 06:37:46 +0000</pubDate>
      <link>https://dev.to/masashikon/learning-how-to-type-bopomofo-5d5l</link>
      <guid>https://dev.to/masashikon/learning-how-to-type-bopomofo-5d5l</guid>
      <description>&lt;p&gt;I published my first typing practicing site.&lt;/p&gt;

&lt;p&gt;Have you ever seen characters like these ㄅㄆㄇㄈ called Bopomofo?&lt;/p&gt;

&lt;p&gt;Well, this is a unique in Taiwan and I have been thinking to learn Chinese with these for a few years.&lt;/p&gt;

&lt;p&gt;However there are not so many site I can learn typing Bopomofo, So I built it by my self.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mvymWqD5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/futm8vwdr3avw2b7skmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mvymWqD5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/futm8vwdr3avw2b7skmx.png" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The page is pretty simple, but it already has complete typing interface of them.&lt;/p&gt;

&lt;p&gt;Try to play around!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introduction to p5.js</title>
      <dc:creator>MasashiKon</dc:creator>
      <pubDate>Wed, 22 Feb 2023 18:48:33 +0000</pubDate>
      <link>https://dev.to/masashikon/introduction-to-p5js-448f</link>
      <guid>https://dev.to/masashikon/introduction-to-p5js-448f</guid>
      <description>&lt;p&gt;To make our website more attractive, we often try to add some visualization to it.&lt;br&gt;
 However, only with vanilla html, css and javascript, it'll be so hard to do and it it the time &lt;strong&gt;p5.js&lt;/strong&gt; comes in!&lt;br&gt;
 In this article, you will know a brief knowledge about p5.js.&lt;/p&gt;
&lt;h2&gt;
  
  
  Set up your first p5.js
&lt;/h2&gt;

&lt;p&gt;p5.js is a javascript library. That means you can apply it to your project just by adding CDN.&lt;br&gt;
 First, visit to &lt;a href="https://p5js.org/get-started/" rel="noopener noreferrer"&gt;p5.js&lt;/a&gt; site and copy the script tag for CDN and just paste it inside your header tag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="https://cdn.jsdelivr.net/npm/p5@1.5.0/lib/p5.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then your p5.js is ready!&lt;br&gt;
 Now you create your own javascript file for the html and start writing your canvas.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create Canvas
&lt;/h2&gt;

&lt;p&gt;5p.js has some reserved functions and setup() is one of them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;function setup() {}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once you define this function, you don't need to call it. p5.js automatically invokes the function and code inside the function block will be run when html file is loaded.&lt;br&gt;
 Inside the function, we first need to create new canvas using by createCanvas(). It takes two argument: width and height.&lt;br&gt;
 If you want to make the canvas having 800px width and 600px height, you just call the function like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function setup() {
  createCanvas(800, 600);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By this code, p5.js make new html new canvas tags and append it to html body.&lt;/p&gt;

&lt;p&gt;Also, you can change background color of the canvas by calling background(). It takes color value as its parameter such as RGBA or hex color.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function setup() {
  createCanvas(800, 600);
  background(255, 0, 0); // "#ff0000" also sets background color red.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Set background color
&lt;/h2&gt;

&lt;p&gt;Now, you have created brand new canvas. Let's draw something inside of it!&lt;br&gt;
 When you want to draw something in canvas, you call draw() function. As the name says, it draws in your canvas. For example, for drawing a line, you just call line() inside your canvas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function draw() {
  line(0, 0, width, height);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see a line goes through the canvas now. line() function takes starting x and y coordinate of the line in first and second parameters and end points as third and fourth.&lt;br&gt;
 By default, you can point a position of the canvas by x and y coordinate. They starts from top left corner of the canvas. &lt;br&gt;
 That means origin and value of x increases as it goes to right and y goes to bottom. width and heigh variables are both predefined by p5.js. When you call &lt;code&gt;createCanvas(800, 600)&lt;/code&gt; in setup(), these arguments are stored to each width and height.&lt;/p&gt;
&lt;h2&gt;
  
  
  Move line
&lt;/h2&gt;

&lt;p&gt;p5.js is library for creativity. So it has a functionality for this!&lt;br&gt;
 Refactor your code inside your function to this and let's see the result.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function draw() {
 line(0 + frameCount, 0, width + frameCount, height);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The black object appearing! But why? In this code, frameCount also a reserved variable that has number of how many times the canvas rendered since the canvas html tag created.&lt;br&gt;
 That means, yes, the canvas is rendered many of times! By default, 5p.js renders the canvas 60 times per second. And draw() function runs the code inside of it in every that time.&lt;br&gt;
 So if you want to move line, you need to refresh the canvas in each rendering by call background().&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function draw() {
 background(0, 0, 0); // Reset background to white in each rendering.
 line(0 + frameCount, 0, width + frameCount, height); // On refreshed background, line is rendered.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;background() function also accepts alpha value as a fourth value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function draw() {
 background(0, 0, 0, 10); // alpha value between 0 - 255
 line(0 + frameCount, 0, width + frameCount, height);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The line has ghost effect as moving!&lt;/p&gt;

&lt;h2&gt;
  
  
  Web Editor
&lt;/h2&gt;

&lt;p&gt;Now you have understood the very basic of p5.js! If you fell to try, there is a &lt;a href="https://editor.p5js.org/" rel="noopener noreferrer"&gt;web editor&lt;/a&gt; and there are &lt;a href="https://p5js.org/reference/" rel="noopener noreferrer"&gt;plenty more functions&lt;/a&gt; for your creativity.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Microservices For A Macro System</title>
      <dc:creator>MasashiKon</dc:creator>
      <pubDate>Tue, 10 Jan 2023 18:52:04 +0000</pubDate>
      <link>https://dev.to/masashikon/microservices-for-a-macro-system-1ngj</link>
      <guid>https://dev.to/masashikon/microservices-for-a-macro-system-1ngj</guid>
      <description>&lt;p&gt;There are kind like infinite amount of subjects in coding world. When you finish learning one functionality, new feature comes immediately and we may get lost again.&lt;br&gt;
 As I was learning JavaScript, sometimes wondering that how broad the JavaScript world is comparing to entire computer science. When I was getting started how it is related to HTML and CSS, the language suddenly says, "Hey, I am able to run on terminal but only web. browser!". What an awful word it was.&lt;br&gt;
 The more I learning, the more the world broaden. Well, it is great experience of course. I love to hit APIs or make sprites to move on Phaser. Also, solving a maze by breadth first is so nice thing to code.&lt;br&gt;
 Anyway, I found one thing from these studies. That is an importance of separation.&lt;br&gt;
 For instance, when you solve the maze problem, you must know the way of handling 2D arrays like nested for loops or other methods. If you have the object notation in your toolbox, you are able to add extra information to each cell of maze such like whether the cell has been visited.&lt;br&gt;
  Array and object are quite basic to talk about. However the way of thinking is applying more complex things.&lt;br&gt;
  If you want to make complex function, first of all you need to separate factors. That means, what consists the function? How should I ask the user to input something? How should I treat the input? as string or array? Where does it go after processing the input in which data type? Am I understanding that small functionality precisely?&lt;br&gt;
 Well, it's getting confusing. It is obvious that to separate  functionalities when building it. What I want to say is rather separating, or organizing my toolbox than the function it self.&lt;br&gt;
 Let's go back to the maze problem. I insisted that array and object are basic thing for coding. But is it true?&lt;br&gt;
 Solving maze is popular problem but not one of the easiest. You may need to take time to think of strategy before actual coding.&lt;br&gt;
 In that time, it requires imagination skill. You need to move elements inside of 2D arrays and each has object. So you need to iterate through objects and each object has key-value pairs like isVisited. Besides, the code should have cue array for processing algorithm. A value of isVisited should be toggled to true when it pushed to cue...&lt;br&gt;
 It's getting tangled again! However this time, maybe the thinking has gone into a bit deeper than before.&lt;br&gt;
 This is because I know about array and object well. I mean, I'm not a newbie at least.&lt;br&gt;
 And this is what I meant: knowing what can I do by the tools?&lt;br&gt;
 Node.js can handle outside of browser environment. Java is good at to express relationship between real entities. Bootstrap makes designing web pages a lot easier but if you want to transform HTML elements as wish, you may better to use CSS. Labeling the tools with brief description makes it easy to choose what should I use for a situation.&lt;br&gt;
 Even if those descriptions are wrong, we can relabeling later. It's better than no description.&lt;br&gt;
 Since August last summer, we've learned lot of things. And from that, not only the practical things, I learned the way of learning. This is maybe the most valuable thing for future macro coding.&lt;/p&gt;

</description>
      <category>pubsub</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
