<?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: QLabs</title>
    <description>The latest articles on DEV Community by QLabs (@quantalabs).</description>
    <link>https://dev.to/quantalabs</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%2F519857%2Fcec8d221-0654-4624-a550-d3079625483e.png</url>
      <title>DEV Community: QLabs</title>
      <link>https://dev.to/quantalabs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/quantalabs"/>
    <language>en</language>
    <item>
      <title>Setting Up and Configuring WSL</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Wed, 28 Jul 2021 20:51:25 +0000</pubDate>
      <link>https://dev.to/quantalabs/setting-up-and-configuring-wsl-392c</link>
      <guid>https://dev.to/quantalabs/setting-up-and-configuring-wsl-392c</guid>
      <description>&lt;p&gt;Linux is by far the best operating system for developers, but, people still use Windows and other operating systems, or have another personal computer which for some reason uses Windows, and so you don't use Linux. Of course, you could literally install Linux onto your computer, but, if you can't, or, just want to have windows for accessibility, enter WSL - Windows Subsystem for Linux. WSL allows you to run a Linux Virtual Machine on your windows machine to run Linux commands and run &lt;code&gt;.deb&lt;/code&gt; or &lt;code&gt;.rpm&lt;/code&gt; files, depending on the distribution you choose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Our steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install WSL&lt;/li&gt;
&lt;li&gt;Install a Linux Distribution&lt;/li&gt;
&lt;li&gt;Configure our Linux Distribution

&lt;ul&gt;
&lt;li&gt;Install VSCode, Python, and other development tools&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Let's get started with install wsl.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install WSL
&lt;/h2&gt;

&lt;p&gt;First things first, we need to install WSL. Open your settings app on Windows, and click "Apps."&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%2F8a6g4tdd6fw4q4b18r4o.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%2F8a6g4tdd6fw4q4b18r4o.png" alt="Apps Menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once at the Apps menu, the right sidebar has a "Related Settings" section, which includes Programs and Features, which you need to go to. Once there, there should be a sidebar, where you should click "Turn Windows features on or off."&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%2Fgy6x15j4cqf12lvd5zbb.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%2Fgy6x15j4cqf12lvd5zbb.png" alt="The Windows Sidebar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From this, you should have a screen like this:&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%2Fdnx99nrff3ulu15tgz57.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%2Fdnx99nrff3ulu15tgz57.png" alt="Turn Windows features on or off Menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the "Window Subsystem for Linux" box, and select Ok. After that, you should have a Restart now button, and click that. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. Install a Linux Distribution
&lt;/h2&gt;

&lt;p&gt;Now, we can install our Linux Distribution. You can install which ever distribution you want, but I'll be showing you the Ubuntu distribution. Go to &lt;a href="https://aka.ms/wslstore" rel="noopener noreferrer"&gt;aka.ms/wslstore&lt;/a&gt;, which will open up the Microsoft Store, showing you Linux Distributions. In the store, click "Ubuntu" and then "Install." Once installed, open up your command prompt, and run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Ubuntu


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

&lt;/div&gt;
&lt;p&gt;If that doesn't work, you can open up the Ubuntu app, which should output something like this:&lt;br&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%2Fh5zfd1u1r14i9tvrsc3c.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%2Fh5zfd1u1r14i9tvrsc3c.png" alt="WSL installation output"&gt;&lt;/a&gt;&lt;br&gt;
From here, it will prompt you to enter your username and password, which can be anything, not your windows username and password, though, you could put that. Make sure you remember it, because we'll be using &lt;code&gt;sudo&lt;/code&gt; to install, which requires you to enter your password. If you do lose it, you can run:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

passwd &amp;lt;username&amp;gt;


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

&lt;/div&gt;
&lt;p&gt;which will reset your password.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Configure our Linux Distribution
&lt;/h2&gt;

&lt;p&gt;Next thing we need to do is configure our distribution, and before we get into install VSC and Python, or anything else, we first need to configure our &lt;code&gt;.bashrc&lt;/code&gt; with some useful aliases and other important scripts. Before any of this, create a new directory called &lt;code&gt;Coding/&lt;/code&gt; or &lt;code&gt;Projects/&lt;/code&gt;, and clone all your repos there. &lt;/p&gt;

&lt;p&gt;Next, we need to configure our &lt;code&gt;.bashrc&lt;/code&gt;. First, run:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

curl https://getmic.ro | bash
&lt;span class="nb"&gt;sudo mv &lt;/span&gt;micro /usr/bin


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

&lt;/div&gt;
&lt;p&gt;This will install micro and move it into the &lt;code&gt;/usr/bin&lt;/code&gt; directory. For those of you who don't know, micro is a command line editor useful for editing small files from the terminal, like &lt;code&gt;.bashrc&lt;/code&gt;, with keyboard shortcuts and other useful things. Now that we have it installed, you can run:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

micro ~/.bashrc


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

&lt;/div&gt;
&lt;p&gt;to open &lt;code&gt;.bashrc&lt;/code&gt;, and start editing it. You can add:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;alias &lt;/span&gt;activate-&amp;lt;PROJECT&amp;gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"cd &amp;lt;PROJECT_DIR&amp;gt;"&lt;/span&gt;


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

&lt;/div&gt;
&lt;p&gt;To quickly switch between projects. From here, you can also add other aliases or any other command you want to run on startup.&lt;/p&gt;

&lt;p&gt;Now, we can start to install the tools we want to run. If you have Visual Studio Code, then normally you'd run:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

code


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

&lt;/div&gt;
&lt;p&gt;to up VSC, but we need to do some extra configurations. Launch VSC- not from your linux distribution- and install the &lt;strong&gt;Visual Studio Code Remote - WSL&lt;/strong&gt; extension. This will allow you to manage your Linux and Windows projects independently. Now, we can run:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

code


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

&lt;/div&gt;
&lt;p&gt;to launch up VSC, and there might be some output which updates your Visual Studio Code, which is for your Linux distribution to install. &lt;/p&gt;
&lt;h3&gt;
  
  
  Anaconda
&lt;/h3&gt;

&lt;p&gt;If you're like me and use anaconda, then you can use:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 
bash Miniconda3-latest-Linux-x86_64.sh


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

&lt;/div&gt;
&lt;p&gt;Now, &lt;code&gt;whereis python&lt;/code&gt; should give you an output like &lt;code&gt;/home/user/anaconda3/bin/python&lt;/code&gt;. If it doesn't, then anaconda isn't on path, so you can add to your &lt;code&gt;.bashrc&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# ~/.bashrc&lt;/span&gt;

&lt;span class="c"&gt;# Add to end of your bashrc.&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/home/user/anaconda3/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;


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

&lt;/div&gt;
&lt;p&gt;This installs miniconda, but if you'd like all the built-in-packages, there are detailed instructions &lt;a href="https://gist.github.com/kauffmanes/5e74916617f9993bc3479f401dfec7da" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Other great tools
&lt;/h3&gt;

&lt;p&gt;I created &lt;a href="https://gist.github.com/Quantalabs/8640dfca495248daf997951a77d69b4c" rel="noopener noreferrer"&gt;this small gist&lt;/a&gt; which installs some basic stuff to get you going, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ZSH/&lt;/li&gt;
&lt;li&gt;Git
and others. &lt;/li&gt;
&lt;/ul&gt;


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



&lt;p&gt;However, there's also &lt;a href="https://starship.rs" rel="noopener noreferrer"&gt;starship&lt;/a&gt; which is an amazing shell, and I had a bit of trouble with the installation, so I'll bear you the trouble and show you how I installed it. &lt;/p&gt;

&lt;h4&gt;
  
  
  Starship
&lt;/h4&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%2Favatars.githubusercontent.com%2Fu%2F49654870%3Fs%3D200%26v%3D4" 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%2Favatars.githubusercontent.com%2Fu%2F49654870%3Fs%3D200%26v%3D4" alt="Starship"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fist, we need to install the binary:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

sh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://starship.rs/install.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The next step varies on which shell your using. The previous gist installed ZSH, and if you'd like to use ZSH, then add the following line to &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# ~/.zshrc&lt;/span&gt;

&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;starship init zsh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;For bash users:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# ~/.bashrc&lt;/span&gt;

&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;starship init bash&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;And if you plan on using fish, you can add this to your fish config:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;# ~/.config/fish/config.fish&lt;/span&gt;

starship init fish | &lt;span class="nb"&gt;source&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;There's a whole lot of other configurations out there, and you can view them &lt;a href="https://starship.rs/guide/#%F0%9F%9A%80-installation" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
And you have starship! &lt;/p&gt;

&lt;p&gt;But... if you want to make your starship stand out, like the one below, things get a little harder.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstarship.rs%2Fpresets%2Fnerd-font-symbols.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%2Fstarship.rs%2Fpresets%2Fnerd-font-symbols.png" alt="Nerd Font Starship Preset"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We first need to configure starship. Run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.config &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;touch&lt;/span&gt; ~/.config/starship.toml


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

&lt;/div&gt;

&lt;p&gt;to create the config file, and open it up however you want:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

code ~/.config/starship.toml &lt;span class="c"&gt;# With VSC&lt;/span&gt;
micro ~/.config/starship.toml &lt;span class="c"&gt;# With micro&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Now, before we edit the config file, you need to download any Nerd Font, I chose FiraCode. You can download them from &lt;a href="https://nerdfonts.com/font-downloads" rel="noopener noreferrer"&gt;here&lt;/a&gt;- and move the zip file into &lt;code&gt;\\wsl$\Ubuntu\home\{USERNAME}\&lt;/code&gt;. Extract the files, and then run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;mkdir&lt;/span&gt; ~/.fonts/
&lt;span class="nb"&gt;mv&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;.ttf ~/.fonts/
fc-cache &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Now, extract the same file, just on your windows system, and then on file explorer, select all the TrueType Font Files, or &lt;code&gt;.ttf&lt;/code&gt; files, and right-click them, and select the install button, which should install the font. Now, in Visual Studio Code, change the "Terminal.Integrated.Font Family" to &lt;code&gt;"FiraCode Nerd Font", Monaco&lt;/code&gt;. Now, use the config from &lt;a href="https://starship.rs/presets/#configuration" rel="noopener noreferrer"&gt;here&lt;/a&gt; and paste it into your starship config file. After that launch up your terminal in any project, and it'll show you something like this:&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%2Fu9hqwucgvo4th3de75dj.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%2Fu9hqwucgvo4th3de75dj.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's WSL! Comment any other cool things you added to starship, zsh, bash, or anything else related to the post that you think I might have missed! &lt;/p&gt;

</description>
      <category>windows</category>
      <category>linux</category>
      <category>wsl</category>
      <category>bash</category>
    </item>
    <item>
      <title>Epispot v3.0.0-alpha</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Tue, 29 Jun 2021 21:56:00 +0000</pubDate>
      <link>https://dev.to/epispot/epispot-v3-0-0-alpha-5heh</link>
      <guid>https://dev.to/epispot/epispot-v3-0-0-alpha-5heh</guid>
      <description>&lt;p&gt;Epispot v3.0.0 alpha is out, and we have a whole lot to talk about.&lt;/p&gt;

&lt;h2&gt;
  
  
  New Plots
&lt;/h2&gt;

&lt;p&gt;Epispot is getting new plots with plotly, and graph styling from science plots if you use matplotlib, not to mention a whole redesign of the plots module, which is now a sub-module, including the &lt;code&gt;epispot.plots.native&lt;/code&gt; for native plots w/ matplotlib and &lt;code&gt;epispot.plots.web&lt;/code&gt; for web-based interactive plotting w/ plotly. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vdLcYfcR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/46249765/122470333-c8fa4b80-cf72-11eb-8c05-b60243ff6a39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vdLcYfcR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/46249765/122470333-c8fa4b80-cf72-11eb-8c05-b60243ff6a39.png" alt="test_plotting_tfs"&gt;&lt;/a&gt;Plotly web chart (stacked area graph of the SEIR model)&lt;/p&gt;

&lt;h2&gt;
  
  
  The CLI
&lt;/h2&gt;

&lt;p&gt;We introduced this in the nightly package a while ago, and now it’s here in the alpha of v3.0.0.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;epispot about 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don’t worry, &lt;code&gt;3.0.0&lt;/code&gt; will have much more than just that command.&lt;/p&gt;

&lt;h2&gt;
  
  
  With more coming soon…
&lt;/h2&gt;

&lt;p&gt;As far as we are concerned, v3.0.0-alpha is only the start, with the beta, rc, and of course, &lt;em&gt;the 3.0 release&lt;/em&gt;, you can expect bug fixes and more coming to epispot.&lt;/p&gt;

</description>
      <category>post</category>
    </item>
    <item>
      <title>The Brilliance of the Compartmental Models</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Fri, 11 Jun 2021 17:57:33 +0000</pubDate>
      <link>https://dev.to/quantalabs/the-brilliance-of-the-compartmental-models-1j99</link>
      <guid>https://dev.to/quantalabs/the-brilliance-of-the-compartmental-models-1j99</guid>
      <description>&lt;p&gt;We’re stuck in the middle of a pandemic and a lockdown, and being a programmer, one of the first things that came to mind was to create a dashboard for people to use. &lt;a href="https://github.com/Quantalabs/NCOVDashboard"&gt;And so I did.&lt;/a&gt; However, the dashboard isn’t really that unique. There are thousands. Nothing really makes my dashboard special. There’s &lt;a href="https://ncov2019.live/"&gt;this one&lt;/a&gt;, &lt;a href="https://covid19.who.int/"&gt;this one&lt;/a&gt;, and &lt;a href="https://federico-dondi.github.io/COVID-19-dashboard/#/"&gt;this one&lt;/a&gt;. What got me interested however was this &lt;a href="https://www.youtube.com/watch?v=gxAaO2rsdIs"&gt;3b1b video&lt;/a&gt;, which used something called a SIR model, which helped predict a outbreak. So, I &lt;a href="https://github.com/Quantalabs/EpiJS"&gt;made one&lt;/a&gt;. Once again, this isn’t the only tool, and there are others. For example, &lt;a href="http://app.covasim.org/"&gt;CovaSim&lt;/a&gt; is made specifically for COVID-19. So, how does these models work?&lt;/p&gt;

&lt;p&gt;All of these models are build on top of the SIR model, which stands for Susceptible, Infected, and &lt;em&gt;Removed.&lt;/em&gt; You might see the R as Recovered, but for this case, we’ll use Removed, because this better represents an outbreak. The R could include both dead and recovered, where we assume people can’t be re-infected. Now, the susceptible class are people who don’t have the disease, and can be infected. The infected class are people who have the disease, and spread it. The Removed class are people who no longer have the disease and cannot catch it. Pretty straightforward, right? Now let’s get into the math.&lt;/p&gt;

&lt;p&gt;Let’s define some variables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;γ - The recovery rate&lt;/li&gt;
&lt;li&gt;β - The infection rate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to this, we have other parameters which will come in handy later on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;R0 - The basic reproduction number, in other words, the amount of one infected infects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this, we can form the basic equations for the model below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gD-PIYWb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/213/1%2ASZm_qqZG8uIIaW0tkw88aQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gD-PIYWb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/213/1%2ASZm_qqZG8uIIaW0tkw88aQ.png" alt="Equations for the SIR model"&gt;&lt;/a&gt;Equations for the SIR Model&lt;/p&gt;

&lt;p&gt;If you are confused by the equations above, don’t fret! It’s quite simple! This states that for the susceptible population, it loses β×&lt;em&gt;S&lt;/em&gt;×&lt;em&gt;I&lt;/em&gt; people each day. The infected population gains that many people each day, however loses γ×&lt;em&gt;I&lt;/em&gt; people each day, which the recovered population gains.&lt;/p&gt;

&lt;p&gt;With this in mind, we can start converting this into JavaScript code:&lt;/p&gt;


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


&lt;p&gt;Notice, instead of having the user pass in the infection rate, we ask them to give us R0 and the recovery/removed rate, which when we multiply together, we get our infection rate.&lt;/p&gt;

&lt;p&gt;So, now that we’ve got our JS code, let’s look at how we can expand this.&lt;/p&gt;

&lt;p&gt;The brilliance of the SIR model is that it might be extremely simple on its own, but it’s almost built to be expanded. Here are some of the things we can expand it with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exposed, people who have the disease but can’t spread it. Like the incubation period in COVID-19. They do eventually become infected.&lt;/li&gt;
&lt;li&gt;Dead, people who are dead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s see how we can turn these into equations:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P95_8z05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/259/1%2Aar7MIZJqmAnuWcCJiNBPYw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P95_8z05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/259/1%2Aar7MIZJqmAnuWcCJiNBPYw.png" alt="Equations for the SEIRD model"&gt;&lt;/a&gt;Equations for a SEIRD model&lt;/p&gt;

&lt;p&gt;This forms a SEIRD model, with the Susceptible, Exposed, Infected, Recovered, and Dead compartments. We now no longer have removed, it’s split up into the dead and recovered. However, as you might have noticed, we brought in some other parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;θ - The death rate.&lt;/li&gt;
&lt;li&gt;α - The rate at which people in the exposed move to the . This is most likely 1/&lt;em&gt;incubation period&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I won’t get into the JS code for this, but, let’s think of other ways to expand this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hospitalized, people with the disease in a hospital.&lt;/li&gt;
&lt;li&gt;Critical, people in critical condition, perhaps in an ICU.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can continue on and on and on, expanding this model, to better represent the world, which is the true brilliance of compartmental models.&lt;/p&gt;

&lt;p&gt;Stay tuned for my next article, where I’ll discuss how to use these equations to help model COVID-19, with data. In the meanwhile, you can play around with data on my &lt;a href="https://epi.js.org/demo"&gt;EpiJS playground&lt;/a&gt;, which allows you to create a SEIRD model with your own customized parameters. If you want a SEIHCRD model, or other models, you can use the library itself in your HTML. You can view the docs &lt;a href="https://epi.js.org"&gt;here&lt;/a&gt;, and import it with your HTML with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"[https://cdn.jsdelivr.net/gh/Quantalabs/EpiJS/web/pre.min.js](https://cdn.jsdelivr.net/gh/Quantalabs/EpiJS/web/pre.min.js)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"[https://cdn.jsdelivr.net/npm/chart.js@3.0.2/dist/chart.min.js](https://cdn.jsdelivr.net/npm/chart.js@3.0.2/dist/chart.min.js)"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;!--&lt;/span&gt; &lt;span class="nx"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;required&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See you soon!&lt;/p&gt;

</description>
      <category>epidemiology</category>
      <category>javascript</category>
      <category>covid19</category>
    </item>
    <item>
      <title>Upcoming epispot and epispot nightly features</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Mon, 12 Apr 2021 18:58:24 +0000</pubDate>
      <link>https://dev.to/epispot/upcoming-epispot-and-epispot-nightly-features-52ep</link>
      <guid>https://dev.to/epispot/upcoming-epispot-and-epispot-nightly-features-52ep</guid>
      <description>&lt;p&gt;We're here to annonunce some new features that will be added (or hopefully added) over the next coming days to epispot nightly. Some of them include:&lt;br&gt;
1) Exporting and Importing epispot models&lt;br&gt;
2) A CLI&lt;br&gt;
3) New Graphs!&lt;/p&gt;
&lt;h2&gt;
  
  
  Exporting and Importing Models
&lt;/h2&gt;

&lt;p&gt;This feature is underway, and will allow users to quickly and easily share they're epispot models. When finished, it should look like the following for reading and writing.&lt;/p&gt;

&lt;p&gt;Writing a model to a &lt;code&gt;.yml&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;epispot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;file_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'yml'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reading a &lt;code&gt;.yml&lt;/code&gt; file with a epispot model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;epispot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;

&lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'model.yml'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'model.py'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above will create a file named model.py with the code to the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  A CLI
&lt;/h2&gt;

&lt;p&gt;Epispot Nightly is getting a brand new CLI! Infact, the code for a &lt;em&gt;very very&lt;/em&gt; basic CLI already has a PR. What can it do? Just the command &lt;code&gt;epispot about&lt;/code&gt; which outputs metadata about the package. However, this will be extended to other uses, such as what we described earlier for importing and exporting models. The PR can be viewed &lt;a href="https://github.com/epispot/epispot/pull/40"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  New Graphs
&lt;/h2&gt;

&lt;p&gt;Epispot Nightly might get some new graphs, and will switch from &lt;a href="https://matplotlib.org"&gt;matplotlib&lt;/a&gt; to &lt;a href="https://pypi.org/project/plotly"&gt;plotly&lt;/a&gt;, with a much better interface. However, it's not final, so don't get too hooked up on this, but we for sure will be getting new graphs in epispot v3.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other cool projects
&lt;/h2&gt;

&lt;p&gt;Epispot developers are working on epidash, which is a interactive demo for epispot on the web. It's kind of like &lt;a href="https://covasim.idmod.org"&gt;covasim's&lt;/a&gt; dashboard, but not for COVID-19, and much more customizable. &lt;br&gt;
Epispot also got a neat new &lt;a href="https://github.com/epipsot/manual"&gt;manual&lt;/a&gt; for a detailed guide on using epispot. The manual can be viewed &lt;a href="https://epispot.github.io/manual"&gt;here&lt;/a&gt;&lt;br&gt;
Speaking of documentation, epispot documentation is going to get a overhaul with a new template for &lt;a href="https://pdoc3.github.io"&gt;pdoc3&lt;/a&gt; to use. Stay tuned for this, though it will come in a bit.&lt;/p&gt;

</description>
      <category>epispot</category>
      <category>epinightly</category>
    </item>
    <item>
      <title>Everything you need to start developing in python</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Sat, 27 Mar 2021 21:37:58 +0000</pubDate>
      <link>https://dev.to/quantalabs/everything-you-need-to-start-developing-in-python-57m5</link>
      <guid>https://dev.to/quantalabs/everything-you-need-to-start-developing-in-python-57m5</guid>
      <description>&lt;p&gt;This is a list of everything you need to have when developing in python, and some of these work for other languages (or even all!), and are things that you'll find you can't develop without after a while.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. GitHub
&lt;/h1&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%2F1000logos.net%2Fwp-content%2Fuploads%2F2018%2F11%2FGitHub-logo.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%2F1000logos.net%2Fwp-content%2Fuploads%2F2018%2F11%2FGitHub-logo.png" alt="GiHub Logo"&gt;&lt;/a&gt;&lt;br&gt;
Well, duh! GitHub is the most basic thing any developer has. Since GitHub also has the largest community of developers, going there makes sense, since your code will reach a larger audience. However, there are arguments that platforms such as &lt;a href="https://gitlab.com" rel="noopener noreferrer"&gt;GitLab&lt;/a&gt; or &lt;a href="https://bitbucket.org/product" rel="noopener noreferrer"&gt;BitBucket&lt;/a&gt; are better. Here's &lt;em&gt;GitLab's&lt;/em&gt; &lt;a href="https://about.gitlab.com/devops-tools/github-vs-gitlab/" rel="noopener noreferrer"&gt;official comparison&lt;/a&gt; of GitHub and GitLab.&lt;/p&gt;
&lt;h1&gt;
  
  
  2. Git
&lt;/h1&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%2Fcdn.freebiesupply.com%2Flogos%2Fthumbs%2F2x%2Fgit-logo.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%2Fcdn.freebiesupply.com%2Flogos%2Fthumbs%2F2x%2Fgit-logo.png" alt="Git Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No, don't go! But whether you use GitLab or GitHub, you obviously have to have Git. Git allows you to connect a "remote" (GitHub, GitLab, BitBucket, etc.) to your computer code, and commit changes you've made on your computer to the remote while saving all of the commits in the commit history. This way, if you stumble across a bug that was caused by the previous commit that could have been prevented, you can easily switch back to the commit. You can also create branches to seamlessly switch between different versions of your project, eg. I'd create a branch to work on a new feature, and then merge the branch with the main branch (often named "main" or "master"). I can also create releases, which git will save as tags, where you can also switch between to see previous versions. There are many more things that Git can do, but I won't go over it all now. You can download it &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Now, if you find Git too complex, but need the features, fret not! Git comes with a built-in GUI, which you can use, but, there are also git clients, such as &lt;a href="https://desktop.github.com" rel="noopener noreferrer"&gt;GitHub Desktop&lt;/a&gt;, or &lt;a href="https://www.sourcetreeapp.com" rel="noopener noreferrer"&gt;Sourcetree&lt;/a&gt;. These supercharge git to allow you to be able to do things with a single click rather than multiple CLI commands.&lt;/p&gt;
&lt;h1&gt;
  
  
  3. A Code Editor
&lt;/h1&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%2Fcode.visualstudio.com%2Fopengraphimg%2Fopengraph-home.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%2Fcode.visualstudio.com%2Fopengraphimg%2Fopengraph-home.png" alt="Picture of the Visual Studio Code Editor Interface"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code editors are important. Very, important. They allow you to speed up your coding with snippets, debugging, and more, vs. coding on your computer notepad, yeah, I know, not very friendly. There are several code editors. And, it really depends on what you want. For python, I think it really comes down to &lt;a href="https://code.visualstudio.com" rel="noopener noreferrer"&gt;VSC&lt;/a&gt; and &lt;a href="https://www.jetbrains.com/pycharm/" rel="noopener noreferrer"&gt;PyCharm&lt;/a&gt;. PyCharm is for pure python development, but VSC comes in handy with support for many other languages, and is extremely customizable, with a busload of extensions. Although PyCharm also has extensions, as I said, it's purely for python. However, there's also Atom and Sublime Text, but these aren't as good as VS Code and PyCharm.&lt;/p&gt;
&lt;h1&gt;
  
  
  4. Python Packages
&lt;/h1&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%2Fstatic.checkio.org%2Fmedia%2Fblog%2Fshare%2Fpip_big.jpg" 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%2Fstatic.checkio.org%2Fmedia%2Fblog%2Fshare%2Fpip_big.jpg" alt="PyPI Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are most likely hundreds of different python packages that you'll use when developing, but, there are a couple you almost need.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Numpy, "the fundamental package for scientific computing with Python."&lt;/li&gt;
&lt;li&gt;Pandas, although this is not a requirement, Pandas comes in handy with data science.&lt;/li&gt;
&lt;li&gt;Matplotlib, for graphing and plotting data.&lt;/li&gt;
&lt;li&gt;Pillow, a python imaging library.&lt;/li&gt;
&lt;li&gt;Requests, for sending HTTP(s) requests.&lt;/li&gt;
&lt;li&gt;Tkinter, can come preinstalled with python depending on the version, for graphics and GUI interfaces.&lt;/li&gt;
&lt;li&gt;Pytest, a great testing library.&lt;/li&gt;
&lt;li&gt;Coverage, a code coverage tool for python.&lt;/li&gt;
&lt;li&gt;Pyinstaller, converts your python code to an executable to help you distribute it to your friends even if they don't have python.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can install them all with this handy command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="err"&gt;pip&lt;/span&gt; &lt;span class="err"&gt;install&lt;/span&gt; &lt;span class="err"&gt;numpy&lt;/span&gt; &lt;span class="err"&gt;pandas&lt;/span&gt; &lt;span class="err"&gt;matplotlib&lt;/span&gt; &lt;span class="err"&gt;pillow&lt;/span&gt; &lt;span class="err"&gt;requests&lt;/span&gt; &lt;span class="err"&gt;tkinter&lt;/span&gt; &lt;span class="err"&gt;pytest&lt;/span&gt; &lt;span class="err"&gt;coverage&lt;/span&gt; &lt;span class="err"&gt;pyinstaller&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  5. A good idea and your trusty brain!
&lt;/h1&gt;

&lt;p&gt;That's about it! Suggest anything else you think that you should be added, and I'll check it out in the comments!&lt;/p&gt;

</description>
      <category>python</category>
      <category>pythonpackages</category>
    </item>
    <item>
      <title>Epispot on Anaconda</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Tue, 02 Feb 2021 17:34:58 +0000</pubDate>
      <link>https://dev.to/epispot/epispot-on-anaconda-15l8</link>
      <guid>https://dev.to/epispot/epispot-on-anaconda-15l8</guid>
      <description>&lt;p&gt;Yes, that’s right. Epispot is on anaconda.&lt;/p&gt;




&lt;p&gt;Okay, first, let’s go through the installation process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;conda config --add channels conda-forge
conda install epispot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, import it in your python project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;epispot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;conda search epispot --channel conda-forge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to view all versions of epispot on anaconda (currently only 1).&lt;/p&gt;

&lt;p&gt;We used the &lt;code&gt;conda-forge&lt;/code&gt; library to publish the package, which you can check out &lt;a href="https://github.com/conda-forge"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, that’s it. epispot 2.0.1 is now on anaconda. You can install it with the instructions above! Once again, thanks to the &lt;code&gt;conda-forge&lt;/code&gt; library for getting it published! Ready, steady, CODE!&lt;/p&gt;

</description>
      <category>epispot</category>
      <category>anaconda</category>
    </item>
    <item>
      <title>Announcing epiblog</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Mon, 01 Feb 2021 00:05:58 +0000</pubDate>
      <link>https://dev.to/epispot/announcing-epiblog-2g4c</link>
      <guid>https://dev.to/epispot/announcing-epiblog-2g4c</guid>
      <description>&lt;p&gt;Announcing epiblog, an all-new blog for epispot, epidemiology, or anything related to epispot! Now, if you’re reading this, I presume you already know about epiblog, so let me explain exactly what epiblog is. epiblog is a community of developers and fans of epispot, where you can share ideas and code through blogging. You can subscribe through RSS to get updates on epiblog.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to Write
&lt;/h1&gt;

&lt;p&gt;First, read the contributing guidelines, and submit a PR to the github repo. Yes, it’s that simple.&lt;/p&gt;

&lt;h1&gt;
  
  
  Release Notes
&lt;/h1&gt;

&lt;p&gt;In addition to normal articles, in-depth info about new releases for the epispot package or any of our other creations will be published here, and announcements for epispot.&lt;/p&gt;

&lt;h1&gt;
  
  
  That’s it!
&lt;/h1&gt;

&lt;p&gt;Yep, that’s it. You now know about epiblog. Ready, set, Blog!&lt;/p&gt;

</description>
      <category>epispot</category>
      <category>epiblog</category>
    </item>
    <item>
      <title>What to code?</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Sun, 03 Jan 2021 03:13:53 +0000</pubDate>
      <link>https://dev.to/quantalabs/what-to-code-k24</link>
      <guid>https://dev.to/quantalabs/what-to-code-k24</guid>
      <description>&lt;p&gt;I'm looking for something fresh, new, and exciting. Maybe not too complex, like a COVID-19 Dashboard. All ideas welcome!&lt;/p&gt;

</description>
      <category>watercooler</category>
      <category>ideas</category>
      <category>stuff</category>
    </item>
    <item>
      <title>Good Resources for creating a programming language</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Sun, 03 Jan 2021 02:53:10 +0000</pubDate>
      <link>https://dev.to/quantalabs/good-resources-for-creating-a-programming-language-38mh</link>
      <guid>https://dev.to/quantalabs/good-resources-for-creating-a-programming-language-38mh</guid>
      <description>&lt;p&gt;A couple of months ago I had the idea to create a programming language. Yeah, crazy right?! Okay, but in all seriousness, learning to create programming languages helps you better understand computers. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“If you don’t know how compilers work, then you don’t know how computers work. If you’re not 100% sure whether you know how compilers work, then you don’t know how they work.” &lt;br&gt;
— Steve Yegge&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, I went along googling "how to create a programming language" and "creating a programming language." You see, the problem here is that there are not too many proper tutorials that help you create a programming language, &lt;em&gt;especially&lt;/em&gt; for beginners. I literally was about to switch my search engine to DuckDuckGo or &lt;em&gt;even Bing!&lt;/em&gt; Now, I did find a couple of different resources, so I'll share them with you now, so you don't have to go through the long time it took me.&lt;/p&gt;

&lt;h1&gt;
  
  
  Resources
&lt;/h1&gt;

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


&lt;div class="ltag__link"&gt;
  &lt;a href="https://blog.usejournal.com/writing-your-own-programming-language-and-compiler-with-python-a468970ae6df" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ar2RVJKP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/0%2ACChKBrQ_bMYz9JNm" alt="Marcelo Andrade"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://blog.usejournal.com/writing-your-own-programming-language-and-compiler-with-python-a468970ae6df" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Writing your own programming language and compiler with Python | by Marcelo Andrade | Noteworthy - The Journal Blog&lt;/h2&gt;
      &lt;h3&gt;Marcelo Andrade ・ &lt;time&gt;Nov 12, 2020&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ze5yh_2q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        blog.usejournal.com
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;I found this one very helpful, and really was what I used in the end to create my programming language. This uses python to create a language.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.
&lt;/h3&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/evantypanski" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7laD0q09--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--q0-NC0eL--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/18263/73b9207b-9f83-41e0-85ed-ef9999217e15.png" alt="evantypanski"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/evantypanski/writing-a-simple-programming-language-from-scratch-part-1-54a2" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Writing a Simple Programming Language from Scratch - Part 1&lt;/h2&gt;
      &lt;h3&gt;Evan Typanski ・ Jul 7 '19 ・ 11 min read&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#cpp&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#c&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#compilers&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;This is also really good. It explains a lot of the concepts in a language, and also gives really helpful diagrams, code snippets, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;a href="https://hackernoon.com/lets-build-a-programming-language-2612349105c6"&gt;Let's Build a Programming Language&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This is the first article in a series that walks you through the steps to create a language. This is another great resource to use and uses JS to create a language.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/alex"&gt;
        alex
      &lt;/a&gt; / &lt;a href="https://github.com/alex/rply"&gt;
        rply
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      An attempt to port David Beazley's PLY to RPython, and give it a cooler API.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/dabeaz"&gt;
        dabeaz
      &lt;/a&gt; / &lt;a href="https://github.com/dabeaz/ply"&gt;
        ply
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Python Lex-Yacc
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
These are both great resources for lexers and parsers. I personally like RPLY, which is a direct port of PLY.

&lt;h3&gt;
  
  
  5.
&lt;/h3&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Eythq9848Fg"&gt;
&lt;/iframe&gt;
&lt;br&gt;
This is one in a 14 part series which really helps you create a programming language.&lt;/p&gt;

&lt;p&gt;That's it! I hope this really helped you find resources to help!&lt;br&gt;
Please comment if you have any other resources too!&lt;/p&gt;

</description>
      <category>resources</category>
    </item>
    <item>
      <title>Creating Apps with ElectronJS</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Mon, 07 Dec 2020 04:41:18 +0000</pubDate>
      <link>https://dev.to/quantalabs/creating-apps-with-electronjs-2850</link>
      <guid>https://dev.to/quantalabs/creating-apps-with-electronjs-2850</guid>
      <description>&lt;p&gt;Twitch, Visual Studio Code, WhatsApp, and Microsoft Teams, just to name a few, are all apps that are created with Electron. But why use it? What is it? What makes it better than another framework? And finally, of course, how do you use it? Let's dive in deep with Electron to answer these questions.&lt;/p&gt;







&lt;h1&gt;
  
  
  What is ElectronJS, and why to use it?
&lt;/h1&gt;

&lt;p&gt;ElectronJS is a JavaScript framework created to help you create apps, without you having to do all the hard parts. It has built-in crash reporting, debugging and profiling, and notifications among other things. It's open-source and free to use and takes around 5 minutes to convert a pre-existing HTML page or project to a desktop app.&lt;/p&gt;

&lt;h1&gt;
  
  
  Basic Electron
&lt;/h1&gt;

&lt;p&gt;First, make sure you have NodeJS and NPM installed, as we'll be using them to install packages, test, and run our app. If you don't have it, you can install it &lt;a href="https://nodejs.org/en/"&gt;here&lt;/a&gt;. Once it's installed, check it's installed correctly by running the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;node -v
npm -v
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A basic electron app will consist of the following files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-electron-app/
├── package.json
├── main.js
└── index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's first create the &lt;code&gt;pacakge.json&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;npm init -y
npm i --save-dev electron
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you don't understand the previous commands, let me go through them right now. The first command, &lt;code&gt;npm init -y&lt;/code&gt;, creates the &lt;code&gt;package.json&lt;/code&gt; file, which stores the info of your NodeJS project, and we'll use commands which are stored in the file later on. The second command, &lt;code&gt;npm i --save-dev electron&lt;/code&gt;, installs electron and saves it as a developer dependency. This means that we use the package to develop our project, but it isn't needed to be installed by the user.&lt;/p&gt;

&lt;p&gt;Now that we have set up the &lt;code&gt;package.json&lt;/code&gt; file, let's create the &lt;code&gt;main.js&lt;/code&gt;. The &lt;code&gt;main.js&lt;/code&gt; is the file which tells electron what to do. Put the following code into it:&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;BrowserWindow&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;electron&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;createWindow&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;win&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;BrowserWindow&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;webPreferences&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;nodeIntegration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;loadFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;index.html&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="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;whenReady&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createWindow&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;window-all-closed&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;platform&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;darwin&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="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;quit&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="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;activate&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;BrowserWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAllWindows&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;createWindow&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's go through it. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, we import the &lt;code&gt;BrowserWindow&lt;/code&gt; and &lt;code&gt;app&lt;/code&gt; modules of the electron package.&lt;/li&gt;
&lt;li&gt;We now create a function to create a browser window and define the details of the window such as the width and height of the window. We load the &lt;code&gt;index.html&lt;/code&gt; file as the body of the window.

&lt;ul&gt;
&lt;li&gt;We then create the window once Electron is initialized. &lt;/li&gt;
&lt;li&gt;When all the windows are closed, we quit the application since the application should no longer be running.&lt;/li&gt;
&lt;li&gt;We then check whether to create a new window, which we do only if no browser windows are visible.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;Okay, the hard part is done, let's get to the &lt;code&gt;index.html&lt;/code&gt; file. This is where we'll create the body of our function. There's nothing really special about this, so just put in any &lt;code&gt;HTML&lt;/code&gt; that you want in it and then you're good. To test, you could put in the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Hello there! Hello World!&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        Hello World!
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, go back to the &lt;code&gt;package.json&lt;/code&gt; and we're going to modify it a little. It should look something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"my-electron-app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"index.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"echo &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Error: no test specified&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; exit 1"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keywords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ISC"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change it to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"my-electron-app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"main"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"main.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"electron ."&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keywords"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"license"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ISC"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This now changes 2 things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We changed the main script to &lt;code&gt;main.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;We added a start script and removed the test script, so now when we run &lt;code&gt;npm start&lt;/code&gt;, it will run our app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We've done it! Open up your console and type &lt;code&gt;npm start&lt;/code&gt;, and you're app should be up and running!&lt;/p&gt;

&lt;p&gt;Now that we've covered creating a basic electron app, we can move on to more complex things such as testing, adding a custom menu, keyboard shortcuts, notifications, multiple windows, and even detecting wether the user is offline or online! We'll cover all of this in the next article of the series, so stay tuned!&lt;/p&gt;

</description>
      <category>html</category>
      <category>javascript</category>
      <category>electronjs</category>
      <category>electron</category>
    </item>
    <item>
      <title>Simple Differential Privacy</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Wed, 25 Nov 2020 01:40:36 +0000</pubDate>
      <link>https://dev.to/quantalabs/simple-differential-privacy-3phh</link>
      <guid>https://dev.to/quantalabs/simple-differential-privacy-3phh</guid>
      <description>&lt;p&gt;&lt;em&gt;Cover Photo by Franki Chamaki on Unsplash&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sorry, what are we coding again?
&lt;/h2&gt;

&lt;p&gt;Differential privacy is really simple. Let’s say, I have a data set of info about people that I want to publish but still keep their data private. That’s where differential privacy comes in. It takes your data and alters it in a way that will keep overall facts about your data in the same area (with more complex algorithms you can alter how close you want it to be) while keeping individuals' data private.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Random Response Mechanism
&lt;/h2&gt;

&lt;p&gt;Okay, let’s get to the details of how we are going to alter this data. We want to start simple, so we’ll code the Random Response mechanism. This is the most simple mechanism for differential privacy. It flips a coin, if it is heads, then it keeps the same value. If it is tails, it flips it again, and if it is heads, it returns true, and if tails, then it returns false. Now, again, as I said before, this is a very simple algorithm so it only works with zeros and ones or true and false.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coding The Random Response Mechanism
&lt;/h2&gt;

&lt;p&gt;Our first step is to get a data set for our algorithm to run on. If you are going to use real data, you’ll need to convert it to an array. You can also use this sample data to test if your algorithm is working:&lt;/p&gt;


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


&lt;p&gt;You could also run a for loop which generates random values and pushes them to an array.&lt;/p&gt;

&lt;p&gt;Now that we have our data, let's start by creating a function called rand_response and use it as what we call to privatize our data. We create it with one parameter, &lt;code&gt;data&lt;/code&gt;, for the data we created earlier.&lt;/p&gt;

&lt;p&gt;Now, we call a for loop to go through the array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then we set a variable, b, as a random number and use if statements to tell if it is a 0 or 1. We’ll need NumPy for this so install it via pip if you haven’t already:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;pip install numpy
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and now import it into our code:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;numpy&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We imported a specific file called random for the random number generation.&lt;/p&gt;

&lt;p&gt;Now let’s generate the number:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;randint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This generates a random integer, either 0 or 1.&lt;/p&gt;

&lt;p&gt;Next, we put the if statements to find the number and change the value accordingly:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;        
   &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;        
   &lt;span class="n"&gt;b1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;randint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    

   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;            
      &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;  

   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;b1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;            
      &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And now we’ve finished! You should have something like this:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
When you run rand_response(data) and then print data, you should see the data changed a little bit. Now, this isn’t very private, but it is the first step. Now that you know how differential privacy, try other mechanisms like the Exponential Mechanism and Laplace Mechanism. If you want to use these algorithms, you can use my python package DiffPriv.&lt;br&gt;&lt;/p&gt;

&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Quantalabs"&gt;
        Quantalabs
      &lt;/a&gt; / &lt;a href="https://github.com/Quantalabs/DiffPriv"&gt;
        DiffPriv
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A python package for differential privacy and encryption.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>differentialprivacy</category>
      <category>python</category>
    </item>
    <item>
      <title>Simple Disease Outbreak Modeling - Inspired by a 3b1b video</title>
      <dc:creator>QLabs</dc:creator>
      <pubDate>Tue, 24 Nov 2020 01:56:56 +0000</pubDate>
      <link>https://dev.to/quantalabs/simple-disease-outbreak-modeling-inspired-by-a-3b1b-video-4763</link>
      <guid>https://dev.to/quantalabs/simple-disease-outbreak-modeling-inspired-by-a-3b1b-video-4763</guid>
      <description>&lt;p&gt;As the COVID-19 outbreak rages on, a good look at the outbreak would help. And when I saw a video by 3b1b on simulating epidemics, I tried to recreate what he did. So let's get started.&lt;/p&gt;

&lt;p&gt;Since we need to put our graphics somewhere, we create a canvas in HTML and initialize it in JS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;canvas&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"c"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    Your browser does not support the canvas.
&lt;span class="nt"&gt;&amp;lt;/canvas&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And our JS:&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;var&lt;/span&gt; &lt;span class="nx"&gt;cv&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="s2"&gt;canvas&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&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;innerWidth&lt;/span&gt;   
&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt; &lt;span class="o"&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;innerHeight&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, we need variables such as the population and infection rate &lt;br&gt;
(quick note, we’ll be coding this in JS, so make sure you understand basic JS before taking this tutorial).&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;var&lt;/span&gt; &lt;span class="nx"&gt;population&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;   
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;infected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; 
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;   
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;currentInfections&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Okay, so it’s pretty self-explanatory, but let's just go over it. The population variable is the amount of dots/people in the simulation. The infected variable is the start number of infections, and we have this because there can be 10 or 20 ‘patient zeros’ in an outbreak. The speed is how fast the dots move, and currentInfections is the number of infections. Now, the reason we have infected and currentInfections is because currentInfections is how many we have at any given time during the outbreak, while infected is how many we have to start with.&lt;/p&gt;

&lt;p&gt;Next, we need an array where we will store each value, such as whether it is infected, susceptible, or recovered; the dots x and y; and its velocity, which I will explain in a moment.&lt;/p&gt;

&lt;p&gt;Before I get to velocity, I want to explain what our model is. Our model is called a SIR model, which stands for susceptible, infected, and recovered. The susceptible population can get infected, the infected population can infect others, and the recovered population can no longer infect others, and, in this model, no longer can be re-infected.&lt;/p&gt;

&lt;p&gt;Now, let’s get to velocity. This is the direction of the dots, such as left, right, up, or down. We will have two parts, velocity x, and velocity y. This way, dots don’t only go up, down, left, and right, but also in diagonals.&lt;/p&gt;

&lt;p&gt;Because writing out all of this will take too long, we will use a for loop. We first define our array:&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;var&lt;/span&gt; &lt;span class="nx"&gt;dots&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now we will add to it:&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="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;population&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;infected&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&lt;span class="nx"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&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;Let’s go over it. Since each dot has several parts to it, we create sub-arrays inside it. The first 2 parameters are x and y. We place them in a random position on our canvas, but to place them in the center of the screen, we multiply them by 3/4.&lt;/p&gt;

&lt;p&gt;Next, we have its state: susceptible, infected, or recovered. We can add more states like dead or immune instead of recovered, but let’s keep it simple for now. We put 0 as susceptible, 1 as infected, and 2 as recovered.&lt;/p&gt;

&lt;p&gt;We have our velocity values next. We multiply the speed with a random number to get our velocity.&lt;/p&gt;

&lt;p&gt;Now, you might have noticed that the for loop only covers 99 people, not 100. This is because we need to have a new for loop for the infected population.&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="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;infected&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;speed&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&lt;span class="nx"&gt;speed&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&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;Now, we create a function called refresh() to do our animation.&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;var&lt;/span&gt; &lt;span class="nx"&gt;refresh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before we get to the animation and drawing, make sure to draw the boundary of the “city”, which is a white rectangle.&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="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fillStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rgb(255,255,255)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;strokeRect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the function, we need to do our animation and drawing. We first draw circles for all the susceptible population, which will be blue, then the infected, which is red, and the removed/recovered population, which is grey. I’ll let you figure this one out.&lt;/p&gt;

&lt;p&gt;Now, let’s animate them. We run a for loop which will go through the dots array and animates them.&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="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;population&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
  &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;      
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nx"&gt;speed&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;     
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;speed&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;     
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nx"&gt;speed&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;       
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;speed&lt;/span&gt; &lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;      
  &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;     
  &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;      
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;      
    &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;      
  &lt;span class="p"&gt;}&lt;/span&gt;     
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;cv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;      
  &lt;span class="p"&gt;}&lt;/span&gt;     
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;      
  &lt;span class="p"&gt;}&lt;/span&gt;    
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have that done, we need to start infecting others. To do this, we run a nested for loop which will find the infected dots. Once we find them, we will run a nested for loop to find other dots within the infection radius, which we put as 5. I’ll let you figure this one out too since it shouldn’t be too hard (HINT: there’s a double nested for loop).&lt;/p&gt;

&lt;p&gt;Now, we’ve infected, we’ve drawn, and we’ve animated. We just need one more thing. Since people either die or recover, we should add that in. We add another element to the sub-arrays inside dots. At the beginning of the for loop (the first one) we put this:&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="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you put a different variable in the for loop, replace i with that variable. At the end, put this:&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="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;&lt;span class="nx"&gt;dots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds a “timer” to the infected ones and once it reaches 200, it changes to one of the removed dots.&lt;/p&gt;

&lt;p&gt;We’ve now accomplished everything! To draw and completely animate, put this at the end of refresh():&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="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;requestAnimationFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;refresh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then run the function:&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="nx"&gt;refresh&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: This model does not represent the COVID-19 outbreak or any other outbreak, but it can be a very, very, very, very, very simple way to represent an outbreak.&lt;/p&gt;

&lt;h1&gt;
  
  
  What to Add
&lt;/h1&gt;

&lt;p&gt;Several things you can add include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dead and Recovered dots, instead of just the removed population as a whole&lt;/li&gt;
&lt;li&gt;Social distancing (this can be achieved by not moving some of the dots, and the idea was from a post by Harry Stevens)&lt;/li&gt;
&lt;li&gt;Quarantining a portion of the sick dots (only a portion, because not everyone who is sick shows symptoms and gets tested)&lt;/li&gt;
&lt;li&gt;Adding several communities where people travel from one to the other (idea from the 3b1b video I mentioned)&lt;/li&gt;
&lt;li&gt;Graphs, charts, data, etc.&lt;/li&gt;
&lt;li&gt;More customization in the parameters such as the infection rate, speed, recovery rate, etc&lt;/li&gt;
&lt;li&gt;A central spot, like a shop (also from the 3b1b video)
For more complex modeling, I suggest you check out q9i’s article on disease modeling — Reopening Safely: The Data Science Approach on Medium (link at the end)&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Examples
&lt;/h1&gt;

&lt;p&gt;Here are some good examples&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.washingtonpost.com/graphics/2020/world/corona-simulator/"&gt;Harry Stevens Washington Post Article&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://quantum9innovation.github.io/disease"&gt;q9i’s recreation of the 3b1b video&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://quantalabs.github.io/Disease"&gt;My recreation of the 3b1b video&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://prajwalsouza.github.io/Experiments/Epidemic-Simulation.html"&gt;Prajwal DSouza’s re-creation of the 3b1b video&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=gxAaO2rsdIs"&gt;The 3b1b Video&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Further Reading
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://q9i.medium.com/reopening-safely-the-data-science-approach-289fd86ef63"&gt;q9i's article on Infectious Disease Modeling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.washingtonpost.com/graphics/2020/world/corona-simulator/"&gt;Harry Stevens Washington Post Article&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://towardsdatascience.com/infectious-disease-modelling-part-i-understanding-sir-28d60e29fdfc"&gt;Henri Fersoe's Medium Article on the Towards Data Science publication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>3blue1brown</category>
      <category>infectiousdiseasemodeling</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
