<?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: Tuan Thanh Tan</title>
    <description>The latest articles on DEV Community by Tuan Thanh Tan (@tuanthanh2067).</description>
    <link>https://dev.to/tuanthanh2067</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%2F701198%2Fff7e10ef-4095-443b-a15f-665b1708d73b.jpg</url>
      <title>DEV Community: Tuan Thanh Tan</title>
      <link>https://dev.to/tuanthanh2067</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tuanthanh2067"/>
    <language>en</language>
    <item>
      <title>SPO600 - Project Stage 3</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Wed, 15 Dec 2021 15:43:29 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/spo600-project-stage-3-28g5</link>
      <guid>https://dev.to/tuanthanh2067/spo600-project-stage-3-28g5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today I'd like to talk about my last stage of spo600 project.&lt;/p&gt;

&lt;p&gt;In my previous blog, I had a little discussion about &lt;code&gt;ffmpeg&lt;/code&gt; and how it is important to us. So for this stage, I'm going to give some suggestions on how &lt;code&gt;ffmpeg&lt;/code&gt; should be extended to support Scalable Vector Extensions v2(SVE2)&lt;/p&gt;

&lt;h2&gt;
  
  
  About SVE2
&lt;/h2&gt;

&lt;p&gt;Speaking about SVE2, it is a superset of SVE and Neon. SVE2 gives more function domains, because it inherits its previous concepts including vector registers, and operation principles. So people are able to opt for hardware with a maximum of 2048 bits. Refer &lt;a href="https://developer.arm.com/documentation/102340/0001/Introducing-SVE2"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommendation
&lt;/h2&gt;

&lt;p&gt;Because ffmpeg focuses much on process multimedia content such as audio, video, subtitles and related metadata, which are considered to be quite heavy as it involves a lot of decoding, encoding,... So SVE2 would bring a huge benefit in terms of options, flexibility. The good old SIMD instructions to do some color conversions or scaling routines can be improved by a library which is called &lt;code&gt;libswscale&lt;/code&gt;. This library will tremendously bring &lt;code&gt;ffmpeg&lt;/code&gt; to a whole new level as it help improve the process time. Apart from that, &lt;code&gt;ffmpeg&lt;/code&gt; is using Neon in order to do some vector thing which can be improved by switching to SVE2 in order to utilize its benefits as it allows vector code to adapt to a wide range of vector lengths during execution time. &lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;SVE2 has 32 scalable vector registers which ranges from Z0 to Z31 and it can be implemented from 128 bits up to 2045 bits with 128 increment which is amazing so by taking advantage of SVE2, people can actually maximize the usage of &lt;code&gt;ffmpeg&lt;/code&gt;. This is a powerful tool but when given an add-on, it will offer more strength that facilitates users.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 - Project Stage 2</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Sat, 11 Dec 2021 21:00:35 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/spo600-project-stage-2-4fl5</link>
      <guid>https://dev.to/tuanthanh2067/spo600-project-stage-2-4fl5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today I'd like to talk about my process of working with project stage 2 in SPO600 course, and how I got it done, and the result.&lt;/p&gt;

&lt;p&gt;For this stage 2 of the project, you have to choose one of these packages open source packages &lt;br&gt;
&lt;code&gt;ardour&lt;br&gt;
eigen&lt;br&gt;
ffmpeg&lt;br&gt;
gnuradio&lt;br&gt;
gromacs&lt;br&gt;
lame&lt;br&gt;
mjpegtools&lt;br&gt;
nettle&lt;br&gt;
numpy&lt;br&gt;
pipewire&lt;br&gt;
pulseaudio&lt;br&gt;
vlc&lt;br&gt;
xz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to do a little research about. After a while looking it up online, I decided to go with &lt;code&gt;ffmpeg&lt;/code&gt; because it may be the closest one to me :) The project can be found &lt;a href="https://github.com/FFmpeg/FFmpeg"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;As they state on their github: &lt;code&gt;FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.&lt;/code&gt; This basically means that we have already used it before but we don't really know their existence because it is just a small program in daily use of computer but has a huge importance. This project has lasted for more than a decade now since it's first created but we can see it's still actively being updated and contributed by looking at the last commit which is just a few hours ago. &lt;/p&gt;

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

&lt;h2&gt;
  
  
  About the package
&lt;/h2&gt;

&lt;p&gt;SIMD (Single Instruction Multiple Data) is a processing which using single instruction to process data including audio, video, subtitles and related metadata. &lt;/p&gt;

&lt;p&gt;They have like more than thousands files which contain humongous lines of code in there so finding which one is which also proposes a great challenge. But Github makes it easier as it offers people with search in the directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9LJ5iVYJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0x0krcyb40ihygqb3ggg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9LJ5iVYJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0x0krcyb40ihygqb3ggg.png" alt="Image description" width="880" height="894"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is an example of them using SIMD in Aarch64 architecture.  &lt;/p&gt;

&lt;p&gt;Regarding x86_64 folder, it can be found &lt;a href="https://github.com/FFmpeg/FFmpeg/tree/master/libswscale/x86"&gt;here&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;and SIMD use can be found &lt;a href="https://github.com/FFmpeg/FFmpeg/blob/master/libswscale/x86/hscale_fast_bilinear_simd.c"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because I'm not familiar with these architectures and I just spent a few hours looking at it. So I cannot fully understand what's going on in these files. It's just my personal perspective. And these files don't include lots of comments which brings the difficulty to a whole new level.&lt;/p&gt;

&lt;p&gt;Speaking of h264pred_neon.s, in my opinion, it will be called during runtime because the line will only be called when the function outside is called. As we can see, this function is deep inside a file, another function from outside of this file can directly calls the function. Apart from that, it has a lot of function declarations and its implementations which I think will be called somewhere else. &lt;/p&gt;

&lt;p&gt;For hscale_fast_bilinear_simd.c, as far as I understand, it's written in c because it's in .c file but nested within a &lt;code&gt;__asm__&lt;/code&gt;. This file will create optimized horizontal scaling routine. This scaler is made of runtime-generated MMXEXT code using specially tuned pshufw instructions. For every four output pixels, if four input pixels are enough for the fast bilinear scaling, then a chunk of fragmentB is used. If five input pixels are needed, then a chunk of fragmentA is used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;It seems like this project is using a lot of SIMD in its code as in aarch64 folder, most of the files are &lt;code&gt;.c&lt;/code&gt;, and &lt;code&gt;.S&lt;/code&gt;. Because this is a transcoding, conversing library so it needs to utilize SIMD to maximize its performance.&lt;/p&gt;

&lt;p&gt;This is one of the most difficult assignment I've ever had in this course. Mostly because I have not got a chance to deeply learn about these architectures. Besides, this is a big project that has been there for more than 1 decade, more than 100k commits have been made. So a few hours of looking at the source code means nothing. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Contributing to Telescope project (part 3)</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Fri, 10 Dec 2021 16:24:01 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/contributing-to-telescope-project-part-3-65a</link>
      <guid>https://dev.to/tuanthanh2067/contributing-to-telescope-project-part-3-65a</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, this is part 3 where I'd like to talk more about the details of each issue that mentioned in part 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Process
&lt;/h2&gt;

&lt;h3&gt;
  
  
  First
&lt;/h3&gt;

&lt;p&gt;Pull request for the first issue can be found &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2524"&gt;here&lt;/a&gt;&lt;br&gt;
To be honest, this issue only took me around 10 to 15 minutes to fix as it's about removing &lt;code&gt;const fetch = require('node-fetch');&lt;/code&gt; and changing it to &lt;code&gt;const {fetch} = require('@senecacdot/satellite');&lt;/code&gt;. The thing is that you have to use a command to look for it &lt;code&gt;git grep node-fetch&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Second
&lt;/h3&gt;

&lt;p&gt;Pull request for the second issue can be found &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2548"&gt;here&lt;/a&gt;&lt;br&gt;
Because Telescope is written in React so I have to work with component most of the time. This is no exception. I created a dedicated component for the share button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useState } from 'react';
import { Tooltip, IconButton, createStyles, Zoom } from '@material-ui/core';
import { makeStyles, Theme } from '@material-ui/core/styles';
import { withStyles } from '@material-ui/styles';
import CopyIcon from '@material-ui/icons/FileCopyOutlined';
import Check from '@material-ui/icons/Check';

type Props = {
  url: string;
};

const ButtonTooltip = withStyles({
  tooltip: {
    fontSize: '1.25rem',
    margin: 0,
  },
})(Tooltip);

const useStyles = makeStyles((theme: Theme) =&amp;gt;
  createStyles({
    copy: {
      fill: theme.palette.primary.main,
    },

    check: {
      fill: '#3fb950',
    },
  })
);

const ShareButton = ({ url }: Props) =&amp;gt; {
  const classes = useStyles();

  const [isCopiedToClipboard, setIsCopiedToClipboard] = useState(false);

  const copyToClipboardEvent = () =&amp;gt; {
    navigator.clipboard.writeText(url);
    setIsCopiedToClipboard(true);

    setTimeout(() =&amp;gt; {
      setIsCopiedToClipboard(false);
    }, 3000);
  };

  return !isCopiedToClipboard ? (
    &amp;lt;ButtonTooltip title="Copy URL" arrow placement="top" TransitionComponent={Zoom}&amp;gt;
      &amp;lt;IconButton
        onClick={() =&amp;gt; {
          copyToClipboardEvent();
        }}
      &amp;gt;
        &amp;lt;CopyIcon className={classes.copy} /&amp;gt;
      &amp;lt;/IconButton&amp;gt;
    &amp;lt;/ButtonTooltip&amp;gt;
  ) : (
    &amp;lt;ButtonTooltip title="Copied" arrow placement="top" TransitionComponent={Zoom}&amp;gt;
      &amp;lt;IconButton&amp;gt;
        &amp;lt;Check className={classes.check} /&amp;gt;
      &amp;lt;/IconButton&amp;gt;
    &amp;lt;/ButtonTooltip&amp;gt;
  );
};

export default ShareButton;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, as you can see, I tried to use as much material ui component as possible such as the &lt;code&gt;CopyIcon&lt;/code&gt;, &lt;code&gt;Check&lt;/code&gt; icon, and some class components. For the share button, when a user clicks it, it will be changed to the check button. It also shows &lt;code&gt;tooltip&lt;/code&gt; to let user know what is happening. After adding the share button component, all I have to do is put it in both &lt;code&gt;Posts/PostInfo.tsx&lt;/code&gt; and &lt;code&gt;Posts/Post.tsx&lt;/code&gt;.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Third
&lt;/h3&gt;

&lt;p&gt;Pull request for third issue can be found &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2531"&gt;here&lt;/a&gt;&lt;br&gt;
This is my most commented pull request I've ever had. Because different people have different preferences so it's difficult to just make one that fits all. And after that, I also have struggle with aligning it properly in different screen sizes. After struggling with that, I also had to make eslint happy as new esline rules just got merged into the main branch. After a while, I thought I would have done but a problem with search bar occurred. The problem was found when I pull new code from upstream and force push to my branch. At first, I found I introduced the bug, so I spent way too much time figuring out how to fix it. I almost gave up but it turned out that my code before I pulled from upstream was working just fine, so I'd believe that it was not me who introduced the bug. After that, I also had to adjust &lt;code&gt;currentPost&lt;/code&gt; variable in order that it is &lt;code&gt;side effect&lt;/code&gt; free. &lt;/p&gt;

&lt;p&gt;This is the code that I added in &lt;code&gt;Posts/Timeline.tsx&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const firstLength = pages[0].length;
  const getCurrentPost = (pageIndex: number, postIndex: number): number =&amp;gt; {
    // this function takes 2 indexes from the 2-d posts array and length of the first array
    return pageIndex * firstLength + postIndex + 1;
  };

  const postsTimeline = pages.map((page, pageIndex): Array&amp;lt;ReactElement&amp;gt; | ReactElement =&amp;gt;
    page.map(({ id, url }, postIndex) =&amp;gt; {
      return (
        &amp;lt;PostComponent
          postUrl={url}
          key={id}
          currentPost={getCurrentPost(pageIndex, postIndex)}
          totalPosts={totalPosts}
        /&amp;gt;
      );
    })
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apart from that, it's just about getting &lt;code&gt;totalPosts&lt;/code&gt;, adjusting styling,...&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Contributing to Telescope project (part 2)</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Fri, 10 Dec 2021 15:20:29 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/contributing-to-telescope-project-part-2-1o6e</link>
      <guid>https://dev.to/tuanthanh2067/contributing-to-telescope-project-part-2-1o6e</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today, I'd like to talk about the process of contributing to an open source project on Github, which is &lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;🔭&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Process
&lt;/h2&gt;

&lt;p&gt;In this part, I mainly go through all issues that I've worked on and and a little introduction about what it is. And in part 3, I'll give more details about each issue and how I really feel about it.&lt;/p&gt;

&lt;p&gt;First issue:&lt;br&gt;
The issue can be found &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2240#event-5678707545"&gt;here&lt;/a&gt;. This issue was open for quite a long time and was resolved by one of contributors but as the project grew, people introduced the same issue over and over again, so the issue was open again. The issue was about moving from using &lt;code&gt;const fetch = require('node-fetch')&lt;/code&gt; to extract it from &lt;code&gt;@senecacdot/satellite&lt;/code&gt; as &lt;code&gt;satellite&lt;/code&gt; exposes it. &lt;/p&gt;

&lt;p&gt;Second issue:&lt;br&gt;
My second issue can be found &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2117"&gt;here&lt;/a&gt;&lt;br&gt;
Image using Telescope one day, and you find an interesting post and you want to share it with your friends but the process of going to the original url and copy the url is quite cumbersome, so I introduced a &lt;code&gt;share&lt;/code&gt; button which will help user to copy the origin url directly to the clipboard. Apart from that, This issue also contains another potential feature which is &lt;code&gt;bookmarking&lt;/code&gt; posts. In my opinion, this feature is quite cool and important as Telescope is about all &lt;code&gt;PULLING&lt;/code&gt; all blogs from different sites and different people and putting it in one place. One who likes a blog posted on dev.to by person a and a blog posted on medium.com by person b has no other way but going to original url's and signing up and saving it. What if we can make it way more easy for Telescope's users by implementing &lt;code&gt;bookmarking&lt;/code&gt; in Telescope. I already filed an issue for the idea which can be found &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2549"&gt;here&lt;/a&gt;. This may be another cool feature so I leave it for future students&lt;/p&gt;

&lt;p&gt;Third issue:&lt;br&gt;
My third issue can be found &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/1408"&gt;here&lt;/a&gt;&lt;br&gt;
This issue was open a year ago but doesn't seem to catch lots of other students' interest. This issue is about showing post count when users do a search. Without post count, user is just like a sailor without a compass. They just keep going and going but don't know where they're going exactly. The issue required me to not only figure out how to work with data returned back but also some styling. &lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SPO600 - Project Stage 1</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Tue, 07 Dec 2021 19:58:56 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/spo600-project-stage-1-1k5j</link>
      <guid>https://dev.to/tuanthanh2067/spo600-project-stage-1-1k5j</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin, and today I'd like to talk about my experience working on project stage 1, and some of the testing stuff as well as the performance of different types of algorithms.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the this project stage
&lt;/h2&gt;

&lt;p&gt;The project requires us to compile different algorithms to see if there's any difference between them. There's six programs that have been provided by the professor.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;vol0.c is the basic or naive algorithm. This approach multiplies each sound sample by the volume scaling factor, casting from signed 16-bit integer to floating point and back again. Casting between integer and floating point can be expensive operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;vol1.c does the math using fixed-point calculations. This avoids the overhead of casting between integer and floating point and back again.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;vol2.c pre-calculates all 65536 different results, and then looks up the answer for each input value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;vol3.c is a dummy program - it doesn't scale the volume at all. It can be used to determine some of the overhead of the rest of the processing (besides scaling the volume) done by the other programs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;vol4.c uses Single Instruction, Multiple Data (SIMD) instructions accessed through inline assembley (assembly language code inserted into a C program). This program is specific to the AArch64 architecture and will not build for x86_64.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;vol5.c uses SIMD instructions accessed through Complier Intrinsics. This program is also specific to AArch64.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My very first prediction was that vol0 would be the slowest because it has some castings, and vol1 will be faster than vol0, and vol3 will be the fastest. &lt;/p&gt;

&lt;h2&gt;
  
  
  Process
&lt;/h2&gt;

&lt;p&gt;First, I ran some tests on AArch64 architecture as well as x*4_64 architecture. The result it gave back to me was quite similar to each other though. &lt;/p&gt;

&lt;p&gt;But before actually running the program, I have to copy the folder to my current directory so that I don't need to move around too much and then I have to unzip the archive &lt;/p&gt;

&lt;p&gt;For copying to current directory I used&lt;br&gt;
&lt;code&gt;cp /public/spo600-volume-examples.tgz .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For unzipping the folder, I used&lt;br&gt;
&lt;code&gt;tar xvf spo600-volume-examples.tgz&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;Because I copied it to my current working directory, I can test it now in my current directory. Then, I would have to use a command which is called &lt;code&gt;make&lt;/code&gt; to build program.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Make&lt;/code&gt; will give me programs highlighted on &lt;code&gt;green&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;Then in order to invoke a program, I will have to just simply type the file name and then enter. &lt;/p&gt;

&lt;p&gt;This the test that I tried to run on AArch64 Architecture. I also run the same on x84_64 Architecture but the result was pretty much the same to each other. &lt;/p&gt;

&lt;p&gt;The screenshot below shows the results given back when I ran on AArch64 architecture. Some of the results (vol0, vol2l vol4, vol5) are the same at 481.&lt;/p&gt;

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

&lt;p&gt;Next, in order to know its performance, I have to run it with &lt;code&gt;time&lt;/code&gt; command.&lt;/p&gt;

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

&lt;p&gt;As we run programs with time, it gives us back a bunch of information: real, user, sys. From my perspective, Real and User are the same and all sys is O. &lt;code&gt;real&lt;/code&gt; is the total time that the command ran on the system while &lt;code&gt;user&lt;/code&gt; is the time it takes to execute the command on the users` side.&lt;/p&gt;

&lt;p&gt;After that, I use the command &lt;code&gt;free -m&lt;/code&gt; to check the relative memory usage of the program on my current machine.&lt;/p&gt;

&lt;p&gt;On AArch64 architecture&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j9RZo7Kw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pao3jfpdt2qiuoj0c8q0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j9RZo7Kw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pao3jfpdt2qiuoj0c8q0.png" alt="Image description" width="649" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On x86_64 architecture&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--29o-VVDf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7jtnglggmdpxwiynplh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--29o-VVDf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7jtnglggmdpxwiynplh.png" alt="Image description" width="647" height="71"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions found in program comments:
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
        for (x = 0; x &amp;lt; SAMPLES; x++) {&lt;br&gt;
                ttl=(ttl+out[x])%1000;&lt;br&gt;
        }&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
We have a loop right here to go through all &lt;code&gt;SAMPLES&lt;/code&gt; variables that we defined above. Then we have a calculation of (ttl + out[x]) then divide it with 1000 to get the remaining. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
printf("Result: %d\n", ttl);&lt;br&gt;
return 0;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt; &lt;br&gt;
The result of ttl will be printed here by using &lt;code&gt;printf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Q: What is the purpose of the cast to unint16_t in the next line?&lt;br&gt;
     precalc[(uint16_t) x] = (int16_t) ((float) x * VOLUME / 100.0);&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
Because we wanted to make sure that it is an unsigned 16-bit integer&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Q: What's the point of this dummy program? how does it help with benchmarking?&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
The dummy program will not scale the volume. And it helped different computer run the same program to test its performance.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Q: what is the purpose of these next two lines?&lt;br&gt;
        in_cursor = in;&lt;br&gt;
        out_cursor = out;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
The purpose of these two lines are to assign the input cursor to array in and output cursor to array out&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Q: should we use 32767 or 32768 in next line? why?&lt;br&gt;
     vol_int = (int16_t)(VOLUME/100.0 * 32767.0);&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
I think we should use 21767 because this is a 16 bit integer, the max value is 32767.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
Q: what does it mean to "duplicate" values in the next line?&lt;br&gt;
__asm__ ("dup v1.8h,%w0"::"r"(vol_int)); // duplicate vol_int into v1.8h&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
As I can understand, the duplicate will be stored in a vector, which will be like an array that has the same size. The duplicate will be stored in the dup v1.8h.&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Planning for my final release assignment</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Sat, 27 Nov 2021 20:16:53 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/planning-for-my-final-release-assignment-4be1</link>
      <guid>https://dev.to/tuanthanh2067/planning-for-my-final-release-assignment-4be1</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today, I'd like to talk a bit about my plan of what I'm going to with the final assignment in OSD600. &lt;/p&gt;

&lt;h2&gt;
  
  
  Plan
&lt;/h2&gt;

&lt;p&gt;I really feel like working on Telescope issues and stuff as the project's really potential and still has a lot of features waiting to be added. &lt;/p&gt;

&lt;p&gt;The reason why I don't choose an external project is because it's gonna take much of my time finding one, and I'm unsure that I can even complete it on time. So instead I go with Telescope because I'm familiar with some aspects of it and it has a great community and an awesome professor who's always willing to offer me support. &lt;/p&gt;

&lt;p&gt;Currently, I'm actively looking for issues that are relevant to &lt;strong&gt;ENHANCEMENT&lt;/strong&gt; OR &lt;strong&gt;FEATURE&lt;/strong&gt;, so it would be much of a work for me to do. &lt;/p&gt;

&lt;p&gt;One of another reason why I chose Telescope is because it's production ready and has a lot of technologies that are being used for production by many people. If I choose a random project that has a &lt;strong&gt;COOL&lt;/strong&gt; feature waiting to be implemented, I can of course give it a try but it may not have some really cool technologies that I'm looking for in a project. &lt;/p&gt;

&lt;p&gt;I just put my names in 2 two issues that are also &lt;strong&gt;ENHANCEMENT&lt;/strong&gt; for the project. The first one is about sharing posts and the second one is posts count in search. Yes, I mean they're small and not meeting the requirement. But I just finished a small fix and still looking for more issues. Apart from that, the sharing posts thing can be expanded more as I can add the feature &lt;strong&gt;BOOKMARK&lt;/strong&gt; posts for authenticated users so that I can come back and read. &lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Lab 5 - SPO600</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Sat, 27 Nov 2021 19:44:50 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/lab-5-spo600-4jkk</link>
      <guid>https://dev.to/tuanthanh2067/lab-5-spo600-4jkk</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today I'd like to talk about my experience of working with Loops in AArch64 and x86_64 Assembly. Stay tuned!&lt;/p&gt;

&lt;h2&gt;
  
  
  Progress
&lt;/h2&gt;

&lt;p&gt;For previous weeks, I got a chance to work with 6502 Assembly language which is quite not my interest but when moving to aarch64 and x86_64, I found it a little bit easier to understand! However, this is still difficult to our group. It requires a lot of thinking and we were struggling so hard to get it running correctly.&lt;/p&gt;

&lt;p&gt;Lab 5 instruction can be found &lt;a href="https://wiki.cdot.senecacollege.ca/wiki/SPO600_64-bit_Assembler_Lab"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For this lab, we're asked to extend the assembler program (both x86_64 and aarch64) to suppress the high digit when it is 0. In other words, the printed values should progress from 0-30 instead of from 00-30. It is ok to output a space in place of the suppressed digit (this will cause the numbers to be aligned vertically in the output)&lt;/p&gt;

&lt;p&gt;For this lab, instead of using an emulator that we've been using for the last couple weeks, we're now using Linux to build and run the program. &lt;/p&gt;

&lt;p&gt;In order to compile an assembly file, we had to run two commands. In this case, we have a file name &lt;code&gt;helloWorld.s&lt;/code&gt; so we have to use this command &lt;code&gt;as -g -o helloWorld.o helloWorld.s&lt;/code&gt; to compile it. And then we have to take our helloWorld.o file and link it using this command &lt;code&gt;ld -o helloWorld helloWorld.o&lt;/code&gt; and then we can actually run our program using this command &lt;code&gt;./helloWorld&lt;/code&gt;. This is quite a heavy step but it is what it is. Normally this is we have to do under the hood but visual studio or other IDMs have taken care for us. If you're trying hardcore and using command line completely, you may feel like using this.&lt;/p&gt;

&lt;p&gt;After taking a look at files supplied, we started to start writing some codes to see what's going to happen. The professor gave us two code files including a file for loop and a file for printing out &lt;code&gt;hello world&lt;/code&gt; string. So we did some experiment and we got this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
.text
.globl _start

min = 0                          /* starting value for the loop index; note that this is a symbol (constant), not a variable */
max = 30                         /* loop exits when the index hits this number (loop condition is i&amp;lt;max) */

_start:
        mov     x19, min
        mov     x0, 0           /* status -&amp;gt; 0 */

loop:
        mov     x0, 1           /* file descriptor: 1 is stdout */
        adr     x1, msg         /* message location (memory address) */
        mov     x2, len         /* message length (bytes) */

        mov     x8, 64          /* write is syscall #64 */
        svc     0               /* invoke syscall */

    add     x19, x19, 1
        cmp     x19, max
        b.ne    loop

        mov     x0, 0           /* status -&amp;gt; 0 */
        mov     x8, 93          /* exit is syscall #93 */
        svc     0               /* invoke syscall */

.data
        msg:    .ascii      "Hello, world!!!\n"
        len=    . - msg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next task is that we have to use loop in order to print a given string N times. So we're thinking about storing the value of 0 (the min value) into x19 and 0 into x0. Then, we added the file descriptor to x0, memory address of the message to x1, and the length of message to x2.&lt;/p&gt;

&lt;p&gt;This is the final code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.text
.globl _start

min = 0                          /* starting value for the loop index; note that this is a symbol (constant), not a variable */
max = 31                         /* loop exits when the index hits this number (loop condition is i&amp;lt;max) */
ten = 10
_start:

        mov     x19, min
        mov     x17, ten
        mov     x0, 0           /* status -&amp;gt; 0 */

loop:
        mov     x0, 1           /* file descriptor: 1 is stdout */
        adr     x1, msg         /* message location (memory address) */
        mov     x2, len         /* message length (bytes) */

        mov     x18, x19        /*mov x19 into x18 */
        udiv    x9, x18, x17
        add     x13, x9, 0x30   /*convert quotient into char*/

        msub    x10, x9, x17, x18 /*get remainder*/
        add     x14, x10, 0x30  /* add value at x10 and 0x30, and store in x14 */
        adr     x15, msg        /* put address of msg into x15 */
        strb    w13, [x15, 8]   /* storing the byte that is at 14 into x15, 8 spaces over, which is 8 spaces over from the msg string */

        strb    w14, [x15, 9]   /* storing the byte that is at 14 into x15, 9 spaces over, which is 9 spaces over from the msg string */
        mov     x8, 64          /* write is syscall #64 */
        svc     0               /* invoke syscall */

        add     x19, x19, 1
        cmp     x19, max
        b.ne    loop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;The actual work took us a lot of time and effort as nobody is familiar with this before, so it means we have to learn everything from scratch. &lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Publishing my package to NPM</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Thu, 25 Nov 2021 19:17:05 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/publishing-my-package-to-npm-4f22</link>
      <guid>https://dev.to/tuanthanh2067/publishing-my-package-to-npm-4f22</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today, I'd like to talk about my experience of publishing my static site generator to NPM. It's quite a fun experience as I finally made my project up and running in public.&lt;/p&gt;

&lt;h2&gt;
  
  
  Process
&lt;/h2&gt;

&lt;p&gt;I've used &lt;a href="https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry"&gt;this&lt;/a&gt; as instruction to publish it to NPM.&lt;/p&gt;

&lt;p&gt;You can check it out &lt;a href="https://www.npmjs.com/package/cv-ssg"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because I already built my project for quite a long time so, I can skip most of the steps, and just focus on &lt;a href="https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages"&gt;this&lt;/a&gt; step and some steps that help me understand the semantic versioning and dist-tags. &lt;/p&gt;

&lt;p&gt;When I first start using command line &lt;code&gt;npm publish&lt;/code&gt; to publish the project, I had to sign up and log in to NPM. But I encountered an error where it said something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/cv-ssg - Forbidden
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As it stated right there, the error code is 403 which means it involved sign up or log in part. After a few minutes, I just realized that I forgot to verify email. So just make sure that if this is your first time publishing a project to npm, you have your email verified.&lt;/p&gt;

&lt;p&gt;While working with updating version stuff, I also had to delete e2e snapshot file and run it again because when I changed the version in the &lt;code&gt;package.json&lt;/code&gt;, and pushed the repo to github, the github action won't be happy. I'm not sure if I'm doing the right way that other people do. If I don't, please show me. Thank you.&lt;/p&gt;

&lt;p&gt;I tried to test it as a client's perspective by installing Nodejs and then I do &lt;code&gt;npm install -g cv-ssg&lt;/code&gt; to install it globally so that I can run it anywhere I like. As expected, it worked very well, I got no error. Or maybe I'm just testing the bright side of the project. &lt;/p&gt;

&lt;p&gt;In order to tackle that problem, I got one of my friend who is also a student of this course to test it out on his computer. Fortunately, he also ran it successfully a few times using &lt;code&gt;cv-ssg&lt;/code&gt; command.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;For this lab, it didn't require us to code anything as this is like a final step for the project, not quite the final one because if the project is delivered to end users and they found bugs or errors. It needs to be fixed and published again. The cycle keeps going and going.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Reviewing Github pull requests - OSD600</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Fri, 19 Nov 2021 23:14:05 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/reviewing-github-pull-requests-osd600-46mh</link>
      <guid>https://dev.to/tuanthanh2067/reviewing-github-pull-requests-osd600-46mh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today, I'd like to talk about my experience of reviewing other people's code. &lt;/p&gt;

&lt;h2&gt;
  
  
  Progress
&lt;/h2&gt;

&lt;p&gt;In my recent pull request, it was actually one pull request broken into 2 small parts for 2 people, me and one of my friend. The issues needed to be solved are quite relevant to each other, so we would know what problem each other's having and facing right now. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2476"&gt;My friend's pull request&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2471#issuecomment-974373488"&gt;My pull request&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The experience was fantastic as I got to talk with a lot of great developers and learn more from them. Reviewing is also a way to improve each other's code as nobody's code is perfect and it needs to be tested and run multiple times by multiple people. &lt;/p&gt;

&lt;p&gt;As I said, these 2 pull requests are relevant to each other and it should have the same coding style as if one made it. &lt;/p&gt;

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

&lt;p&gt;This is the problem I've mentioned in my previous blog when &lt;code&gt;window.onload&lt;/code&gt; should be changed as it would override the other one. Thanks to reviewing other people's code, I also benefit from it.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my blog, reviewing code is another good way of learning new things and help each other produce better code.&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>OSD600 - Release 0.3 - Second Pull Request</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Fri, 19 Nov 2021 20:25:37 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/osd600-release-03-second-pull-request-3b5</link>
      <guid>https://dev.to/tuanthanh2067/osd600-release-03-second-pull-request-3b5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today I'd like to talk about one of my pull requests in &lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;Telescope&lt;/a&gt; project. &lt;/p&gt;

&lt;h2&gt;
  
  
  Progress
&lt;/h2&gt;

&lt;p&gt;Instead of choosing another project to work on, I decided to go with Telescope again because why not?. This is also an external project and can compete with other open source projects. &lt;/p&gt;

&lt;p&gt;My second pull request was about showing the feeds count on a status report webpage, which is up and running &lt;a href="https://dev.api.telescope.cdot.systems/v1/status"&gt;here&lt;/a&gt;. If you go to the page, you could see total feeds displaying right there below commit count card. &lt;/p&gt;

&lt;p&gt;This issue proposed a lot of problems as this is a completely new feature and nobody has touched the code before. &lt;/p&gt;

&lt;p&gt;First, I ran into a problem with base url so I had to disable a couple lines to get it work properly on my local. After solving that problem, I had another one which I was not able to extract &lt;code&gt;x-total-count&lt;/code&gt; from header because the posts api didn't expose headers for some reason. In order to get it work, I added &lt;code&gt;cors: { exposedHeaders: ['X-Total-Count', 'Link'] }&lt;/code&gt; which basically means expose x-total-count in header so that I can access it. &lt;/p&gt;

&lt;p&gt;However, I just saw another potential bug which may happen when someone uses &lt;code&gt;window.onload()&lt;/code&gt;, which may be resolved by the time you read this blog, but I'll have a discussion with other people to see how they'd like it to be.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;apiHost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;getFeedCount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;apiHost&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/v1/posts/feeds`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;HEAD&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;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;feedCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-total-count&lt;/span&gt;&lt;span class="dl"&gt;'&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;feedCountElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;feeds-count&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;feedCountElement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;feedCount&lt;/span&gt; &lt;span class="p"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;N/A&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;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&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;err&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="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&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="nx"&gt;getFeedCount&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;For the last 3 lines, &lt;code&gt;window.onload()&lt;/code&gt; should be changed to &lt;code&gt;window.addEventListener('load')&lt;/code&gt; in order that the main &lt;code&gt;window.onload()&lt;/code&gt; won't be override accidentally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;This is actually interesting and I've learnt a lot from it. Not only the code I wrote but how an issue, and a pull request on Github will be treated and how to work with Git correctly. Although this is not a big pull request, but I'm proud of what I've done.&lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>OSD600 - Release 0.3 - First Pull Request</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Fri, 19 Nov 2021 18:16:03 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/osd600-release-03-first-pull-request-2jgi</link>
      <guid>https://dev.to/tuanthanh2067/osd600-release-03-first-pull-request-2jgi</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin. Today I'd like to talk about my experience working with &lt;a href="https://github.com/Seneca-CDOT/telescope"&gt;Telescope project&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Progress
&lt;/h2&gt;

&lt;p&gt;As I was going through issues in Telescope project, I found an issue that was not very difficult so that I can get to know the project a bit more and learn something out of it. So I chose to go with &lt;a href="https://github.com/Seneca-CDOT/telescope/issues/2449#event-5607125522"&gt;this issue&lt;/a&gt;, which is about adding border for github avatars.&lt;/p&gt;

&lt;p&gt;Looking at the issue and thinking about it, It'd be easy to do as I only had to add a couple lines css code, but no. Because telescope has 2 different theme colors which are dark and light. So I had to add another interface to the PaletteOptions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as createPalette from '@material-ui/core/styles/createPalettes';

declare module '@material-ui/core/styles/createPalette' {
  interface PaletteOptions {
    border?: PaletteColorOptions;
  }

  interface Palette {
    border: PaletteColor;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So that I could make my own border attribute in createTheme object&lt;/p&gt;

&lt;p&gt;for light theme&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;border: {
      main: 'rgba(27,31,36,0.15)',
    },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for dark theme&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;border: {
      main: 'rgba(240,246,252,0.1)',
    },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, there was an embarrassing moment where I didn't notice that github isn't using &lt;code&gt;border:&lt;/code&gt; for the border around their avatars but a &lt;code&gt;box-shadow&lt;/code&gt;. I literally &lt;em&gt;stoled&lt;/em&gt; their color code but it still didn't show as github. It took me a decent amount of time to realize it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapup
&lt;/h2&gt;

&lt;p&gt;This is a beginner-friendly issue so it's totally easy but gives me a bit more foundation to try something bigger and harder in this project. Of course, this is a very small thing in a humongous project but I got it working and merged into the main branch, I'm very happy for that.&lt;/p&gt;

&lt;p&gt;You can find my pr right &lt;a href="https://github.com/Seneca-CDOT/telescope/pull/2450"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
    </item>
    <item>
      <title>Adding Github Actions CI Workflow</title>
      <dc:creator>Tuan Thanh Tan</dc:creator>
      <pubDate>Thu, 18 Nov 2021 03:19:17 +0000</pubDate>
      <link>https://dev.to/tuanthanh2067/adding-github-actions-ci-workflow-429p</link>
      <guid>https://dev.to/tuanthanh2067/adding-github-actions-ci-workflow-429p</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello everyone, my name is Dustin, today I'd like to talk about my experience working with Github Actions and some testings in Javascript.&lt;/p&gt;

&lt;h2&gt;
  
  
  At a glance
&lt;/h2&gt;

&lt;p&gt;Github Actions was easy to set up as it's written beforehand, I just needed to remove 1 line of building step because I don't need it yet. But making my code to run and pass all 3 node versions was quite difficult. I ran into trouble a lot of times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Progress
&lt;/h2&gt;

&lt;p&gt;First, I decided to migrate from &lt;a href="https://www.npmjs.com/package/commander"&gt;Commander&lt;/a&gt; to &lt;a href="https://www.npmjs.com/package/yargs"&gt;Yargs&lt;/a&gt; in order to make the code clearer. And then I added some more tests for the e2e test to make sure that help option and version option are working as I expected. As I was running the tests, I found out there's some errors happening and needed to be fixed as soon as possible. So I created a separate branch to fix it. The problem involved &lt;code&gt;resolve&lt;/code&gt; variable in promise because I accidentally added curly braces around them. As I progressed, I decided to clean up my code a little bit more so I moved from using sync functions to async functions in the &lt;code&gt;produceFolder&lt;/code&gt; class. &lt;/p&gt;

&lt;p&gt;After that, I pushed the code to my repo, and it seemed like Github wasn't very happy with my &lt;code&gt;package-lock.json&lt;/code&gt; and &lt;code&gt;__snapshots__&lt;/code&gt; for some reason. So I had to &lt;code&gt;npm install&lt;/code&gt; and delete &lt;code&gt;__snapshots__&lt;/code&gt; and run the test again. &lt;/p&gt;

&lt;p&gt;What I have for my github actions is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Node.js CI&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;main&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;main&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

    &lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;matrix&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;node-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;12.x&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;14.x&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;16.x&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
        &lt;span class="c1"&gt;# See supported Node.js release schedule at https://nodejs.org/en/about/releases/&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Use Node.js ${{ matrix.node-version }}&lt;/span&gt;
      &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-node@v2&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;node-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ matrix.node-version }}&lt;/span&gt;
        &lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;npm'&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm ci&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unfortunately, it was only successful on the first 2 node versions, not the 16 one due to &lt;code&gt;rm&lt;/code&gt; and &lt;code&gt;mkdir&lt;/code&gt;. There was also a problem with &lt;code&gt;rmdir&lt;/code&gt; because in Node 16, If I remember correctly, it won't be supported anymore so I had to only use &lt;code&gt;mkdir&lt;/code&gt; to create a folder. I also had to add &lt;code&gt;{recursive: true}&lt;/code&gt; just in case the folder already exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;After a day struggling, I've successfully passed all 3 tests from Github actions and I've learnt a lot from it, especially using Git.&lt;/p&gt;

&lt;p&gt;My testing still needs to be improved as it just covers some basics, not every edge case because testing takes a lot of time and thinking. More testing will be added later. &lt;/p&gt;

</description>
      <category>github</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
