<?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: Liu Yu Zhou</title>
    <description>The latest articles on DEV Community by Liu Yu Zhou (@jacobliu).</description>
    <link>https://dev.to/jacobliu</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%2F483897%2Fe26faf3d-f479-4117-88de-17177602004b.png</url>
      <title>DEV Community: Liu Yu Zhou</title>
      <link>https://dev.to/jacobliu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jacobliu"/>
    <language>en</language>
    <item>
      <title>How Strapi triggers Nuxt static site generation for S3 bucket</title>
      <dc:creator>Liu Yu Zhou</dc:creator>
      <pubDate>Mon, 26 Apr 2021 15:10:56 +0000</pubDate>
      <link>https://dev.to/jacobliu/how-strapi-triggers-nuxt-static-site-generation-for-s3-bucket-1fg6</link>
      <guid>https://dev.to/jacobliu/how-strapi-triggers-nuxt-static-site-generation-for-s3-bucket-1fg6</guid>
      <description>&lt;p&gt;I have been working on ecommerce website, we just suppose to build the website as operational.&lt;/p&gt;

&lt;h2&gt;
  
  
  I choose Strapi and Nuxt, Algolia for search engine
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Strapi&lt;/strong&gt; is headless CMS, open-source, provides the large-scale of APIs without hard-coding.&lt;br&gt;
&lt;strong&gt;Nuxt&lt;/strong&gt; is SSR vue.js based framework, useful for pre-rendered pages for ecommerce.&lt;br&gt;
&lt;strong&gt;Algolia&lt;/strong&gt; is client-side search engine, very impressive tool to make high traffic in business.&lt;/p&gt;
&lt;h2&gt;
  
  
  The infrastructure I use
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Source repositories on &lt;em&gt;Github&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Strapi on AWS &lt;em&gt;EC2&lt;/em&gt; instance&lt;/li&gt;
&lt;li&gt;Nuxt on AWS &lt;em&gt;S3&lt;/em&gt; bucket&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  The things I need
&lt;/h2&gt;

&lt;p&gt;The static website should be generated again when &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The developer commit the code updates.&lt;/li&gt;
&lt;li&gt;The author upload own product.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  How did I tweak the problems
&lt;/h2&gt;

&lt;p&gt;I solved all problems with GitHub Actions, it is the great tool for CI/CD.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt; SSG : The developer commit the code updates.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It involves several steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Specify when the github action should be trigger&lt;/li&gt;
&lt;li&gt;Configure AWS Credentials&lt;/li&gt;
&lt;li&gt;Create ENV files&lt;/li&gt;
&lt;li&gt;Cache Packages&lt;/li&gt;
&lt;li&gt;Install Packages&lt;/li&gt;
&lt;li&gt;Generate Static Pages&lt;/li&gt;
&lt;li&gt;Deploy website on S3 bucket&lt;/li&gt;
&lt;li&gt;Cloudfront Invalidation&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;&amp;gt; SSG: The author upload own product.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is the tricky,&lt;/strong&gt; I was stuck on this for couple of days.&lt;br&gt;
There should be something to trigger S3 updates from Strapi,&lt;br&gt;
I had researched the solutions and found that Netlify is the best solution because it provides build hook for CI/CD.&lt;br&gt;
However, I wanted to take the challenge and decided not to use Netlify. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;How can I achieve the same behavior without Netlify, keep S3 bucket?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Make the custom node app for webhook&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After a while, I noticed that Github has REST APIs to control resources. I can dispatches APIs to certain repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.github.com/repos/{ORG_NAME}/{REPO_NAME}/dispatches
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This is the key.&lt;br&gt;
In this node app, we just set headers to call github APIs.&lt;br&gt;
I named the event as &lt;em&gt;ssg&lt;/em&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 postData = Buffer.from(
  JSON.stringify({
    event_type: "ssg",
  })
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;headers: {
    Authorization: "token *****************",
    Accept: "application/vnd.github.everest-preview+json",
    "Content-Type": "application/json",
    "Content-Length": Buffer.byteLength(postData),
    "User-Agent": "nodejs request",
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Finally, upload nodejs app on EC2 instance. Here is the completed code.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Configure CI/CD script&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Configure script to listen dispatch events from node app.&lt;br&gt;
Github action listens the nodejs app request and regenerate the static website, deploy updates on S3.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: CI/CD
on:
  repository_dispatch:
    types: ssg
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Register webhook in Strapi dashboard&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Register webhook on EC2 in Strapi dashboard&lt;/p&gt;

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

&lt;p&gt;That's all, long journey. Thanks for joining me. :)&lt;/p&gt;

</description>
      <category>strapi</category>
      <category>nuxt</category>
      <category>github</category>
      <category>webhook</category>
    </item>
    <item>
      <title>10 common mistakes that beginner programmers make.
</title>
      <dc:creator>Liu Yu Zhou</dc:creator>
      <pubDate>Mon, 21 Dec 2020 14:07:18 +0000</pubDate>
      <link>https://dev.to/jacobliu/10-common-mistakes-that-beginner-programmers-make-2a8n</link>
      <guid>https://dev.to/jacobliu/10-common-mistakes-that-beginner-programmers-make-2a8n</guid>
      <description>&lt;h1&gt;
  
  
  1- Start with fear.
&lt;/h1&gt;

&lt;p&gt;The first and worst mistake that novice programmers make is that they go for programming with fear and chills and hit their first code with skepticism.&lt;/p&gt;

&lt;p&gt;For some people who have just started programming, there may be a lot of questions and mental conflicts.&lt;/p&gt;

&lt;p&gt;Am I as smart enough?&lt;br&gt;
Am I the right person for programming?&lt;br&gt;
Can I make money from money?&lt;/p&gt;

&lt;p&gt;We believe anyone can learn programming. Provided that it starts with confidence and sticks rigidly to the job.&lt;/p&gt;

&lt;h1&gt;
  
  
  2- They only rely on study and education.
&lt;/h1&gt;

&lt;p&gt;Programming is different from disciplines such as literature, philosophy and logic, psychology, geography and other humanities.&lt;/p&gt;

&lt;p&gt;Some disciplines only require theoretical study, and someone who wants to succeed in these trends should have a lot of study, but programming is a technical job.&lt;/p&gt;

&lt;p&gt;Just as a mathematician can't solve a variety of problems just by reading formulas, the programmer can't just become an experienced programmer by studying and seeing other people's code.&lt;/p&gt;

&lt;p&gt;So at the start, you have to learn that a large part of your skills come from real projects while working and while working.&lt;/p&gt;

&lt;h1&gt;
  
  
  3- Re-build the wheel.
&lt;/h1&gt;

&lt;p&gt;Currently, there are different libraries and frameworks for programming languages.&lt;/p&gt;

&lt;p&gt;Although it is not recommended to go directly to frame words or libraries at the beginning, using some tools can help a lot.&lt;/p&gt;

&lt;p&gt;For example, when you start web programming and are learning html and css, you can go to frame words like Bootstrap to build different parts of your site.&lt;/p&gt;

&lt;p&gt;This way you can implement your menu, buttons, lists, logo and other elements of your web page without much hassle.&lt;/p&gt;

&lt;h1&gt;
  
  
  4- They care too much about the details.
&lt;/h1&gt;

&lt;p&gt;Paying attention to detail and caring about all the big points of the project is a good ethic, but not at the beginning, no one at the beginning expects you to design an incredibly stable service without bugs alone.&lt;/p&gt;

&lt;p&gt;Even great programmers have difficulty in the project's peddies.&lt;/p&gt;

&lt;p&gt;If some details don't work properly when learning and the Nubian program, try to get past them and go back to them later.&lt;/p&gt;

&lt;p&gt;Stuck in the details of the project and forgetting the main goal can work early, discourage you and keep you from continuing the way.&lt;/p&gt;

&lt;h1&gt;
  
  
  5- They think they have found the best programming language in the world.
&lt;/h1&gt;

&lt;p&gt;Usually, those who start programming recently regularly ask themselves and others which programming language is best and which language to learn.&lt;/p&gt;

&lt;p&gt;This question has problems from the root, and you need to get it out of your head first.&lt;/p&gt;

&lt;p&gt;If you take a look at old and experienced programmers, you'll see that they don't talk heat anymore.&lt;/p&gt;

&lt;p&gt;In fact, these programmers have reached the necessary cooking and know very well that any language can be great, if used properly.&lt;/p&gt;

&lt;p&gt;So at the start, trust the language you've chosen and let the work go a little further.&lt;/p&gt;

&lt;h1&gt;
  
  
  6- They code a line or two a day.
&lt;/h1&gt;

&lt;p&gt;Suppose the greatest writers in the world wrote two two clauses a day or so. Then be sure that there was no more "Battle of Wasulah" or "Blind Buff".&lt;/p&gt;

&lt;p&gt;In programming, the situation is exactly the same.&lt;/p&gt;

&lt;p&gt;If you have decided to be a programmer, you must also accept the difficulties and practices of the first job.&lt;/p&gt;

&lt;p&gt;You have to spend a lot of time practicing and coding every day.&lt;/p&gt;

&lt;p&gt;No Nosi program has become an expert code line one day.&lt;/p&gt;

&lt;p&gt;Many old and experienced programmers are programming at home even after their working hours are finished in a company that is busy.&lt;/p&gt;

&lt;p&gt;So you have to practice a lot at the start.&lt;/p&gt;

&lt;h1&gt;
  
  
  7- Do not choose good names for variables, classes and functions.
&lt;/h1&gt;

&lt;p&gt;You may have laughed in the name of the long classes and functions that exist in the Java language.&lt;/p&gt;

&lt;p&gt;However, writing descriptive and long variables contributes greatly to the readableness of the program.&lt;/p&gt;

&lt;p&gt;Using similar names can confuse you during the project.&lt;/p&gt;

&lt;p&gt;Don't forget that your app may be available to other people later, so get used to documenting and writing variables correctly.&lt;/p&gt;

&lt;p&gt;Do not use english and Persian composition in any way.&lt;/p&gt;

&lt;p&gt;Over time and by practicing, you can also achieve the best structure for coding by realizing your own tastes.&lt;/p&gt;

&lt;h1&gt;
  
  
  8- Or they don't use comments, or they use it too much.
&lt;/h1&gt;

&lt;p&gt;Any programming language allows you to comment on parts of your code.&lt;/p&gt;

&lt;p&gt;These comments are ignored and not executed by a compiler or interpreter.&lt;/p&gt;

&lt;p&gt;They only show the function of that part of the code, or they're a note from the developer.&lt;/p&gt;

&lt;p&gt;Using comments correctly can make your code so readable that you'll find out how good the legi reader code is later in teamwork.&lt;/p&gt;

&lt;p&gt;But some programmers don't use this powerful tool at all at first.&lt;/p&gt;

&lt;p&gt;Some programmers also fall from the other part of the canvas and bombard their code with comments that read it.&lt;/p&gt;

&lt;h1&gt;
  
  
  9. They do not understand the true power of their language.
&lt;/h1&gt;

&lt;p&gt;This problem is not just about beginner programmers, and even sometimes experienced programmers forget the power of their programming language.&lt;/p&gt;

&lt;p&gt;Of course, beginner programmers should not be blamed too much for this. Because to understand the magnitude and magnitude of the programming language they work with, it requires a few years of experience and time.&lt;/p&gt;

&lt;p&gt;For example, languages like JavaScript are extremely flexible and in different sections such as site design, game making, mobile application construction, etc. Is used.&lt;/p&gt;

&lt;h1&gt;
  
  
  10. They do not back up their work.
&lt;/h1&gt;

&lt;p&gt;I must have said, "I've spent a few hours doing this, but all my files have been destroyed" can destroy a programmer's day although it's total.&lt;/p&gt;

&lt;p&gt;Fortunately, today there are a variety of tools with which you can save your files somewhere other than your computer.&lt;/p&gt;

&lt;p&gt;In this case, if your computer is damaged, there is still no danger to your code.&lt;/p&gt;

&lt;p&gt;The Data Control Version system, such as GitLab, helps software developers to get a history of code they have already written, in addition to participating in software projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Results:&lt;/strong&gt;&lt;br&gt;
Of course, programming is not a night job.&lt;/p&gt;

&lt;p&gt;One cannot go through the 100-year-old overnight and expect to get to a job like programming without trying.&lt;/p&gt;

&lt;p&gt;Now that you have chosen programming as your profession, it is better to know some of the common mistakes of beginners first so that you don't get caught up in these mistakes.&lt;/p&gt;

&lt;p&gt;If you feel that another item should have been added to this list, share it with us in the comments section.&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>5 Reasons to Choose NoSQL Databases</title>
      <dc:creator>Liu Yu Zhou</dc:creator>
      <pubDate>Mon, 21 Dec 2020 13:47:11 +0000</pubDate>
      <link>https://dev.to/jacobliu/5-reasons-to-choose-nosql-databases-3m4a</link>
      <guid>https://dev.to/jacobliu/5-reasons-to-choose-nosql-databases-3m4a</guid>
      <description>&lt;p&gt;A growing business faces many challenges and opportunities, so it needs to plan for its future. Some tools and technologies are unique to today and may not work in the future. Choosing the right database is also important, which has become a challenging decision for organizations. This choice is very effective in your application architecture.&lt;/p&gt;

&lt;p&gt;Suppose you have chosen a database for your current application that meets your needs due to the small number of users, but what happens after a few years and users increase? As the number of users grows and the data that needs to be saved, the scalability issue and several other problems arise in your app.&lt;/p&gt;

&lt;p&gt;If your site is unable to respond to this volume of users, your business will be at risk and even may, your business experience failure. Finally, you need to spend more time, time and money to prevent these things from happening and replace your program's infrastructure.&lt;/p&gt;

&lt;p&gt;Well, in this section, programmers always make arguments for choosing the best database of which database is more suitable for the program than the relationship and non-relational types. Both databases can store information but the difference is in how they are built, the type of information they store, and how they store information.&lt;/p&gt;

&lt;p&gt;In this paper, scenarios will be discussed in which the advantages of non-related database are discussed. In addition, there are some NoSQL features, but keep in mind that there is no technology or database that is suitable for everything.&lt;/p&gt;

&lt;p&gt;So to choose any technology, you first need to answer a few important questions about the needs of your program. The answers to these questions will help you understand your needs and you can find out if NoSQL meets your app's needs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can your app continue service as the number of users grows?&lt;/li&gt;
&lt;li&gt;To respond to users' activities and requests, does your app need to change the scale?&lt;/li&gt;
&lt;li&gt;How much money and time is saved by 0% Downtime?&lt;/li&gt;
&lt;li&gt;Does your program use rapid development cycles? (Flexible data model)&lt;/li&gt;
&lt;li&gt;Does your program create huge amounts of data?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's talk about the 5 most important features of NoSQL databases, here's where you can decide better:&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Multi-Model
&lt;/h1&gt;

&lt;p&gt;Relational databases store data in a predefined structure. That is, you have to define your data structure in terms of how to place in tables and columns from the time you start development, and you need to change the structure whenever circumstances change. All of this leads to the creation of new columns, the definition of new relationships, reflecting new changes in the application, talking to database managers, etc. Will.&lt;/p&gt;

&lt;p&gt;The NoSQL database provides more flexibility for data processing. There is no need to specify schema to get started. Also, the NoSQL database does not limit the type of data you can store side by side. Allows you to enter new data into the database depending on your needs. These are the reasons that make NoSQL suitable for agility developments that require faster implementation.&lt;/p&gt;

&lt;p&gt;Developers and architects choose NoSQL to easily manage and manage data for various application development requirements.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Easy Scalable
&lt;/h1&gt;

&lt;p&gt;Easy scalability is the main reason for choosing a NoSQL database. Well, we have to say that relational databases can also be scalable, but neither easily nor at a lower cost. Relational databases are based on the traditional concept of architecture, master-slave.&lt;/p&gt;

&lt;p&gt;Increasing the scale means you need to install more processors, RAM and hard drives to increase capacity and load management to upgrade your servers. Maybe instead of a very large server, split databases in smaller pieces on multiple hardware servers. This is called Sharding, which is very complicated in relational databases, and here you need to think about changing your databases to prevent time from being damaged. These things have become a big problem for developers and architects.&lt;/p&gt;

&lt;p&gt;The NoSQL database is masterless and peer-to-peer architecture. The data is balanced in several nodes in one cluster and distributed as pre-ferres. This makes it possible to achieve scalability without spending any particular time. By executing a few simple commands, we can add the new server to the cluster.&lt;/p&gt;

&lt;p&gt;This scalability also improves performance, allowing for continuous access, very high reading and writing speeds.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Distributed
&lt;/h1&gt;

&lt;p&gt;Relational databases are designed to be used in a centralized way and dependent on a specific location, but the NoSQL database is designed to be distributed globally, using several different locations, including multiple datacenters or cloud services, for reading and writing operations.&lt;/p&gt;

&lt;p&gt;This database has many advantages with its masterclass architecture. Data can always be available, as data is distributed with different copies where necessary.&lt;/p&gt;

&lt;h1&gt;
  
  
  4. Frequency and Down Time Zero
&lt;/h1&gt;

&lt;p&gt;What will happen if the hardware breaks down? NoSQL is also designed to address these types of critical situations. Hardware failure while developing an app is a serious concern and requires developers, database managers and finally various operations to fix this problem. You can use NoSQL databases instead of tackling these problems.&lt;/p&gt;

&lt;p&gt;The masterclass architecture in NoSQL allows several copies of data to be preserved in different nodes. If a node is out of reach, another node will have a copy of the data for easy and quick access. All of this makes the NoSQL database work without hurting the business. It is also very cost-effective for those who consider the cost of Down Time.&lt;/p&gt;

&lt;h1&gt;
  
  
  5. Apps that interact with Big Data
&lt;/h1&gt;

&lt;p&gt;The NoSQL database can handle huge amounts of data very quickly, which is why it is very suitable for programs dealing with Big Data. NoSQL databases ensure that other components of your app are seamlessly and quickly designed and can do well with massive data.&lt;/p&gt;

&lt;p&gt;As we've said about many of the features and advantages of using the NoSQL database, you should consider that it doesn't fit for all apps. So there are some strengths and weaknesses on the other side, and you need to check the nature of your plan to select a database. Some projects are better developed with sql databases, while others work well with NoSQL, and both can be used in some cases.&lt;/p&gt;

&lt;p&gt;If you save transaction data then SQL comes to your job. Relationship databases are created to process transactions and work well in this respect. If your data is analytical, then you need to think about NoSQL, the SQL database in data analysis, and working with massive data becomes a serious problem. &lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
    </item>
    <item>
      <title>How did I make a Simple Interactive Circular Chart - 1</title>
      <dc:creator>Liu Yu Zhou</dc:creator>
      <pubDate>Wed, 07 Oct 2020 01:31:20 +0000</pubDate>
      <link>https://dev.to/jacobliu/how-did-i-make-a-simple-interactive-circular-chart-1-1lc0</link>
      <guid>https://dev.to/jacobliu/how-did-i-make-a-simple-interactive-circular-chart-1-1lc0</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wc3wVk7h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ilr51pre6zyyf49epoh5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wc3wVk7h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ilr51pre6zyyf49epoh5.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Draw Arc Lines
&lt;/h3&gt;

&lt;p&gt;First of all, you need to draw Arcs to form up a circular chart.&lt;br&gt;
There is a mathematical theory to draw polar points.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function polarToCartesian(centerX, centerY, radius, angleInDegrees) { // Point of Polar
  var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;

  return {
    x: centerX + (radius * Math.cos(angleInRadians)) + setViewportX,
    y: centerY + (radius * Math.sin(angleInRadians)) + setViewportY
  };
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then draw the start and endpoints of the Arc with radius, call describeArc() method to finish drawing Arc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function describeArc(x, y, radius, startAngle, endAngle) {
  var start = polarToCartesian(x, y, radius, endAngle);                                                                              
  var end = polarToCartesian(x, y, radius, startAngle);

  var largeArcFlag = endAngle - startAngle &amp;lt;= 180 ? "0" : "1";

  var d = [
    "M", start.x, start.y, 
    "A", radius, radius, 0, largeArcFlag, 0, end.x, end.y
  ].join(" ");

  return d;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The title of each section of the circle has an order - Clockwise and vice versa.&lt;br&gt;
As a result, you need to define the flag for direction.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>webdev</category>
      <category>ux</category>
    </item>
  </channel>
</rss>
